diff options
author | George Fraser <george@fivetran.com> | 2017-05-06 11:13:34 -0400 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2017-05-06 11:13:34 -0400 |
commit | 8de72c2283bfc4d2ebc1ae7a5307e3685b504a15 (patch) | |
tree | 969f0b2e0d7e8ee5d7177e072b40cb8fc6af76c2 | |
parent | cc9325869823d2f8e32bfee79346e5441359739d (diff) | |
download | java-language-server-8de72c2283bfc4d2ebc1ae7a5307e3685b504a15.zip |
Defer to user-specified source path
-rw-r--r-- | .vscode/settings.json | 4 | ||||
-rw-r--r-- | src/main/java/org/javacs/JavaLanguageServer.java | 2 | ||||
-rw-r--r-- | src/main/java/org/javacs/JavaSettings.java | 3 |
3 files changed, 8 insertions, 1 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 237c2b4..6dbf7d5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -31,5 +31,9 @@ "com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile", "org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:jar:0.2.0-SNAPSHOT:compile" ], + "java.sourceDirectories": [ + "src/main/java", + "src/test/java" + ], "java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home" }
\ No newline at end of file diff --git a/src/main/java/org/javacs/JavaLanguageServer.java b/src/main/java/org/javacs/JavaLanguageServer.java index 0610656..2044ced 100644 --- a/src/main/java/org/javacs/JavaLanguageServer.java +++ b/src/main/java/org/javacs/JavaLanguageServer.java @@ -491,7 +491,7 @@ class JavaLanguageServer implements LanguageServer { // TODO this function needs to be invoked whenever the user creates a new .java file outside the existing source root private void createCompiler() { - Set<Path> sourcePath = InferConfig.workspaceSourcePath(workspaceRoot); + Set<Path> sourcePath = settings.java.sourceDirectories.orElseGet(() -> InferConfig.workspaceSourcePath(workspaceRoot)); Path userHome = Paths.get(System.getProperty("user.home")); Path mavenHome = userHome.resolve(".m2"); Path gradleHome = userHome.resolve(".gradle"); diff --git a/src/main/java/org/javacs/JavaSettings.java b/src/main/java/org/javacs/JavaSettings.java index a611d15..f20680f 100644 --- a/src/main/java/org/javacs/JavaSettings.java +++ b/src/main/java/org/javacs/JavaSettings.java @@ -1,14 +1,17 @@ package org.javacs; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.Set; public class JavaSettings { public Java java = new Java(); public static class Java { public List<String> externalDependencies = new ArrayList<>(); + public Optional<Set<Path>> sourceDirectories = Optional.empty(); public Optional<String> javaHome = Optional.empty(); } }
\ No newline at end of file |