summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxndcn <xndchn@gmail.com>2018-09-30 17:29:34 +0800
committerXiong Nandi <xiongnandi@xiaomi.com>2018-09-30 17:32:46 +0800
commit464b9d3864ec61328492e2015a72ba01a0b9067d (patch)
tree25399646e24b12484d3b90ac9dd7e1fbbf9fbf8d /src
parent9b9c6a3270424ee6f8530db14b0c01f8e2d3d458 (diff)
downloadjava-language-server-464b9d3864ec61328492e2015a72ba01a0b9067d.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/javacs/JavaTextDocumentService.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/org/javacs/JavaTextDocumentService.java b/src/main/java/org/javacs/JavaTextDocumentService.java
index b53978a..5e67f2b 100644
--- a/src/main/java/org/javacs/JavaTextDocumentService.java
+++ b/src/main/java/org/javacs/JavaTextDocumentService.java
@@ -541,7 +541,7 @@ class JavaTextDocumentService implements TextDocumentService {
if (document.getVersion() > existing.version) {
for (var change : params.getContentChanges()) {
if (change.getRange() == null)
- activeDocuments.put(uri, new VersionedContent(change.getText(), document.getVersion()));
+ newText = change.getText();
else newText = patch(newText, change);
}