diff options
author | George Fraser <george@fivetran.com> | 2019-01-05 21:55:16 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2019-01-05 21:55:16 -0800 |
commit | c4ad50a74ac99ea48424be120d1c369b9f1d24e0 (patch) | |
tree | a6a430aa05f1d9aca33c31db73c29e5d76abc6f0 | |
parent | 69ee31525a2be65254aafec0b5bf2d959e1a9b84 (diff) | |
download | java-language-server-c4ad50a74ac99ea48424be120d1c369b9f1d24e0.zip |
Minor fixes
-rw-r--r-- | package-lock.json | 2 | ||||
-rw-r--r-- | src/main/java/org/javacs/CompileBatch.java | 1 | ||||
-rw-r--r-- | src/main/java/org/javacs/JavaCompilerService.java | 2 | ||||
-rw-r--r-- | src/main/java/org/javacs/JavaLanguageServer.java | 6 | ||||
-rw-r--r-- | src/main/java/org/javacs/lsp/Diagnostic.java | 3 |
5 files changed, 11 insertions, 3 deletions
diff --git a/package-lock.json b/package-lock.json index 284aafd..5440c83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -371,7 +371,7 @@ }, "event-stream": { "version": "3.3.4", - "resolved": "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", "dev": true, "requires": { diff --git a/src/main/java/org/javacs/CompileBatch.java b/src/main/java/org/javacs/CompileBatch.java index fdb2da4..6b94b73 100644 --- a/src/main/java/org/javacs/CompileBatch.java +++ b/src/main/java/org/javacs/CompileBatch.java @@ -246,6 +246,7 @@ public class CompileBatch { for (var r : roots) { finder.scan(r, null); } + LOG.info(String.format("...found %d references", refs.size())); return refs; } diff --git a/src/main/java/org/javacs/JavaCompilerService.java b/src/main/java/org/javacs/JavaCompilerService.java index 68695e7..5cfb418 100644 --- a/src/main/java/org/javacs/JavaCompilerService.java +++ b/src/main/java/org/javacs/JavaCompilerService.java @@ -319,7 +319,7 @@ public class JavaCompilerService { return scanForPotentialReferences(to, new FindMethod()); } else { // Fields, type parameters can only be referenced from within the same file - LOG.info(String.format("...find definition of `%s`", to)); + LOG.info(String.format("...references to `%s` must be in the same file", to)); var files = new HashSet<URI>(); var toFile = declaringFile(to); // If there is no declaring file diff --git a/src/main/java/org/javacs/JavaLanguageServer.java b/src/main/java/org/javacs/JavaLanguageServer.java index af8ba41..86fb7cc 100644 --- a/src/main/java/org/javacs/JavaLanguageServer.java +++ b/src/main/java/org/javacs/JavaLanguageServer.java @@ -110,6 +110,9 @@ class JavaLanguageServer extends LanguageServer { d.range = new Range(start, end); d.code = j.getCode(); d.message = j.getMessage(null); + if (j.getCode().equals("unused")) { + d.tags = List.of(DiagnosticTag.Unnecessary); + } // Add to byUri var ds = byUri.computeIfAbsent(uri, __ -> new ArrayList<>()); ds.add(d); @@ -341,6 +344,7 @@ class JavaLanguageServer extends LanguageServer { @Override public Optional<CompletionList> completion(TextDocumentPositionParams position) { + // TODO reuse previous compilation when changes are small var started = Instant.now(); var uri = position.textDocument.uri; if (!isJavaFile(uri)) return Optional.empty(); @@ -1019,7 +1023,7 @@ class JavaLanguageServer extends LanguageServer { String title; if (count == -1) title = "? references"; else if (count == 1) title = "1 reference"; - else if (count == 100) title = "Many references"; + else if (count == 100) title = "Find references"; else title = String.format("%d references", count); var arguments = new JsonArray(); arguments.add(uri.toString()); diff --git a/src/main/java/org/javacs/lsp/Diagnostic.java b/src/main/java/org/javacs/lsp/Diagnostic.java index 404957e..2cd4f09 100644 --- a/src/main/java/org/javacs/lsp/Diagnostic.java +++ b/src/main/java/org/javacs/lsp/Diagnostic.java @@ -1,7 +1,10 @@ package org.javacs.lsp; +import java.util.List; + public class Diagnostic { public Range range; public Integer severity; public String code, source, message; + public List<Integer> tags; // DiagnosticTag } |