mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Update error case check
`getTouchingWord` indicates failure by returning the sourceFile node, rather than `undefined`.
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
namespace ts.DocumentHighlights {
|
||||
export function getDocumentHighlights(program: Program, cancellationToken: CancellationToken, sourceFile: SourceFile, position: number, sourceFilesToSearch: SourceFile[]): DocumentHighlights[] | undefined {
|
||||
const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
if (!node) return undefined;
|
||||
// Note that getTouchingWord indicates failure by returning the sourceFile node.
|
||||
if (node === sourceFile) return undefined;
|
||||
|
||||
Debug.assert(node.parent !== undefined);
|
||||
|
||||
if (isJsxOpeningElement(node.parent) && node.parent.tagName === node || isJsxClosingElement(node.parent)) {
|
||||
// For a JSX element, just highlight the matching tag, not all references.
|
||||
|
||||
Reference in New Issue
Block a user