public void setQuickfixes(TextDocumentIdentifier docId, List<Quickfix> quickfixes) { TrackedDocument td = documents.get(docId.getUri()); if (td!=null) { td.setQuickfixes(quickfixes); } }
public void assertLinkTargets(String hoverOver, Set<Location> expectedLocations) throws Exception { int pos = getRawText().indexOf(hoverOver); if (pos>=0) { pos += hoverOver.length() / 2; } assertTrue("Not found in editor: '"+hoverOver+"'", pos>=0); TextDocumentPositionParams params = new TextDocumentPositionParams(new TextDocumentIdentifier(getUri()), doc.toPosition(pos)); List<? extends Location> definitions = harness.getDefinitions(params); assertEquals(ImmutableSet.copyOf(expectedLocations), ImmutableSet.copyOf(definitions)); }
TextDocumentIdentifier clone(TextDocumentIdentifier textDocumentIdentifier) { if (textDocumentIdentifier == null) { return null; } String uri = textDocumentIdentifier.getUri(); TextDocumentIdentifier cloned = new TextDocumentIdentifier(); cloned.setUri(uri); return cloned; }
public TextDocumentIdentifier getId() { TextDocumentIdentifier id = new TextDocumentIdentifier(); id.setUri(getUri()); return id; }
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()); } }
@Override public CompletableFuture<List<? extends Location>> start(ExtendedLanguageServer element) { TextDocumentPositionParams clonedTextDocumentPositionParams = lsParamsCloner.clone(textDocumentPositionParams); if (wsPath.startsWith(ROOT)) { URI uri = languageServerPathTransformer.toFsURI(element.getId(), wsPath); clonedTextDocumentPositionParams.getTextDocument().setUri(uri.toString()); } else { clonedTextDocumentPositionParams.getTextDocument().setUri(wsPath); } return element.getTextDocumentService().definition(clonedTextDocumentPositionParams); }
@Override @Pure public int hashCode() { return 31 * 1 + ((this.textDocument== null) ? 0 : this.textDocument.hashCode()); } }
@Override @Pure public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DidCloseTextDocumentParams other = (DidCloseTextDocumentParams) obj; if (this.textDocument == null) { if (other.textDocument != null) return false; } else if (!this.textDocument.equals(other.textDocument)) return false; return true; }
private void didSave(DidSaveTextDocumentParams didSaveTextDocumentParams) { String wsPath = didSaveTextDocumentParams.getTextDocument().getUri(); findServer .byPath(wsPath) .forEach( server -> { URI uri = languageServerPathTransformer.toFsURI(server.getId(), wsPath); DidSaveTextDocumentParams clonedDidSaveTextDocumentParams = lsParamsCloner.clone(didSaveTextDocumentParams); clonedDidSaveTextDocumentParams.getTextDocument().setUri(uri.toString()); server.getTextDocumentService().didSave(clonedDidSaveTextDocumentParams); }); }
CompletionParams _completionParams = new CompletionParams(); final Procedure1<CompletionParams> _function_1 = (CompletionParams it_1) -> { TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(); final Procedure1<TextDocumentIdentifier> _function_2 = (TextDocumentIdentifier it_2) -> { it_2.setUri("file:///tmp/foo"); }; TextDocumentIdentifier _doubleArrow = ObjectExtensions.<TextDocumentIdentifier>operator_doubleArrow(_textDocumentIdentifier, _function_2);
@Override public CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> start( ExtendedLanguageServer element) { DocumentSymbolParams clonedDocumentSymbolParams = lsParamsCloner.clone(documentSymbolParams); URI uri = languageServerPathTransformer.toFsURI(element.getId(), wsPath); clonedDocumentSymbolParams.getTextDocument().setUri(uri.toString()); return element.getTextDocumentService().documentSymbol(clonedDocumentSymbolParams); }
@Override @Pure public int hashCode() { return 31 * 1 + ((this.textDocument== null) ? 0 : this.textDocument.hashCode()); } }
@Override @Pure public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DocumentLinkParams other = (DocumentLinkParams) obj; if (this.textDocument == null) { if (other.textDocument != null) return false; } else if (!this.textDocument.equals(other.textDocument)) return false; return true; }
@Test public void testDocumentSymbols_absolutePath() throws InterruptedException, ExecutionException { CompletableFuture<List<? extends SymbolInformation>> response = service.documentSymbol( new DocumentSymbolParams( new TextDocumentIdentifier(filePath.toAbsolutePath().toString()))); assertThat(response.get().stream().collect(Collectors.toSet()), is(symbolsMap.get(filePath.toUri()))); }
private void didClose(DidCloseTextDocumentParams didCloseTextDocumentParams) { String wsPath = didCloseTextDocumentParams.getTextDocument().getUri(); findServer .byPath(wsPath) .forEach( server -> { URI uri = languageServerPathTransformer.toFsURI(server.getId(), wsPath); DidCloseTextDocumentParams clonedDidCloseTextDocumentParams = lsParamsCloner.clone(didCloseTextDocumentParams); clonedDidCloseTextDocumentParams.getTextDocument().setUri(uri.toString()); server.getTextDocumentService().didClose(clonedDidCloseTextDocumentParams); }); }
@Override public CompletableFuture<SignatureHelp> start(ExtendedLanguageServer element) { TextDocumentPositionParams clonedPositionParams = lsParamsCloner.clone(positionParams); URI uri = languageServerPathTransformer.toFsURI(element.getId(), wsPath); clonedPositionParams.getTextDocument().setUri(uri.toString()); return element.getTextDocumentService().signatureHelp(clonedPositionParams); }
@Override @Pure public int hashCode() { return 31 * 1 + ((this.textDocument== null) ? 0 : this.textDocument.hashCode()); } }
@Override @Pure public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DocumentColorParams other = (DocumentColorParams) obj; if (this.textDocument == null) { if (other.textDocument != null) return false; } else if (!this.textDocument.equals(other.textDocument)) return false; return true; }
public List<Either<SymbolInformation, DocumentSymbol>> documentSymbol(DocumentSymbolParams params, IProgressMonitor monitor) { ITypeRoot unit = JDTUtils.resolveTypeRoot(params.getTextDocument().getUri()); if (unit == null) { return Collections.emptyList(); } if (hierarchicalDocumentSymbolSupported) { List<DocumentSymbol> symbols = this.getHierarchicalOutline(unit, monitor); return symbols.stream().map(Either::<SymbolInformation, DocumentSymbol>forRight).collect(toList()); } else { SymbolInformation[] elements = this.getOutline(unit, monitor); return Arrays.asList(elements).stream().map(Either::<SymbolInformation, DocumentSymbol>forLeft).collect(toList()); } }