Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: take last change in didChange #6237

Merged
merged 1 commit into from Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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