diff options
author | George Fraser <george@fivetran.com> | 2018-12-31 17:40:45 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-12-31 17:40:45 -0800 |
commit | c1a2ec0e932a4d0c35012bee5e9844b1ce8d3332 (patch) | |
tree | 16405b15420d28cc6d9533a53db2d757eea02965 /src/test/java/org/javacs/FindResource.java | |
parent | 9c8b908f5f4b2395a14652a9fcf3a2a20006e621 (diff) | |
download | java-language-server-c1a2ec0e932a4d0c35012bee5e9844b1ce8d3332.zip |
Invalidate indexes when targets change
Diffstat (limited to 'src/test/java/org/javacs/FindResource.java')
-rw-r--r-- | src/test/java/org/javacs/FindResource.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/FindResource.java b/src/test/java/org/javacs/FindResource.java index ce07a04..6e6860e 100644 --- a/src/test/java/org/javacs/FindResource.java +++ b/src/test/java/org/javacs/FindResource.java @@ -1,8 +1,11 @@ package org.javacs; +import java.io.IOException; import java.net.URI; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.List; /** Find java sources in test-project/workspace/src */ public class FindResource { @@ -12,6 +15,17 @@ public class FindResource { return path.toUri(); } + public static String contents(String resourcePath) { + var path = path(resourcePath); + List<String> lines; + try { + lines = Files.readAllLines(path); + } catch (IOException e) { + throw new RuntimeException(e); + } + return String.join("\n", lines); + } + public static Path path(String resourcePath) { if (resourcePath.startsWith("/")) resourcePath = resourcePath.substring(1); |