Skip to content

Commit 464b9d3

Browse files
committed
Fix issue of didChange for null range change.
When only one change is happened, and `change.getRange() == null`, so a new version content will be put into activeDocuments. However, later `newText` will still overwrite this version. Unfortunately, in this case, `newText` will be `existing.content`. So in this case, the existing content will be put into activeDocuments in the end.
1 parent 9b9c6a3 commit 464b9d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/javacs/JavaTextDocumentService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ public void didChange(DidChangeTextDocumentParams params) {
541541
if (document.getVersion() > existing.version) {
542542
for (var change : params.getContentChanges()) {
543543
if (change.getRange() == null)
544-
activeDocuments.put(uri, new VersionedContent(change.getText(), document.getVersion()));
544+
newText = change.getText();
545545
else newText = patch(newText, change);
546546
}
547547

0 commit comments

Comments
 (0)