Skip to content

Commit

Permalink
bugfix: Don't resolve _ artifact type as it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Oct 11, 2024
1 parent 3ec4fe0 commit 099f299
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 31 deletions.
1 change: 0 additions & 1 deletion project/TestGroups.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,4 @@ object TestGroups {
"tests.ServerLivenessMonitorSuite", "tests.ResetWorkspaceLspSuite",
"tests.ToplevelWithInnerScala3Suite"),
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class BaseScalaCLIActionSuite(name: String)
changeFile: String => String = identity,
expectError: Boolean = false,
filterAction: CodeAction => Boolean = _ => true,
retryAction: Int = 0,
)(implicit loc: Location): Unit = {

val path = toPath(fileName)
Expand Down Expand Up @@ -97,7 +96,6 @@ class BaseScalaCLIActionSuite(name: String)
expectError,
filterAction,
overrideLayout = layout,
retryAction = retryAction,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ class ScalaCliActionsSuite
scalaCliOptions = List("--actions", "-S", scalaVersion),
expectNoDiagnostics = false,
selectedActionIndex = 1,
// Scala CLI doesn't publish everything with the normal diagnostics, but later
retryAction = 5,
)

checkScalaCLI(
Expand Down Expand Up @@ -85,8 +83,6 @@ class ScalaCliActionsSuite
scalaCliOptions = List("--actions", "-S", scalaVersion),
expectNoDiagnostics = false,
selectedActionIndex = 1,
// Scala CLI doesn't publish everything with the normal diagnostics, but later
retryAction = 5,
)

checkNoActionScalaCLI(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/src/main/scala/tests/Library.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ object Library {
val fetch = Fetch
.create()
.withMainArtifacts()
.withClassifiers(Set("sources", "_").asJava)
.addClassifiers("sources")
.withDependencies(
deps: _*
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ abstract class BaseCodeActionLspSuite(
expectError: Boolean = false,
filterAction: CodeAction => Boolean = _ => true,
overrideLayout: Option[String] = None,
retryAction: Int = 0,
)(implicit loc: Location): Unit = {
val scalacOptionsJson =
if (scalacOptions.nonEmpty)
Expand Down Expand Up @@ -89,7 +88,6 @@ abstract class BaseCodeActionLspSuite(
changeFile,
expectError,
filterAction,
retryAction,
)
}

Expand All @@ -107,7 +105,6 @@ abstract class BaseCodeActionLspSuite(
changeFile: String => String = identity,
expectError: Boolean = false,
filterAction: CodeAction => Boolean = _ => true,
retryAction: Int = 0,
)(implicit loc: Location): Unit = {
val files = FileLayout.mapFromString(layout)
val (path, input) = files
Expand All @@ -123,25 +120,6 @@ abstract class BaseCodeActionLspSuite(
if (renamePath.nonEmpty) input.replace("<<", "").replace(">>", "")
else expectedCode

def assertActionsWithRetry(
retry: Int = retryAction
): Future[List[CodeAction]] = {
server
.assertCodeAction(
path,
changeFile(input),
expectedActions,
kind,
filterAction = filterAction,
)
.recoverWith {
case _: Throwable if retry > 0 =>
Thread.sleep(1000)
assertActionsWithRetry(retry - 1)
case _: Throwable if expectError => Future.successful(Nil)
}
}

test(name) {
cleanWorkspace()
for {
Expand All @@ -157,7 +135,18 @@ abstract class BaseCodeActionLspSuite(
path,
changeFile(input).replace("<<", "").replace(">>", ""),
)
codeActions <- assertActionsWithRetry()
codeActions <-
server
.assertCodeAction(
path,
changeFile(input),
expectedActions,
kind,
filterAction = filterAction,
)
.recover {
case _: Throwable if expectError => Nil
}
_ <- client.applyCodeAction(selectedActionIndex, codeActions, server)
_ <- server.didSave(newPath) { _ =>
if (newPath != path)
Expand Down

0 comments on commit 099f299

Please sign in to comment.