From 6a1a83aa0eae02bc497098401ece0fe732eea7ac Mon Sep 17 00:00:00 2001 From: Chris Lee Date: Tue, 11 Jun 2024 11:53:30 -0700 Subject: [PATCH] Add support for Gradle assignment operator --- .../com/facebook/ktfmt/format/RedundantImportDetector.kt | 5 ++++- .../src/test/java/com/facebook/ktfmt/format/FormatterTest.kt | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/facebook/ktfmt/format/RedundantImportDetector.kt b/core/src/main/java/com/facebook/ktfmt/format/RedundantImportDetector.kt index ba285f6d..8ecd7849 100644 --- a/core/src/main/java/com/facebook/ktfmt/format/RedundantImportDetector.kt +++ b/core/src/main/java/com/facebook/ktfmt/format/RedundantImportDetector.kt @@ -76,7 +76,10 @@ internal class RedundantImportDetector(val enabled: Boolean) { // Property delegation operators "getValue", "setValue", - "provideDelegate") + "provideDelegate", + // assign operator - Gradle compiler plugin https://blog.gradle.org/simpler-kotlin-dsl-property-assignment + "assign" + ) private val COMPONENT_OPERATOR_REGEX = Regex("component\\d+") diff --git a/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt b/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt index efe54d7c..408dd2b5 100644 --- a/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt +++ b/core/src/test/java/com/facebook/ktfmt/format/FormatterTest.kt @@ -1451,6 +1451,7 @@ class FormatterTest { |import com.example.timesAssign |import com.example.unaryMinus |import com.example.unaryPlus + |import org.gradle.kotlin.dsl.assign |""" .trimMargin())