MCPcopy Create free account
hub / github.com/nodejs/node / getDocumentHighlights

Function getDocumentHighlights

test/fixtures/snapshot/typescript.js:135535–135547  ·  view source on GitHub ↗
(program, cancellationToken, sourceFile, position, sourceFilesToSearch)

Source from the content-addressed store, hash-verified

135533 var DocumentHighlights;
135534 (function (DocumentHighlights) {
135535 function getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) {
135536 var node = ts.getTouchingPropertyName(sourceFile, position);
135537 if (node.parent && (ts.isJsxOpeningElement(node.parent) && node.parent.tagName === node || ts.isJsxClosingElement(node.parent))) {
135538 // For a JSX element, just highlight the matching tag, not all references.
135539 var _a = node.parent.parent, openingElement = _a.openingElement, closingElement = _a.closingElement;
135540 var highlightSpans = [openingElement, closingElement].map(function (_a) {
135541 var tagName = _a.tagName;
135542 return getHighlightSpanForNode(tagName, sourceFile);
135543 });
135544 return [{ fileName: sourceFile.fileName, highlightSpans: highlightSpans }];
135545 }
135546 return getSemanticDocumentHighlights(position, node, program, cancellationToken, sourceFilesToSearch) || getSyntacticDocumentHighlights(node, sourceFile);
135547 }
135548 DocumentHighlights.getDocumentHighlights = getDocumentHighlights;
135549 function getHighlightSpanForNode(node, sourceFile) {
135550 return {

Callers 1

getOccurrencesAtPositionFunction · 0.85

Calls 8

getHighlightSpanForNodeFunction · 0.85
synchronizeHostDataFunction · 0.85
getValidSourceFileFunction · 0.85
assertMethod · 0.80
someMethod · 0.80
mapMethod · 0.65

Tested by

no test coverage detected