Repository query methods completion accounts for Java Records

This commit is contained in:
aboyko
2023-09-20 19:20:37 -04:00
parent 8d4e41763e
commit e41f45dc8f
3 changed files with 121 additions and 27 deletions

View File

@@ -742,6 +742,23 @@ public class LanguageServerHarness {
assertEquals(expect.toString(), actual.toString());
}
public void assertOneOfCompletions(String textBefore, String expectTextAfter) throws Exception {
Editor editor = newEditor(textBefore);
StringBuilder actualCompletions = new StringBuilder();
List<? extends CompletionItem> completions = editor.getCompletions();
for (CompletionItem ci : completions) {
editor = newEditor(textBefore);
editor.apply(ci);
if (editor.getText().equals(expectTextAfter)) {
return;
}
actualCompletions.append(editor.getText());
actualCompletions.append("\n-------------------\n");
}
fail("Not found expected proposal completion in:\n" + actualCompletions);
}
public void assertCompletionDisplayString(String editorContents, String expected) throws Exception {
Editor editor = newEditor(editorContents);
CompletionItem completion = editor.getFirstCompletion();