Fix failing test cases
This commit is contained in:
@@ -21,6 +21,7 @@ import java.util.function.Consumer;
|
||||
import org.eclipse.lsp4j.CompletionItem;
|
||||
import org.eclipse.lsp4j.CompletionList;
|
||||
import org.eclipse.lsp4j.InsertTextFormat;
|
||||
import org.eclipse.lsp4j.MarkupContent;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.TextEdit;
|
||||
@@ -68,7 +69,7 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
|
||||
try {
|
||||
resolveItem(doc, completion, unresolved);
|
||||
} catch (Exception e) {
|
||||
LOG.get().error("{}", e);
|
||||
LOG.get().error("", e);
|
||||
}
|
||||
});
|
||||
return id;
|
||||
@@ -183,7 +184,6 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
|
||||
|
||||
private static void resolveItem(TextDocument doc, ICompletionProposal completion, CompletionItem item) throws Exception {
|
||||
item.setDocumentation(toMarkdown(completion.getDocumentation()));
|
||||
resolveEdits(doc, completion, item);
|
||||
}
|
||||
|
||||
private static void resolveEdits(TextDocument doc, ICompletionProposal completion, CompletionItem item) {
|
||||
|
||||
@@ -70,6 +70,7 @@ import org.eclipse.lsp4j.Hover;
|
||||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.MarkupContent;
|
||||
import org.eclipse.lsp4j.MessageActionItem;
|
||||
import org.eclipse.lsp4j.MessageParams;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
@@ -604,6 +605,23 @@ public class LanguageServerHarness<S extends SimpleLanguageServerWrapper> {
|
||||
return getServer().getTextDocumentService().definition(params).get();
|
||||
}
|
||||
|
||||
public static void assertDocumentation(String expected, CompletionItem completion) {
|
||||
assertEquals(expected, getDocAsString(completion));
|
||||
}
|
||||
|
||||
private static String getDocAsString(CompletionItem completion) {
|
||||
if (completion!=null) {
|
||||
Either<String, MarkupContent> doc = completion.getDocumentation();
|
||||
if (doc.isLeft()) {
|
||||
return doc.getLeft();
|
||||
} else {
|
||||
return doc.getRight().getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<CodeAction> getCodeActions(TextDocumentInfo doc, Diagnostic problem) throws Exception {
|
||||
CodeActionContext context = new CodeActionContext(ImmutableList.of(problem));
|
||||
List<? extends Command> actions =
|
||||
|
||||
@@ -16,6 +16,7 @@ import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness.assertDocumentation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -918,10 +919,9 @@ public class ManifestYamlEditorTest {
|
||||
"stack: windows<*>"
|
||||
).get(0);
|
||||
|
||||
assertEquals("an-org : a-space [test.io]", c.getDocumentation());
|
||||
assertDocumentation("an-org : a-space [test.io]", c);
|
||||
}
|
||||
|
||||
|
||||
@Test public void domainReconcile() throws Exception {
|
||||
List<CFDomain> domains = ImmutableList.of(mockDomain("one.com"), mockDomain("two.com"));
|
||||
when(cloudfoundry.client.getDomains()).thenReturn(domains);
|
||||
@@ -1332,7 +1332,7 @@ public class ManifestYamlEditorTest {
|
||||
" - mysql<*>"
|
||||
).get(0);
|
||||
assertEquals("mysql - medium", completion.getLabel());
|
||||
assertEquals("an-org : a-space [test.io]", completion.getDocumentation());
|
||||
assertDocumentation("an-org : a-space [test.io]", completion);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1344,7 +1344,7 @@ public class ManifestYamlEditorTest {
|
||||
|
||||
CompletionItem completion = assertCompletions("buildpack: <*>", "buildpack: java_buildpack<*>").get(0);
|
||||
assertEquals("java_buildpack", completion.getLabel());
|
||||
assertEquals("an-org : a-space [test.io]", completion.getDocumentation());
|
||||
assertDocumentation("an-org : a-space [test.io]", completion);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1361,7 +1361,7 @@ public class ManifestYamlEditorTest {
|
||||
|
||||
CompletionItem completion = assertCompletions("buildpack: <*>", "buildpack: <*>").get(0);
|
||||
assertEquals(title, completion.getLabel());
|
||||
assertEquals(description, completion.getDocumentation());
|
||||
assertDocumentation(description, completion);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1372,7 +1372,7 @@ public class ManifestYamlEditorTest {
|
||||
when(cfClient.getDomains()).thenReturn(ImmutableList.of(domain));
|
||||
|
||||
CompletionItem completion = assertCompletions("domain: <*>", "domain: cfapps.io<*>").get(0);
|
||||
assertEquals("an-org : a-space [test.io]", completion.getDocumentation());
|
||||
assertDocumentation("an-org : a-space [test.io]", completion);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1391,7 +1391,7 @@ public class ManifestYamlEditorTest {
|
||||
"- cfapps.io<*>"
|
||||
).get(0);
|
||||
|
||||
assertEquals("an-org : a-space [test.io]", completion.getDocumentation());
|
||||
assertDocumentation("an-org : a-space [test.io]", completion);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user