diff options
author | George Fraser <george@fivetran.com> | 2018-12-27 14:24:24 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-12-27 14:24:24 -0800 |
commit | 84982255bbcf53bec86e31b6cd4f7282169ccc5d (patch) | |
tree | a79362475400e039228ecb06ab3a415f0f23e86a /src/test | |
parent | 5b2339d7a7a33edd7fe6390181b2e26e167e3c92 (diff) | |
download | java-language-server-84982255bbcf53bec86e31b6cd4f7282169ccc5d.zip |
Fix enum completions, cache hovers
Diffstat (limited to 'src/test')
3 files changed, 30 insertions, 5 deletions
diff --git a/src/test/java/org/javacs/CompletionsTest.java b/src/test/java/org/javacs/CompletionsTest.java index 569a620..1a8171d 100644 --- a/src/test/java/org/javacs/CompletionsTest.java +++ b/src/test/java/org/javacs/CompletionsTest.java @@ -667,14 +667,22 @@ public class CompletionsTest extends CompletionsBase { } @Test - public void switchCase() { + public void enumConstantFromSourcePath() { var file = "/org/javacs/example/AutocompleteCase.java"; - var suggestions = insertText(file, 8, 18); + var suggestions = insertText(file, 6, 18); assertThat("suggests enum options", suggestions, containsInAnyOrder("Foo", "Bar")); } @Test + public void enumConstantFromClassPath() { + var file = "/org/javacs/example/AutocompleteCaseFromClassPath.java"; + var suggestions = insertText(file, 8, 18); + + assertThat("suggests enum options", suggestions, containsInAnyOrder("FULL", "LONG", "MEDIUM", "SHORT")); + } + + @Test public void staticStarImport() { var file = "/org/javacs/example/AutocompleteStaticImport.java"; var suggestions = insertText(file, 9, 15); diff --git a/src/test/test-project/workspace/src/org/javacs/example/AutocompleteCase.java b/src/test/test-project/workspace/src/org/javacs/example/AutocompleteCase.java index 1a5788f..d8afd69 100644 --- a/src/test/test-project/workspace/src/org/javacs/example/AutocompleteCase.java +++ b/src/test/test-project/workspace/src/org/javacs/example/AutocompleteCase.java @@ -2,13 +2,15 @@ package org.javacs.example; class AutocompleteCase { void test() { - var e = MyEnum.Foo; - - switch (e) { + switch (myEnum()) { case } } + MyEnum myEnum() { + return MyEnum.Foo; + } + enum MyEnum { Foo, Bar diff --git a/src/test/test-project/workspace/src/org/javacs/example/AutocompleteCaseFromClasspath.java b/src/test/test-project/workspace/src/org/javacs/example/AutocompleteCaseFromClasspath.java new file mode 100644 index 0000000..6a893ae --- /dev/null +++ b/src/test/test-project/workspace/src/org/javacs/example/AutocompleteCaseFromClasspath.java @@ -0,0 +1,15 @@ +package org.javacs.example; + +import java.time.format.FormatStyle; + +class AutocompleteCaseFromClasspath { + public void main() { + switch (style()) { + case + } + } + + private FormatStyle style() { + return FormatStyle.FULL; + } +}
\ No newline at end of file |