use of org.eclipse.xtext.ide.tests.testlanguage.ide.TestLangLSPExtension in project xtext-core by eclipse.
the class LspExtensionTest method testExtension_readIndex.
@Test
public void testExtension_readIndex() throws Exception {
writeFile("model.testlang", "type C {\n" + " op baz() { }\n" + "}\n" + "type A {\n" + " op foo() { }\n" + "}\n" + "type B {\n" + " op bar() { }\n" + "}\n");
initialize();
TestLangLSPExtension ext = ServiceEndpoints.toServiceObject(languageServer, TestLangLSPExtension.class);
List<String> actual = IterableExtensions.sort(Lists.newArrayList(ext.getAllOpNames().get()));
Assert.assertEquals(Lists.newArrayList("bar", "baz", "foo"), actual);
}
use of org.eclipse.xtext.ide.tests.testlanguage.ide.TestLangLSPExtension in project xtext-core by eclipse.
the class LspExtensionTest method testExtension.
@Test
public void testExtension() throws Exception {
String fileURI = writeFile("mydoc.testlang", "");
initialize();
TestLangLSPExtension ext = ServiceEndpoints.toServiceObject(languageServer, TestLangLSPExtension.class);
DidOpenTextDocumentParams didOpenTextDocumentParams = new DidOpenTextDocumentParams();
String text = "foo bar" + System.lineSeparator() + "baz test" + System.lineSeparator() + " bla blubb";
didOpenTextDocumentParams.setTextDocument(new TextDocumentItem(fileURI, "testlang", 0, text));
languageServer.didOpen(didOpenTextDocumentParams);
TextOfLineParam textOfLineParam = new TextOfLineParam();
textOfLineParam.uri = fileURI;
textOfLineParam.line = 1;
TextOfLineResult result = ext.getTextOfLine(textOfLineParam).get();
Assert.assertEquals("baz test", result.text);
Assert.assertEquals(2, IterableExtensions.size(Iterables.filter(Iterables.transform(notifications, n -> n.getValue()), TestLangLSPExtension.BuildNotification.class)));
}
Aggregations