org.eclipse.lsp4j.DocumentHighlight Java Examples
The following examples show how to use
org.eclipse.lsp4j.DocumentHighlight.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLHighlighting.java From lemminx with Eclipse Public License 2.0 | 6 votes |
public List<DocumentHighlight> findDocumentHighlights(DOMDocument xmlDocument, Position position, CancelChecker cancelChecker) { int offset = -1; try { offset = xmlDocument.offsetAt(position); } catch (BadLocationException e) { LOGGER.log(Level.SEVERE, "In XMLHighlighting the client provided Position is at a BadLocation", e); return Collections.emptyList(); } DOMNode node = xmlDocument.findNodeAt(offset); if (node == null) { return Collections.emptyList(); } List<DocumentHighlight> highlights = new ArrayList<>(); fillWithDefaultHighlights(node, position, offset, highlights, cancelChecker); fillWithCustomHighlights(node, position, offset, highlights, cancelChecker); return highlights; }
Example #2
Source File: DocumentHighlightComparatorTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Test public void withNull() { List<? extends DocumentHighlight> input = sort( Lists.newArrayList(null, newHighlight(DocumentHighlightKind.Text, newRange(1, 1, 1, 1)), newHighlight(DocumentHighlightKind.Write, newRange(1, 1, 1, 1)), newHighlight(DocumentHighlightKind.Read, newRange(1, 1, 1, 1)))); assertEquals(1, input.get(0).getRange().getStart().getLine()); assertEquals(1, input.get(0).getRange().getStart().getCharacter()); assertEquals(1, input.get(0).getRange().getEnd().getLine()); assertEquals(1, input.get(0).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Text, input.get(0).getKind()); assertEquals(1, input.get(1).getRange().getStart().getLine()); assertEquals(1, input.get(1).getRange().getStart().getCharacter()); assertEquals(1, input.get(1).getRange().getEnd().getLine()); assertEquals(1, input.get(1).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Read, input.get(1).getKind()); assertEquals(1, input.get(2).getRange().getStart().getLine()); assertEquals(1, input.get(2).getRange().getStart().getCharacter()); assertEquals(1, input.get(2).getRange().getEnd().getLine()); assertEquals(1, input.get(2).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Write, input.get(2).getKind()); assertNull(IterableExtensions.last(input)); }
Example #3
Source File: DocumentHighlightHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private DocumentHighlight convertToHighlight(ITypeRoot unit, OccurrenceLocation occurrence) throws JavaModelException { DocumentHighlight h = new DocumentHighlight(); if ((occurrence.getFlags() | IOccurrencesFinder.F_WRITE_OCCURRENCE) == IOccurrencesFinder.F_WRITE_OCCURRENCE) { h.setKind(DocumentHighlightKind.Write); } else if ((occurrence.getFlags() | IOccurrencesFinder.F_READ_OCCURRENCE) == IOccurrencesFinder.F_READ_OCCURRENCE) { h.setKind(DocumentHighlightKind.Read); } int[] loc = JsonRpcHelpers.toLine(unit.getBuffer(), occurrence.getOffset()); int[] endLoc = JsonRpcHelpers.toLine(unit.getBuffer(), occurrence.getOffset() + occurrence.getLength()); h.setRange(new Range( new Position(loc[0], loc[1]), new Position(endLoc[0],endLoc[1]) )); return h; }
Example #4
Source File: XMLAssert.java From lemminx with Eclipse Public License 2.0 | 6 votes |
public static void assertHighlights(String value, int[] expectedMatches, String elementName) throws BadLocationException { int offset = value.indexOf("|"); value = value.substring(0, offset) + value.substring(offset + 1); DOMDocument document = DOMParser.getInstance().parse(value, "test://test/test.html", null); Position position = document.positionAt(offset); XMLLanguageService languageService = new XMLLanguageService(); List<DocumentHighlight> highlights = languageService.findDocumentHighlights(document, position); assertEquals(expectedMatches.length, highlights.size()); for (int i = 0; i < highlights.size(); i++) { DocumentHighlight highlight = highlights.get(i); int actualStartOffset = document.offsetAt(highlight.getRange().getStart()); assertEquals(expectedMatches[i], actualStartOffset); int actualEndOffset = document.offsetAt(highlight.getRange().getEnd()); assertEquals(expectedMatches[i] + (elementName != null ? elementName.length() : 0), actualEndOffset); assertEquals(elementName, document.getText().substring(actualStartOffset, actualEndOffset).toLowerCase()); } }
Example #5
Source File: XMLAssert.java From lemminx with Eclipse Public License 2.0 | 6 votes |
public static void testHighlightsFor(String value, String fileURI, DocumentHighlight... expected) throws BadLocationException { int offset = value.indexOf('|'); value = value.substring(0, offset) + value.substring(offset + 1); TextDocument document = new TextDocument(value, fileURI != null ? fileURI : "test://test/test.xml"); Position position = document.positionAt(offset); XMLLanguageService xmlLanguageService = new XMLLanguageService(); ContentModelSettings settings = new ContentModelSettings(); settings.setUseCache(false); xmlLanguageService.doSave(new SettingsSaveContext(settings)); DOMDocument xmlDocument = DOMParser.getInstance().parse(document, xmlLanguageService.getResolverExtensionManager()); xmlLanguageService.setDocumentProvider((uri) -> xmlDocument); List<? extends DocumentHighlight> actual = xmlLanguageService.findDocumentHighlights(xmlDocument, position, () -> { }); assertDocumentHighlight(actual, expected); }
Example #6
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(TextDocumentPositionParams params) { URI uri = getURI(params); return openFilesManager.runInOpenFileContext(uri, "documentHighlight", (ofc, ci) -> { return documentHighlight(ofc, params, ci); }); }
Example #7
Source File: DocumentHighlightHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Test public void testDocumentHighlightHandler() throws Exception { String uri = ClassFileUtil.getURI(project, "org.sample.Highlight"); TextDocumentIdentifier identifier = new TextDocumentIdentifier(uri); TextDocumentPositionParams params = new TextDocumentPositionParams(identifier, new Position(5, 10)); List<? extends DocumentHighlight> highlights = handler.documentHighlight(params, monitor); assertEquals(4, highlights.size()); assertHighlight(highlights.get(0), 5, 9, 15, DocumentHighlightKind.Write); assertHighlight(highlights.get(1), 6, 2, 8, DocumentHighlightKind.Read); assertHighlight(highlights.get(2), 7, 2, 8, DocumentHighlightKind.Write); assertHighlight(highlights.get(3), 8, 2, 8, DocumentHighlightKind.Read); }
Example #8
Source File: DocumentHighlightComparatorTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void withoutNull() { List<? extends DocumentHighlight> input = sort( Lists.newArrayList(newHighlight(DocumentHighlightKind.Text, newRange(2, 2, 2, 2)), newHighlight(DocumentHighlightKind.Text, newRange(1, 1, 1, 1)), newHighlight(DocumentHighlightKind.Write, newRange(2, 2, 2, 2)), newHighlight(DocumentHighlightKind.Write, newRange(1, 1, 1, 1)), newHighlight(DocumentHighlightKind.Read, newRange(2, 2, 2, 2)), newHighlight(DocumentHighlightKind.Read, newRange(1, 1, 1, 1)))); assertEquals(1, input.get(0).getRange().getStart().getLine()); assertEquals(1, input.get(0).getRange().getStart().getCharacter()); assertEquals(1, input.get(0).getRange().getEnd().getLine()); assertEquals(1, input.get(0).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Text, input.get(0).getKind()); assertEquals(1, input.get(1).getRange().getStart().getLine()); assertEquals(1, input.get(1).getRange().getStart().getCharacter()); assertEquals(1, input.get(1).getRange().getEnd().getLine()); assertEquals(1, input.get(1).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Read, input.get(1).getKind()); assertEquals(1, input.get(2).getRange().getStart().getLine()); assertEquals(1, input.get(2).getRange().getStart().getCharacter()); assertEquals(1, input.get(2).getRange().getEnd().getLine()); assertEquals(1, input.get(2).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Write, input.get(2).getKind()); assertEquals(2, input.get(3).getRange().getStart().getLine()); assertEquals(2, input.get(3).getRange().getStart().getCharacter()); assertEquals(2, input.get(3).getRange().getEnd().getLine()); assertEquals(2, input.get(3).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Text, input.get(3).getKind()); assertEquals(2, input.get(4).getRange().getStart().getLine()); assertEquals(2, input.get(4).getRange().getStart().getCharacter()); assertEquals(2, input.get(4).getRange().getEnd().getLine()); assertEquals(2, input.get(4).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Read, input.get(4).getKind()); assertEquals(2, input.get(5).getRange().getStart().getLine()); assertEquals(2, input.get(5).getRange().getStart().getCharacter()); assertEquals(2, input.get(5).getRange().getEnd().getLine()); assertEquals(2, input.get(5).getRange().getEnd().getCharacter()); assertEquals(DocumentHighlightKind.Write, input.get(5).getKind()); }
Example #9
Source File: XMLHighlighting.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private static void fillHighlightsList(Range startTagRange, Range endTagRange, List<DocumentHighlight> result) { if (startTagRange != null) { result.add(new DocumentHighlight(startTagRange, DocumentHighlightKind.Read)); } if (endTagRange != null) { result.add(new DocumentHighlight(endTagRange, DocumentHighlightKind.Read)); } }
Example #10
Source File: DocumentHighlightHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private List<DocumentHighlight> computeOccurrences(ITypeRoot unit, int line, int column, IProgressMonitor monitor) { if (unit != null) { try { int offset = JsonRpcHelpers.toOffset(unit.getBuffer(), line, column); OccurrencesFinder finder = new OccurrencesFinder(); CompilationUnit ast = CoreASTProvider.getInstance().getAST(unit, CoreASTProvider.WAIT_YES, monitor); if (ast != null) { String error = finder.initialize(ast, offset, 0); if (error == null){ List<DocumentHighlight> result = new ArrayList<>(); OccurrenceLocation[] occurrences = finder.getOccurrences(); if (occurrences != null) { for (OccurrenceLocation loc : occurrences) { if (monitor.isCanceled()) { return Collections.emptyList(); } result.add(convertToHighlight(unit, loc)); } } return result; } } } catch (JavaModelException e) { JavaLanguageServerPlugin.logException("Problem with compute occurrences for" + unit.getElementName(), e); } } return Collections.emptyList(); }
Example #11
Source File: MarkOccurrences.java From netbeans with Apache License 2.0 | 5 votes |
private OffsetsBag computeHighlights(Document doc, int caretPos) { AttributeSet attr = getColoring(doc); OffsetsBag result = new OffsetsBag(doc); FileObject file = NbEditorUtilities.getFileObject(doc); if (file == null) { return result; } LSPBindings server = LSPBindings.getBindings(file); if (server == null) { return result; } Boolean hasDocumentHighlight = server.getInitResult().getCapabilities().getDocumentHighlightProvider(); if (hasDocumentHighlight == null || !hasDocumentHighlight) { return result; } String uri = Utils.toURI(file); try { List<? extends DocumentHighlight> highlights = server.getTextDocumentService().documentHighlight(new TextDocumentPositionParams(new TextDocumentIdentifier(uri), Utils.createPosition(doc, caretPos))).get(); for (DocumentHighlight h : highlights) { result.addHighlight(Utils.getOffset(doc, h.getRange().getStart()), Utils.getOffset(doc, h.getRange().getEnd()), attr); } return result; } catch (BadLocationException | InterruptedException | ExecutionException ex) { Exceptions.printStackTrace(ex); return result; } }
Example #12
Source File: ServerTest.java From netbeans with Apache License 2.0 | 5 votes |
private void assertHighlights(List<? extends DocumentHighlight> highlights, String... expected) { Set<String> stringHighlights = new HashSet<>(); for (DocumentHighlight h : highlights) { DocumentHighlightKind kind = h.getKind(); stringHighlights.add((kind != null ? kind.name() : "<none>") + ":" + h.getRange().getStart().getLine() + ":" + h.getRange().getStart().getCharacter() + "-" + h.getRange().getEnd().getLine() + ":" + h.getRange().getEnd().getCharacter()); } assertEquals(new HashSet<>(Arrays.asList(expected)), stringHighlights); }
Example #13
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Compute the document highlights. Executed in a read request. */ protected List<? extends DocumentHighlight> documentHighlight(OpenFileContext ofc, TextDocumentPositionParams params, CancelIndicator cancelIndicator) { URI uri = ofc.getURI(); IDocumentHighlightService service = getService(uri, IDocumentHighlightService.class); if (service == null) { return Collections.emptyList(); } XtextResource res = ofc.getResource(); XDocument doc = ofc.getDocument(); return service.getDocumentHighlights(doc, res, params, cancelIndicator); }
Example #14
Source File: XMLHighlighting.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private void fillWithCustomHighlights(DOMNode node, Position position, int offset, List<DocumentHighlight> highlights, CancelChecker cancelChecker) { // Consume highlighting participant for (IHighlightingParticipant highlightingParticipant : extensionsRegistry.getHighlightingParticipants()) { highlightingParticipant.findDocumentHighlights(node, position, offset,highlights, cancelChecker); } }
Example #15
Source File: AbstractLanguageServerTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
protected String _toExpectation(final DocumentHighlight it) { String _xblockexpression = null; { StringConcatenation _builder = new StringConcatenation(); { Range _range = it.getRange(); boolean _tripleEquals = (_range == null); if (_tripleEquals) { _builder.append("[NaN, NaN]:[NaN, NaN]"); } else { String _expectation = this.toExpectation(it.getRange()); _builder.append(_expectation); } } final String rangeString = _builder.toString(); StringConcatenation _builder_1 = new StringConcatenation(); { DocumentHighlightKind _kind = it.getKind(); boolean _tripleEquals_1 = (_kind == null); if (_tripleEquals_1) { _builder_1.append("NaN"); } else { String _expectation_1 = this.toExpectation(it.getKind()); _builder_1.append(_expectation_1); } } _builder_1.append(" "); _builder_1.append(rangeString); _xblockexpression = _builder_1.toString(); } return _xblockexpression; }
Example #16
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Compute the document highlights. Executed in a read request. * @since 2.20 */ protected List<? extends DocumentHighlight> documentHighlight(DocumentHighlightParams params, CancelIndicator cancelIndicator) { URI uri = getURI(params); IDocumentHighlightService service = getService(uri, IDocumentHighlightService.class); if (service == null) { return Collections.emptyList(); } return workspaceManager.doRead(uri, (doc, resource) -> service.getDocumentHighlights(doc, resource, params, cancelIndicator)); }
Example #17
Source File: ITextRegionTransformer.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public DocumentHighlight apply(final Document document, final ITextRegion region, final DocumentHighlightKind kind) { Preconditions.checkNotNull(document, "document"); Preconditions.checkNotNull(region, "region"); Preconditions.checkNotNull(kind, "kind"); final int offset = region.getOffset(); final Position start = document.getPosition(offset); final Position end = document.getPosition(offset + region.getLength()); return new DocumentHighlight(new Range(start, end), kind); }
Example #18
Source File: CompletionTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override protected String toExpectation(final Object it) { if (it instanceof Integer) { return _toExpectation((Integer)it); } else if (it instanceof List) { return _toExpectation((List<?>)it); } else if (it instanceof DocumentHighlightKind) { return _toExpectation((DocumentHighlightKind)it); } else if (it instanceof String) { return _toExpectation((String)it); } else if (it instanceof VersionedTextDocumentIdentifier) { return _toExpectation((VersionedTextDocumentIdentifier)it); } else if (it instanceof Pair) { return _toExpectation((Pair<SemanticHighlightingInformation, List<List<String>>>)it); } else if (it == null) { return _toExpectation((Void)null); } else if (it instanceof Map) { return _toExpectation((Map<Object, Object>)it); } else if (it instanceof CodeAction) { return _toExpectation((CodeAction)it); } else if (it instanceof CodeLens) { return _toExpectation((CodeLens)it); } else if (it instanceof Command) { return _toExpectation((Command)it); } else if (it instanceof CompletionItem) { return _toExpectation((CompletionItem)it); } else if (it instanceof DocumentHighlight) { return _toExpectation((DocumentHighlight)it); } else if (it instanceof DocumentSymbol) { return _toExpectation((DocumentSymbol)it); } else if (it instanceof Hover) { return _toExpectation((Hover)it); } else if (it instanceof Location) { return _toExpectation((Location)it); } else if (it instanceof MarkupContent) { return _toExpectation((MarkupContent)it); } else if (it instanceof Position) { return _toExpectation((Position)it); } else if (it instanceof Range) { return _toExpectation((Range)it); } else if (it instanceof ResourceOperation) { return _toExpectation((ResourceOperation)it); } else if (it instanceof SignatureHelp) { return _toExpectation((SignatureHelp)it); } else if (it instanceof SymbolInformation) { return _toExpectation((SymbolInformation)it); } else if (it instanceof TextDocumentEdit) { return _toExpectation((TextDocumentEdit)it); } else if (it instanceof TextEdit) { return _toExpectation((TextEdit)it); } else if (it instanceof WorkspaceEdit) { return _toExpectation((WorkspaceEdit)it); } else if (it instanceof Either) { return _toExpectation((Either<?, ?>)it); } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(it).toString()); } }
Example #19
Source File: XMLLanguageService.java From lemminx with Eclipse Public License 2.0 | 4 votes |
public List<DocumentHighlight> findDocumentHighlights(DOMDocument xmlDocument, Position position, CancelChecker cancelChecker) { return highlighting.findDocumentHighlights(xmlDocument, position, cancelChecker); }
Example #20
Source File: AbstractLanguageServerTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected String toExpectation(final Object it) { if (it instanceof Integer) { return _toExpectation((Integer)it); } else if (it instanceof List) { return _toExpectation((List<?>)it); } else if (it instanceof DocumentHighlightKind) { return _toExpectation((DocumentHighlightKind)it); } else if (it instanceof String) { return _toExpectation((String)it); } else if (it instanceof VersionedTextDocumentIdentifier) { return _toExpectation((VersionedTextDocumentIdentifier)it); } else if (it instanceof Pair) { return _toExpectation((Pair<SemanticHighlightingInformation, List<List<String>>>)it); } else if (it == null) { return _toExpectation((Void)null); } else if (it instanceof Map) { return _toExpectation((Map<Object, Object>)it); } else if (it instanceof CodeAction) { return _toExpectation((CodeAction)it); } else if (it instanceof CodeLens) { return _toExpectation((CodeLens)it); } else if (it instanceof Command) { return _toExpectation((Command)it); } else if (it instanceof CompletionItem) { return _toExpectation((CompletionItem)it); } else if (it instanceof DocumentHighlight) { return _toExpectation((DocumentHighlight)it); } else if (it instanceof DocumentSymbol) { return _toExpectation((DocumentSymbol)it); } else if (it instanceof Hover) { return _toExpectation((Hover)it); } else if (it instanceof Location) { return _toExpectation((Location)it); } else if (it instanceof MarkupContent) { return _toExpectation((MarkupContent)it); } else if (it instanceof Position) { return _toExpectation((Position)it); } else if (it instanceof Range) { return _toExpectation((Range)it); } else if (it instanceof ResourceOperation) { return _toExpectation((ResourceOperation)it); } else if (it instanceof SignatureHelp) { return _toExpectation((SignatureHelp)it); } else if (it instanceof SymbolInformation) { return _toExpectation((SymbolInformation)it); } else if (it instanceof TextDocumentEdit) { return _toExpectation((TextDocumentEdit)it); } else if (it instanceof TextEdit) { return _toExpectation((TextEdit)it); } else if (it instanceof WorkspaceEdit) { return _toExpectation((WorkspaceEdit)it); } else if (it instanceof Either) { return _toExpectation((Either<?, ?>)it); } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(it).toString()); } }
Example #21
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(DocumentHighlightParams params) { return requestManager.runRead((cancelIndicator) -> documentHighlight(params, cancelIndicator)); }
Example #22
Source File: DocumentHighlightComparatorTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
private List<? extends DocumentHighlight> sort(List<? extends DocumentHighlight> toSort) { toSort.sort(comparator); return toSort; }
Example #23
Source File: DefaultDocumentHighlightService.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public List<? extends DocumentHighlight> getDocumentHighlights(Document document, XtextResource resource, DocumentHighlightParams params, CancelIndicator cancelIndicator) { int offset = document.getOffSet(params.getPosition()); return getDocumentHighlights(resource, offset); }
Example #24
Source File: DocumentHighlightComparatorTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
private DocumentHighlight newHighlight(DocumentHighlightKind kind, Range range) { return new DocumentHighlight(range, kind); }
Example #25
Source File: XMLTextDocumentService.java From lemminx with Eclipse Public License 2.0 | 4 votes |
@Override public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(DocumentHighlightParams params) { return computeDOMAsync(params.getTextDocument(), (cancelChecker, xmlDocument) -> { return getXMLLanguageService().findDocumentHighlights(xmlDocument, params.getPosition(), cancelChecker); }); }
Example #26
Source File: DocumentHighlightComparator.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public int compare(final DocumentHighlight left, final DocumentHighlight right) { return Ordering.from(delegate).nullsLast().compare(left, right); }
Example #27
Source File: ActionScriptServices.java From vscode-as3mxml with Apache License 2.0 | 4 votes |
/** * This feature is not implemented at this time. */ @Override public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(DocumentHighlightParams params) { return CompletableFuture.completedFuture(Collections.emptyList()); }
Example #28
Source File: DocumentHighlightHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private void assertHighlight(DocumentHighlight highlight, int expectedLine, int expectedStart, int expectedEnd, DocumentHighlightKind expectedKind) { Lsp4jAssertions.assertRange(expectedLine, expectedStart, expectedEnd, highlight.getRange()); assertEquals(expectedKind, highlight.getKind()); }
Example #29
Source File: JDTLanguageServer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(DocumentHighlightParams position) { logInfo(">> document/documentHighlight"); DocumentHighlightHandler handler = new DocumentHighlightHandler(); return computeAsync((monitor) -> handler.documentHighlight(position, monitor)); }
Example #30
Source File: DocumentHighlightHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
public List<? extends DocumentHighlight> documentHighlight(TextDocumentPositionParams position, IProgressMonitor monitor) { ITypeRoot type = JDTUtils.resolveTypeRoot(position.getTextDocument().getUri()); return computeOccurrences(type, position.getPosition().getLine(), position.getPosition().getCharacter(), monitor); }