summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2019-01-06 12:20:24 -0800
committerGeorge Fraser <george@fivetran.com>2019-01-06 12:20:24 -0800
commitd4e1274a33378d33b45d3effab7f0976e39a1b8a (patch)
tree4e6c460e8daf5fafda7f7d911df8e92f4198db59
parent3b196bb2dafbfa78034e9c1195d2f0ec4cd70abe (diff)
downloadjava-language-server-d4e1274a33378d33b45d3effab7f0976e39a1b8a.zip
Better logging
-rw-r--r--src/main/java/org/javacs/JavaCompilerService.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main/java/org/javacs/JavaCompilerService.java b/src/main/java/org/javacs/JavaCompilerService.java
index 5cfb418..6a0c6d9 100644
--- a/src/main/java/org/javacs/JavaCompilerService.java
+++ b/src/main/java/org/javacs/JavaCompilerService.java
@@ -479,17 +479,30 @@ public class JavaCompilerService {
private static Cache<String, Boolean> cacheContainsWord = new Cache<>();
private List<Path> containsWord(Collection<Path> allFiles, Element to) {
- // Figure out which of those files have the word `to`
+ // Figure out what name we're looking for
var name = to.getSimpleName().toString();
if (name.equals("<init>")) name = to.getEnclosingElement().getSimpleName().toString();
if (!name.matches("\\w*")) throw new RuntimeException(String.format("`%s` is not a word", name));
- var hasWord = new ArrayList<Path>();
+
+ // Figure out all files that need to be re-scanned
+ var outOfDate = new ArrayList<Path>();
for (var file : allFiles) {
if (cacheContainsWord.needs(file, name)) {
- // TODO this needs to use open text if available
- var found = Parser.containsWord(file, name);
- cacheContainsWord.load(file, name, found);
+ outOfDate.add(file);
}
+ }
+
+ // Update those files in cacheContainsWord
+ LOG.info(String.format("...scanning %d out-of-date files for the word `%s`", outOfDate.size(), name));
+ for (var file : outOfDate) {
+ // TODO this needs to use open text if available
+ var found = Parser.containsWord(file, name);
+ cacheContainsWord.load(file, name, found);
+ }
+
+ // Assemble list of all files that contain name
+ var hasWord = new ArrayList<Path>();
+ for (var file : allFiles) {
if (cacheContainsWord.get(file, name)) {
hasWord.add(file);
}