From ead4e2ecc9d5529387eec8b44bcfe8b488cab78e Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Mon, 19 Aug 2024 15:22:01 +0200 Subject: [PATCH] chore: Adjust tests to include disabled --- .../internal/metals/codeactions/OrganizeImports.scala | 2 +- tests/unit/src/main/scala/tests/TestingServer.scala | 9 +++++++-- .../tests/codeactions/OrganizeImportsLspSuite.scala | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/metals/src/main/scala/scala/meta/internal/metals/codeactions/OrganizeImports.scala b/metals/src/main/scala/scala/meta/internal/metals/codeactions/OrganizeImports.scala index 75e2e741b2b..f3c8e402bd3 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/codeactions/OrganizeImports.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/codeactions/OrganizeImports.scala @@ -43,7 +43,7 @@ sealed abstract class OrganizeImports( title = this.title, kind = this.kind, disabledReason = - Some("Can not organize imports if file has error"), + Some("Cannot organize imports if the file has an error"), ) ) ) diff --git a/tests/unit/src/main/scala/tests/TestingServer.scala b/tests/unit/src/main/scala/tests/TestingServer.scala index c0faf128cea..591ad6595e8 100644 --- a/tests/unit/src/main/scala/tests/TestingServer.scala +++ b/tests/unit/src/main/scala/tests/TestingServer.scala @@ -1410,8 +1410,13 @@ final case class TestingServer( .asScala .map(_.asScala.filter(filterAction)) } yield ( - codeActions.toList, - codeActions.map(_.getTitle()).mkString("\n"), + codeActions.toList.filter(_.getDisabled() == null), + codeActions + .map(a => + a.getTitle() + + Option(a.getDisabled()).fold("")(_ => " (disabled)") + ) + .mkString("\n"), ) def assertSemanticHighlight( diff --git a/tests/unit/src/test/scala/tests/codeactions/OrganizeImportsLspSuite.scala b/tests/unit/src/test/scala/tests/codeactions/OrganizeImportsLspSuite.scala index 399671d1397..fe818a102f4 100644 --- a/tests/unit/src/test/scala/tests/codeactions/OrganizeImportsLspSuite.scala +++ b/tests/unit/src/test/scala/tests/codeactions/OrganizeImportsLspSuite.scala @@ -286,7 +286,7 @@ class OrganizeImportsLspSuite | val a: Int = "no one wants unused imports" |} |""".stripMargin, - "", // This should give back no code action + s"${SourceOrganizeImports.title} (disabled)", """|package a | |import java.time.Instant