use of org.eclipse.lsp4j.DidOpenTextDocumentParams in project xtext-core by eclipse.
the class LspExtensionTest method testExtension.
@Test
public void testExtension() {
try {
final String fileURI = this.writeFile("mydoc.testlang", "");
this.initialize();
final TestLangLSPExtension ext = ServiceEndpoints.<TestLangLSPExtension>toServiceObject(this.languageServer, TestLangLSPExtension.class);
DidOpenTextDocumentParams _didOpenTextDocumentParams = new DidOpenTextDocumentParams();
final Procedure1<DidOpenTextDocumentParams> _function = (DidOpenTextDocumentParams it) -> {
TextDocumentItem _textDocumentItem = new TextDocumentItem();
final Procedure1<TextDocumentItem> _function_1 = (TextDocumentItem it_1) -> {
it_1.setUri(fileURI);
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo bar");
_builder.newLine();
_builder.append("baz test");
_builder.newLine();
_builder.append("\t");
_builder.append("bla blubb");
_builder.newLine();
it_1.setText(_builder.toString());
};
TextDocumentItem _doubleArrow = ObjectExtensions.<TextDocumentItem>operator_doubleArrow(_textDocumentItem, _function_1);
it.setTextDocument(_doubleArrow);
};
DidOpenTextDocumentParams _doubleArrow = ObjectExtensions.<DidOpenTextDocumentParams>operator_doubleArrow(_didOpenTextDocumentParams, _function);
this.languageServer.didOpen(_doubleArrow);
TestLangLSPExtension.TextOfLineParam _textOfLineParam = new TestLangLSPExtension.TextOfLineParam();
final Procedure1<TestLangLSPExtension.TextOfLineParam> _function_1 = (TestLangLSPExtension.TextOfLineParam it) -> {
it.uri = fileURI;
it.line = 1;
};
TestLangLSPExtension.TextOfLineParam _doubleArrow_1 = ObjectExtensions.<TestLangLSPExtension.TextOfLineParam>operator_doubleArrow(_textOfLineParam, _function_1);
final TestLangLSPExtension.TextOfLineResult result = ext.getTextOfLine(_doubleArrow_1).get();
Assert.assertEquals("baz test", result.text);
final Function1<Pair<String, Object>, Object> _function_2 = (Pair<String, Object> it) -> {
return it.getValue();
};
Assert.assertEquals(2, IterableExtensions.size(Iterables.<TestLangLSPExtension.BuildNotification>filter(ListExtensions.<Pair<String, Object>, Object>map(this.notifications, _function_2), TestLangLSPExtension.BuildNotification.class)));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations