diff options
-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 |