use of org.eclipse.lsp4j.WorkspaceSymbolParams in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testSymbol.
protected void testSymbol(final Procedure1<? super WorkspaceSymbolConfiguration> configurator) {
try {
@Extension final WorkspaceSymbolConfiguration configuration = new WorkspaceSymbolConfiguration();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
this.initializeContext(configuration);
String _query = configuration.getQuery();
WorkspaceSymbolParams _workspaceSymbolParams = new WorkspaceSymbolParams(_query);
final List<? extends SymbolInformation> symbols = this.languageServer.symbol(_workspaceSymbolParams).get();
Procedure1<? super List<? extends SymbolInformation>> _assertSymbols = configuration.getAssertSymbols();
boolean _tripleNotEquals = (_assertSymbols != null);
if (_tripleNotEquals) {
configuration.getAssertSymbols().apply(symbols);
} else {
final String actualSymbols = this.toExpectation(symbols);
this.assertEquals(configuration.getExpectedSymbols(), actualSymbols);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.lsp4j.WorkspaceSymbolParams in project sts4 by spring-projects.
the class InWorkspaceSymbolsProvider method fetchFor.
@Override
public Collection<SymbolInformation> fetchFor(String query) throws Exception {
// TODO: if we want decent support for multiple language servers...
// consider changing SymbolsProvider api and turning the stuff in here into something producing a
// Flux<Collection<SymbolInformation>>
// This will help in
// - supporting cancelation
// - executing multiple requests to different servers in parallel.
// - producing results per server so don't have to wait for one slow server to see the rest.
// However it will also add complexity to the code that consumes this and at this time we only
// really use this with a single language server anyways.
WorkspaceSymbolParams params = new WorkspaceSymbolParams(query);
Flux<SymbolInformation> symbols = Flux.fromIterable(this.languageServers).flatMap(server -> Mono.fromFuture(server.getWorkspaceService().symbol(params)).timeout(TIMEOUT).doOnError(e -> log(e)).onErrorReturn(ImmutableList.of()).flatMapMany(Flux::fromIterable));
// Consider letting the Flux go out from here instead of blocking and collecting elements.
return symbols.take(MAX_RESULTS).collect(Collectors.toList()).block();
}
Aggregations