Skip to content

Commit f703f2a

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 acd3589 commit f703f2a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎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)