mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-13 06:20:23 -06:00
Merge pull request #6952 from tinganho/goToNamedImport
Go to defininition should not go to named import
This commit is contained in:
commit
4bf104349d
@ -4639,7 +4639,16 @@ namespace ts {
|
||||
// to jump to the implementation directly.
|
||||
if (symbol.flags & SymbolFlags.Alias) {
|
||||
const declaration = symbol.declarations[0];
|
||||
if (node.kind === SyntaxKind.Identifier && node.parent === declaration) {
|
||||
|
||||
// Go to the original declaration for cases:
|
||||
//
|
||||
// (1) when the aliased symbol was declared in the location(parent).
|
||||
// (2) when the aliased symbol is originating from a named import.
|
||||
//
|
||||
if (node.kind === SyntaxKind.Identifier &&
|
||||
(node.parent === declaration ||
|
||||
(declaration.kind === SyntaxKind.ImportSpecifier && declaration.parent && declaration.parent.kind === SyntaxKind.NamedImports))) {
|
||||
|
||||
symbol = typeChecker.getAliasedSymbol(symbol);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ goTo.file("e.ts");
|
||||
|
||||
goTo.marker('classReference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classAliasDefinition');
|
||||
verify.caretAtMarker('classDefinition');
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user