diff options
author | George Fraser <george@fivetran.com> | 2019-01-04 21:52:17 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2019-01-04 21:52:17 -0800 |
commit | 5dd9d7d4f50bdc1f3791b8f1f4a65a8893bca722 (patch) | |
tree | 0ae8f071f54c8324575308b3995eab9b920abaf5 /src/main/java/org/javacs/JavaLanguageServer.java | |
parent | 5bee8166de838a82baa18ef9449f5d2814d5a625 (diff) | |
download | java-language-server-5dd9d7d4f50bdc1f3791b8f1f4a65a8893bca722.zip |
Java can reference a symbol without importing it
Diffstat (limited to 'src/main/java/org/javacs/JavaLanguageServer.java')
-rw-r--r-- | src/main/java/org/javacs/JavaLanguageServer.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/javacs/JavaLanguageServer.java b/src/main/java/org/javacs/JavaLanguageServer.java index 2193788..92fc68f 100644 --- a/src/main/java/org/javacs/JavaLanguageServer.java +++ b/src/main/java/org/javacs/JavaLanguageServer.java @@ -1037,10 +1037,12 @@ class JavaLanguageServer extends LanguageServer { } // Compile all files that *might* contain references to toEl - // TODO if this gets too big, just show "Many references" var fromFiles = compiler.potentialReferences(toEl.get()); fromFiles.add(toUri); + // If it's too expensive to compute the code lens + if (fromFiles.size() > 10) return "Many references"; + // Make sure all fromFiles -> toUri references are in the cache updateCountReferencesCache(toUri, fromFiles); @@ -1101,7 +1103,6 @@ class JavaLanguageServer extends LanguageServer { String.format( "...%d files need to be re-counted for references to %s", outOfDate.size(), Parser.fileName(toFile))); - // TODO this extra file could be eliminated by remembering a List<Ptr> for the current file outOfDate.add(toFile); countReferencesCache.remove(toFile); var batch = compiler.compileBatch(latestText(outOfDate)); @@ -1293,7 +1294,7 @@ class JavaLanguageServer extends LanguageServer { throw new RuntimeException("TODO"); } - private boolean isJavaFile(URI uri) { + static boolean isJavaFile(URI uri) { return uri.getScheme().equals("file") && uri.getPath().endsWith(".java"); } |