use of org.eclipse.xtext.ide.server.contentassist.ContentAssistService in project xtext-core by eclipse.
the class LanguageServerImpl method completion.
protected Either<List<CompletionItem>, CompletionList> completion(final CancelIndicator origialCancelIndicator, final TextDocumentPositionParams params) {
final LanguageServerImpl.BufferedCancelIndicator cancelIndicator = new LanguageServerImpl.BufferedCancelIndicator(origialCancelIndicator);
final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
ContentAssistService _get = null;
if (resourceServiceProvider != null) {
_get = resourceServiceProvider.<ContentAssistService>get(ContentAssistService.class);
}
final ContentAssistService contentAssistService = _get;
if ((contentAssistService == null)) {
CompletionList _completionList = new CompletionList();
return Either.<List<CompletionItem>, CompletionList>forRight(_completionList);
}
final Function2<Document, XtextResource, CompletionList> _function = (Document document, XtextResource resource) -> {
return contentAssistService.createCompletionList(document, resource, params, cancelIndicator);
};
final CompletionList completionList = this.workspaceManager.<CompletionList>doRead(uri, _function);
return Either.<List<CompletionItem>, CompletionList>forRight(completionList);
}
use of org.eclipse.xtext.ide.server.contentassist.ContentAssistService in project xtext-core by eclipse.
the class LanguageServerImpl method completion.
/**
* Compute the completion items.
*/
protected Either<List<CompletionItem>, CompletionList> completion(CancelIndicator originalCancelIndicator, CompletionParams params) {
URI uri = getURI(params);
ContentAssistService contentAssistService = getService(uri, ContentAssistService.class);
if (contentAssistService == null) {
return Either.forRight(new CompletionList());
}
BufferedCancelIndicator cancelIndicator = new BufferedCancelIndicator(originalCancelIndicator);
return Either.forRight(workspaceManager.doRead(uri, (doc, res) -> contentAssistService.createCompletionList(doc, res, params, cancelIndicator)));
}
Aggregations