summaryrefslogtreecommitdiff
path: root/src/main/java/org/javacs/JavaLanguageServer.java
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2018-12-31 21:51:29 -0800
committerGeorge Fraser <george@fivetran.com>2018-12-31 21:51:29 -0800
commitfffcb11d28323f8db3686ae66a28cea47f57ff8a (patch)
treedb483438170e149df1fe2682dad13880ee60c44d /src/main/java/org/javacs/JavaLanguageServer.java
parentc1a2ec0e932a4d0c35012bee5e9844b1ce8d3332 (diff)
downloadjava-language-server-fffcb11d28323f8db3686ae66a28cea47f57ff8a.zip
Logs
Diffstat (limited to 'src/main/java/org/javacs/JavaLanguageServer.java')
-rw-r--r--src/main/java/org/javacs/JavaLanguageServer.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/org/javacs/JavaLanguageServer.java b/src/main/java/org/javacs/JavaLanguageServer.java
index aedf4d9..c6a18e6 100644
--- a/src/main/java/org/javacs/JavaLanguageServer.java
+++ b/src/main/java/org/javacs/JavaLanguageServer.java
@@ -969,15 +969,18 @@ class JavaLanguageServer extends LanguageServer {
private Map<Ptr, Integer> cacheCountReferences = Collections.emptyMap();
private URI cacheCountReferencesFile = URI.create("file:///NONE");
+ private int cacheCountReferencesVersion = -1;
private void updateCacheCountReferences(URI current) {
- if (cacheCountReferencesFile.equals(current)) return;
+ if (cacheCountReferencesFile.equals(current) && cacheCountReferencesVersion == contents(current).version)
+ return;
LOG.info(String.format("Update cached reference count to %s...", current));
- var content = contents(current).content;
+ var contents = contents(current);
try (var progress = new Progress()) {
- cacheCountReferences = countReferences(current, content, progress);
+ cacheCountReferences = countReferences(current, contents.content, progress);
}
cacheCountReferencesFile = current;
+ cacheCountReferencesVersion = contents.version;
}
private Map<URI, Index> index = new HashMap<>();
@@ -1104,6 +1107,7 @@ class JavaLanguageServer extends LanguageServer {
var el = hoverCache.element(line, character);
if (el.isEmpty()) {
LOG.warning(String.format("No element to resolve code lens at %s(%d,%d)", uri.getPath(), line, character));
+ // TODO this causes <<MISSING COMMAND>> to appear
return unresolved;
}
var ptr = new Ptr(el.get());