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; }
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(); }
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 DocumentOnTypeFormattingParamsDto(org.eclipse.lsp4j.DocumentOnTypeFormattingParams o) { if (o.getPosition() == null) { setPosition((org.eclipse.lsp4j.Position)null); } else { org.eclipse.lsp4j.Position positionVal = new PositionDto(o.getPosition()); setPosition((org.eclipse.lsp4j.Position)positionVal); if (o.getCh() == null) { setCh((java.lang.String)null); } else { java.lang.String chVal = (java.lang.String)makeDto(o.getCh());; setCh((java.lang.String)chVal); if (o.getOptions() == null) { setOptions((org.eclipse.lsp4j.FormattingOptions)null); } else { org.eclipse.lsp4j.FormattingOptions optionsVal= new org.eclipse.lsp4j.FormattingOptions(); for (Entry<String, org.eclipse.lsp4j.jsonrpc.messages.Either3<java.lang.String, java.lang.Number, java.lang.Boolean>> optionsValX : o.getOptions().entrySet()) { org.eclipse.lsp4j.jsonrpc.messages.Either3<java.lang.String, java.lang.Number, java.lang.Boolean> optionsValY; if (optionsValX.getValue().isFirst()) { 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);
@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(); }