Skip to content

Commit

Permalink
Merge branch 'main' into deemphasize-skipped-frames
Browse files Browse the repository at this point in the history
  • Loading branch information
adpi2 committed Mar 26, 2024
2 parents f2b270e + ab3e722 commit 6640e3f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,15 @@ class MetalsLspService(

override def didChange(
params: DidChangeTextDocumentParams
): CompletableFuture[Unit] =
params.getContentChanges.asScala.headOption match {
): CompletableFuture[Unit] = {
val changesSize = params.getContentChanges.size()
if (changesSize != 1) {
scribe.debug(
s"did change notification contained $changesSize content changes, expected 1"
)
}

params.getContentChanges.asScala.lastOption match {
case None => CompletableFuture.completedFuture(())
case Some(change) =>
val path = params.getTextDocument.getUri.toAbsolutePath
Expand All @@ -1152,6 +1159,7 @@ class MetalsLspService(
.ignoreValue
.asJava
}
}

override def didClose(params: DidCloseTextDocumentParams): Unit = {
val path = params.getTextDocument.getUri.toAbsolutePath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ object MtagsResolver {
private val states =
new ConcurrentHashMap[String, State]()

def hasStablePresentationCompiler(scalaVersion: String): Boolean =
SemVer.isCompatibleVersion(
firstScala3PCVersion,
scalaVersion,
)

def isSupportedInOlderVersion(version: String): Boolean =
removedScalaVersions.contains(version)

Expand Down Expand Up @@ -153,7 +159,8 @@ object MtagsResolver {
s"Resolved latest nightly mtags version: $scalaVersion"
}
scribe.debug(msg)
case _: State.Failure =>
case _: State.Failure
if !hasStablePresentationCompiler(scalaVersion) =>
val errorMsg = resolveType match {
case ResolveType.Regular =>
s"Failed to resolve mtags for $scalaVersion"
Expand All @@ -163,6 +170,7 @@ object MtagsResolver {
s"Failed to resolve latest nightly mtags version: $scalaVersion"
}
scribe.info(errorMsg)
case _ =>
}
state
}
Expand Down Expand Up @@ -208,10 +216,7 @@ object MtagsResolver {
// Fallback to Stable PC version
case _: State.Failure
if resolveType != ResolveType.StablePC &&
SemVer.isCompatibleVersion(
firstScala3PCVersion,
scalaVersion,
) =>
hasStablePresentationCompiler(scalaVersion) =>
resolve(
scalaVersion,
None,
Expand Down

0 comments on commit 6640e3f

Please sign in to comment.