diff options
author | George Fraser <george@fivetran.com> | 2018-12-29 15:41:49 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-12-29 15:41:49 -0800 |
commit | d3a571890704d128c03d76e4a757849e8cc587ac (patch) | |
tree | af1eae43ee4bcaf60e53e4e0c8dba78f61f4f9b5 /src | |
parent | 9f9ae3a6ed1f0e20e50ef117f39bbcd439bd653c (diff) | |
download | java-language-server-d3a571890704d128c03d76e4a757849e8cc587ac.zip |
Ignore non-files
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/javacs/JavaLanguageServer.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/org/javacs/JavaLanguageServer.java b/src/main/java/org/javacs/JavaLanguageServer.java index 38aa7f2..e0a6d60 100644 --- a/src/main/java/org/javacs/JavaLanguageServer.java +++ b/src/main/java/org/javacs/JavaLanguageServer.java @@ -884,15 +884,15 @@ class JavaLanguageServer extends LanguageServer { return null; // TODO } - private boolean isJava(URI uri) { - return uri.getPath().endsWith(".java"); + private boolean isJavaFile(URI uri) { + return uri.getScheme().equals("file") && uri.getPath().endsWith(".java"); } @Override public void didOpenTextDocument(DidOpenTextDocumentParams params) { var document = params.textDocument; var uri = document.uri; - if (isJava(uri)) { + if (isJavaFile(uri)) { activeDocuments.put(uri, new VersionedContent(document.text, document.version)); lint(Collections.singleton(uri)); } @@ -902,7 +902,7 @@ class JavaLanguageServer extends LanguageServer { public void didChangeTextDocument(DidChangeTextDocumentParams params) { var document = params.textDocument; var uri = document.uri; - if (isJava(uri)) { + if (isJavaFile(uri)) { var existing = activeDocuments.get(uri); var newText = existing.content; @@ -956,7 +956,7 @@ class JavaLanguageServer extends LanguageServer { public void didCloseTextDocument(DidCloseTextDocumentParams params) { var document = params.textDocument; var uri = document.uri; - if (isJava(uri)) { + if (isJavaFile(uri)) { // Remove from source cache activeDocuments.remove(uri); @@ -968,7 +968,7 @@ class JavaLanguageServer extends LanguageServer { @Override public void didSaveTextDocument(DidSaveTextDocumentParams params) { var uri = params.textDocument.uri; - if (isJava(uri)) { + if (isJavaFile(uri)) { // Re-lint all active documents lint(activeDocuments.keySet()); // TODO update config when java file implies a new source root |