use of org.eclipse.lsp4j.LocationLink in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testDefinition.
protected void testDefinition(final Procedure1<? super DefinitionTestConfiguration> configurator) {
try {
@Extension final DefinitionTestConfiguration configuration = new DefinitionTestConfiguration();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
final String fileUri = this.initializeContext(configuration).getUri();
DefinitionParams _definitionParams = new DefinitionParams();
final Procedure1<DefinitionParams> _function = (DefinitionParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
it.setTextDocument(_textDocumentIdentifier);
int _line = configuration.getLine();
int _column = configuration.getColumn();
Position _position = new Position(_line, _column);
it.setPosition(_position);
};
DefinitionParams _doubleArrow = ObjectExtensions.<DefinitionParams>operator_doubleArrow(_definitionParams, _function);
final CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> definitionsFuture = this.languageServer.definition(_doubleArrow);
final Either<List<? extends Location>, List<? extends LocationLink>> definitions = definitionsFuture.get();
Procedure1<? super List<? extends Location>> _assertDefinitions = configuration.getAssertDefinitions();
boolean _tripleNotEquals = (_assertDefinitions != null);
if (_tripleNotEquals) {
configuration.getAssertDefinitions().apply(definitions.getLeft());
} else {
final String actualDefinitions = this.toExpectation(definitions);
this.assertEquals(configuration.getExpectedDefinitions(), actualDefinitions);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations