use of org.eclipse.xtext.ide.server.formatting.FormattingService in project xtext-core by eclipse.
the class LanguageServerImpl method rangeFormatting.
/**
* Create the text edits for the formatter. Executed in a read request.
* @since 2.20
*/
protected List<? extends TextEdit> rangeFormatting(DocumentRangeFormattingParams params, CancelIndicator cancelIndicator) {
URI uri = getURI(params.getTextDocument());
FormattingService formatterService = getService(uri, FormattingService.class);
if (formatterService == null) {
return Collections.emptyList();
}
return workspaceManager.doRead(uri, (document, resource) -> formatterService.format(document, resource, params, cancelIndicator));
}
use of org.eclipse.xtext.ide.server.formatting.FormattingService in project xtext-core by eclipse.
the class LanguageServerImpl method formatting.
/**
* Create the text edits for the formatter. Executed in a read request.
* @since 2.20
*/
protected List<? extends TextEdit> formatting(DocumentFormattingParams params, CancelIndicator cancelIndicator) {
URI uri = getURI(params.getTextDocument());
FormattingService formatterService = getService(uri, FormattingService.class);
if (formatterService == null) {
return Collections.emptyList();
}
return workspaceManager.doRead(uri, (document, resource) -> formatterService.format(document, resource, params, cancelIndicator));
}
Aggregations