use of org.eclipse.xtext.ide.tests.testlanguage.ide.TestLangLSPExtension.TextOfLineResult 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