use of org.eclipse.xtext.ide.server.symbol.DocumentSymbolService in project xtext-core by eclipse.
the class LanguageServerImpl method definition.
protected List<? extends Location> definition(final CancelIndicator cancelIndicator, final TextDocumentPositionParams params) {
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
DocumentSymbolService _get = null;
if (resourceServiceProvider != null) {
_get = resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
}
final DocumentSymbolService documentSymbolService = _get;
if ((documentSymbolService == null)) {
return CollectionLiterals.<Location>emptyList();
}
final Function2<Document, XtextResource, List<? extends Location>> _function = (Document document, XtextResource resource) -> {
return documentSymbolService.getDefinitions(document, resource, params, this.resourceAccess, cancelIndicator);
};
return this.workspaceManager.<List<? extends Location>>doRead(uri, _function);
}
use of org.eclipse.xtext.ide.server.symbol.DocumentSymbolService in project xtext-core by eclipse.
the class LanguageServerImpl method definition.
/**
* Compute the definition.
*/
protected List<? extends Location> definition(CancelIndicator cancelIndicator, DefinitionParams params) {
URI uri = getURI(params);
DocumentSymbolService documentSymbolService = getService(uri, DocumentSymbolService.class);
if (documentSymbolService == null) {
return Collections.emptyList();
}
return workspaceManager.doRead(uri, (doc, res) -> documentSymbolService.getDefinitions(doc, res, params, resourceAccess, cancelIndicator));
}
use of org.eclipse.xtext.ide.server.symbol.DocumentSymbolService in project xtext-core by eclipse.
the class WorkspaceSymbolService method getSymbols.
public List<? extends SymbolInformation> getSymbols(final String query, final IReferenceFinder.IResourceAccess resourceAccess, final IResourceDescriptions indexData, final CancelIndicator cancelIndicator) {
final LinkedList<SymbolInformation> result = CollectionLiterals.<SymbolInformation>newLinkedList();
Iterable<IResourceDescription> _allResourceDescriptions = indexData.getAllResourceDescriptions();
for (final IResourceDescription resourceDescription : _allResourceDescriptions) {
{
this.operationCanceledManager.checkCanceled(cancelIndicator);
final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(resourceDescription.getURI());
DocumentSymbolService _get = null;
if (resourceServiceProvider != null) {
_get = resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
}
final DocumentSymbolService documentSymbolService = _get;
if ((documentSymbolService != null)) {
List<? extends SymbolInformation> _symbols = documentSymbolService.getSymbols(resourceDescription, query, resourceAccess, cancelIndicator);
Iterables.<SymbolInformation>addAll(result, _symbols);
}
}
}
return result;
}
use of org.eclipse.xtext.ide.server.symbol.DocumentSymbolService in project xtext-core by eclipse.
the class LanguageServerImpl method references.
/**
* Compute the references. Executed in read request.
* @since 2.20
*/
protected List<? extends Location> references(ReferenceParams params, CancelIndicator cancelIndicator) {
URI uri = getURI(params);
DocumentSymbolService documentSymbolService = getService(uri, DocumentSymbolService.class);
if (documentSymbolService == null) {
return Collections.emptyList();
}
return workspaceManager.doRead(uri, (document, resource) -> documentSymbolService.getReferences(document, resource, params, resourceAccess, workspaceManager.getIndex(), cancelIndicator));
}
Aggregations