use of org.eclipse.lsp4j.CodeActionParams in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testCodeAction.
protected void testCodeAction(final Procedure1<? super AbstractLanguageServerTest.TestCodeActionConfiguration> configurator) {
try {
@Extension final AbstractLanguageServerTest.TestCodeActionConfiguration configuration = new AbstractLanguageServerTest.TestCodeActionConfiguration();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
final String filePath = this.initializeContext(configuration).getUri();
CodeActionParams _codeActionParams = new CodeActionParams();
final Procedure1<CodeActionParams> _function = (CodeActionParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(filePath);
it.setTextDocument(_textDocumentIdentifier);
CodeActionContext _codeActionContext = new CodeActionContext();
final Procedure1<CodeActionContext> _function_1 = (CodeActionContext it_1) -> {
it_1.setDiagnostics(this.getDiagnostics().get(filePath));
};
CodeActionContext _doubleArrow = ObjectExtensions.<CodeActionContext>operator_doubleArrow(_codeActionContext, _function_1);
it.setContext(_doubleArrow);
};
CodeActionParams _doubleArrow = ObjectExtensions.<CodeActionParams>operator_doubleArrow(_codeActionParams, _function);
final CompletableFuture<List<? extends Command>> codeLenses = this.languageServer.codeAction(_doubleArrow);
if ((configuration.assertCodeActions != null)) {
configuration.assertCodeActions.apply(codeLenses.get());
} else {
this.assertEquals(configuration.expectedCodeActions, this.toExpectation(codeLenses.get()));
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations