private List<TextEditDto> onTypeFormatting( DocumentOnTypeFormattingParams documentOnTypeFormattingParams) { try { String wsPath = documentOnTypeFormattingParams.getTextDocument().getUri(); Optional<ExtendedLanguageServer> serverOptional = findServer .byPath(wsPath) .stream() .filter(it -> it.getCapabilities().getDocumentOnTypeFormattingProvider() != null) .findFirst(); if (serverOptional.isPresent()) { String lsId = serverOptional.get().getId(); URI uri = languageServerPathTransformer.toFsURI(lsId, wsPath); documentOnTypeFormattingParams.getTextDocument().setUri(uri.toString()); return serverOptional .get() .getTextDocumentService() .onTypeFormatting(documentOnTypeFormattingParams) .get() .stream() .map(TextEditDto::new) .collect(Collectors.toList()); } else { return emptyList(); } } catch (InterruptedException | ExecutionException e) { throw new JsonRpcException(-27000, e.getMessage()); } }
public List<? extends org.eclipse.lsp4j.TextEdit> onTypeFormatting(DocumentOnTypeFormattingParams params, IProgressMonitor monitor) { return format(params.getTextDocument().getUri(), params.getOptions(), params.getPosition(), params.getCh(), monitor); }
@Override @Pure public String toString() { ToStringBuilder b = new ToStringBuilder(this); b.add("position", this.position); b.add("ch", this.ch); b.add("textDocument", getTextDocument()); b.add("options", getOptions()); return b.toString(); }
@Override @Pure public String toString() { ToStringBuilder b = new ToStringBuilder(this); b.add("position", this.position); b.add("ch", this.ch); b.add("textDocument", getTextDocument()); b.add("options", getOptions()); return b.toString(); }
if (o.getTextDocument() == null) { setTextDocument((org.eclipse.lsp4j.TextDocumentIdentifier)null); } else { org.eclipse.lsp4j.TextDocumentIdentifier textDocumentVal = new TextDocumentIdentifierDto(o.getTextDocument()); setTextDocument((org.eclipse.lsp4j.TextDocumentIdentifier)textDocumentVal);
DocumentOnTypeFormattingParams clone( DocumentOnTypeFormattingParams documentOnTypeFormattingParams) { if (documentOnTypeFormattingParams == null) { return null; } String ch = documentOnTypeFormattingParams.getCh(); Position position = documentOnTypeFormattingParams.getPosition(); FormattingOptions options = documentOnTypeFormattingParams.getOptions(); TextDocumentIdentifier textDocument = documentOnTypeFormattingParams.getTextDocument(); DocumentOnTypeFormattingParams cloned = new DocumentOnTypeFormattingParams(); cloned.setCh(ch); cloned.setPosition(clone(position)); cloned.setOptions(clone(options)); cloned.setTextDocument(clone(textDocument)); return cloned; }