Skip to content

Commit

Permalink
chore: Retry code actions for Scala CLi diags
Browse files Browse the repository at this point in the history
I must have lost it during one of the rebases
  • Loading branch information
tgodzik committed Oct 28, 2024
1 parent 6c2bbf5 commit 6453328
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ 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 @@ -95,7 +96,8 @@ class BaseScalaCLIActionSuite(name: String)
changeFile,
expectError,
filterAction,
overrideLayout = layout,
layout,
retryAction,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ScalaCliActionsSuite
val coursierComplete = new CoursierComplete(scalaCompilerVersion)
val newestOsLib: String = coursierComplete
.complete("com.lihaoyi::os-lib:")
.filterNot(_.contains("M"))
.headOption
.map(_.stripPrefix(":"))
.getOrElse("0.8.1")
Expand All @@ -53,6 +54,7 @@ class ScalaCliActionsSuite
scalaCliOptions = List("--actions", "-S", scalaVersion),
expectNoDiagnostics = false,
selectedActionIndex = 1,
retryAction = 5,
)

checkScalaCLI(
Expand Down Expand Up @@ -83,6 +85,7 @@ class ScalaCliActionsSuite
scalaCliOptions = List("--actions", "-S", scalaVersion),
expectNoDiagnostics = false,
selectedActionIndex = 1,
retryAction = 5,
)

checkNoActionScalaCLI(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ abstract class BaseCodeActionLspSuite(
.recoverWith {
case _: Throwable if retry > 0 =>
Thread.sleep(2000)
scribe.debug("Retrying code actions")
assertCodeAction(retry - 1)
case _: Throwable if expectError =>
Future.successful(Nil)
Expand Down

0 comments on commit 6453328

Please sign in to comment.