From a1886d6d8787876abe80b59b0a564178cb367b45 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Mon, 1 Nov 2021 07:52:10 -0700 Subject: [PATCH] IndentOperator: rename `include` to `includeRegex` Otherwise, it conflicts with HOCON reserved keyword. --- docs/configuration.md | 15 ++++++++++----- .../org/scalafmt/config/IndentOperator.scala | 12 +++++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 09194c3249..0873c011b6 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -539,23 +539,28 @@ function { } ``` -#### `indentOperator.exclude` +#### `indentOperator.excludeRegex` Defines a regular expression for excluded infix operators. If an eligible operator matches, it will not be indented. +In v3.1.0, this parameter was renamed from `indentOperator.exclude`. + ```scala mdoc:defaults -indentOperator.exclude +indentOperator.excludeRegex ``` -#### `indentOperator.include` +#### `indentOperator.includeRegex` Defines a regular expression for included infix operators. If an eligible operator matches and is not excluded explicitly by -[indentOperator.exclude](#indentoperatorexclude), it be will indented. +[indentOperator.excludeRegex](#indentoperatorexcluderegex), it be will indented. + +In v3.1.0, due to conflict with built-in HOCON keyword, this parameter was +renamed from `indentOperator.include`. ```scala mdoc:defaults -indentOperator.include +indentOperator.includeRegex ``` #### `indentOperator.preset` diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/config/IndentOperator.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/config/IndentOperator.scala index a82feb7da5..da9e97d773 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/config/IndentOperator.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/config/IndentOperator.scala @@ -49,11 +49,13 @@ import metaconfig._ */ case class IndentOperator( topLevelOnly: Boolean = true, - include: String = ".*", - exclude: String = "^(&&|\\|\\|)$" + @annotation.ExtraName("include") + includeRegex: String = ".*", + @annotation.ExtraName("exclude") + excludeRegex: String = "^(&&|\\|\\|)$" ) { - private val includeRegexp = include.r.pattern - private val excludeRegexp = exclude.r.pattern + private val includeRegexp = includeRegex.r.pattern + private val excludeRegexp = excludeRegex.r.pattern def noindent(op: String): Boolean = excludeRegexp.matcher(op).find() || !includeRegexp.matcher(op).find() @@ -61,7 +63,7 @@ case class IndentOperator( object IndentOperator { private val default = IndentOperator() - private val akka = IndentOperator(include = "^.*=$", exclude = "^$") + private val akka = IndentOperator(includeRegex = "^.*=$", excludeRegex = "^$") implicit lazy val surface: generic.Surface[IndentOperator] = generic.deriveSurface