mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Fix wrong script info used to resolve line/offset for call hierarchy items (#36559)
This commit is contained in:
@@ -260,16 +260,18 @@ namespace ts.CallHierarchy {
|
||||
range: TextRange;
|
||||
}
|
||||
|
||||
function convertEntryToCallSite(entry: FindAllReferences.Entry, _originalNode: Node, typeChecker: TypeChecker): CallSite | undefined {
|
||||
function convertEntryToCallSite(entry: FindAllReferences.Entry): CallSite | undefined {
|
||||
if (entry.kind === FindAllReferences.EntryKind.Node) {
|
||||
if (isCallOrNewExpressionTarget(entry.node, /*includeElementAccess*/ true, /*skipPastOuterExpressions*/ true)
|
||||
|| isTaggedTemplateTag(entry.node, /*includeElementAccess*/ true, /*skipPastOuterExpressions*/ true)
|
||||
|| isDecoratorTarget(entry.node, /*includeElementAccess*/ true, /*skipPastOuterExpressions*/ true)
|
||||
|| isJsxOpeningLikeElementTagName(entry.node, /*includeElementAccess*/ true, /*skipPastOuterExpressions*/ true)
|
||||
|| isRightSideOfPropertyAccess(entry.node)
|
||||
|| isArgumentExpressionOfElementAccess(entry.node)) {
|
||||
const ancestor = findAncestor(entry.node, isValidCallHierarchyDeclaration) || entry.node.getSourceFile();
|
||||
return { declaration: firstOrOnly(findImplementationOrAllInitialDeclarations(typeChecker, ancestor)), range: createTextRangeFromNode(entry.node, entry.node.getSourceFile()) };
|
||||
const { node } = entry;
|
||||
if (isCallOrNewExpressionTarget(node, /*includeElementAccess*/ true, /*skipPastOuterExpressions*/ true)
|
||||
|| isTaggedTemplateTag(node, /*includeElementAccess*/ true, /*skipPastOuterExpressions*/ true)
|
||||
|| isDecoratorTarget(node, /*includeElementAccess*/ true, /*skipPastOuterExpressions*/ true)
|
||||
|| isJsxOpeningLikeElementTagName(node, /*includeElementAccess*/ true, /*skipPastOuterExpressions*/ true)
|
||||
|| isRightSideOfPropertyAccess(node)
|
||||
|| isArgumentExpressionOfElementAccess(node)) {
|
||||
const sourceFile = node.getSourceFile();
|
||||
const ancestor = findAncestor(node, isValidCallHierarchyDeclaration) || sourceFile;
|
||||
return { declaration: ancestor, range: createTextRangeFromNode(node, sourceFile) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user