Skip to content

Commit

Permalink
fix: take last change in didChange
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed Mar 26, 2024
1 parent d2f68e5 commit ab3e722
Showing 1 changed file with 10 additions and 2 deletions.
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

0 comments on commit ab3e722

Please sign in to comment.