diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index f8606e2bf1c..453fd31ac98 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -41,13 +41,15 @@ namespace ts.FindAllReferences { // TODO(shkamat):: // JSXOpeningElement or JSXElement for tagName ? - if (!node.parent || !isDeclaration(node.parent)) { + if (!node.parent || (!isDeclaration(node.parent) && !isExportAssignment(node.parent))) { return undefined; } if (node.parent.name === node || // node is name of declaration, use parent // Property name of the import export specifier use import/export specifier - isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node) { + isImportOrExportSpecifier(node.parent) && node.parent.propertyName === node || + // Is assignment of export assignment + isExportAssignment(node.parent) && node.parent.expression === node) { return getDeclarationForDeclarationSpan(node.parent); } diff --git a/tests/cases/fourslash/renameReExportDefault.ts b/tests/cases/fourslash/renameReExportDefault.ts index 0eb5b81d209..0e00a269b37 100644 --- a/tests/cases/fourslash/renameReExportDefault.ts +++ b/tests/cases/fourslash/renameReExportDefault.ts @@ -2,17 +2,17 @@ // @Filename: /a.ts ////export { default } from "./b"; -////export { default as [|b|] } from "./b"; +////[|export { default as [|{| "declarationRangeIndex": 0 |}b|] } from "./b";|] ////export { default as bee } from "./b"; -////import { default as [|b|] } from "./b"; +////[|import { default as [|{| "declarationRangeIndex": 2 |}b|] } from "./b";|] ////import { default as bee } from "./b"; -////import [|b|] from "./b"; +////[|import [|{| "declarationRangeIndex": 4 |}b|] from "./b";|] // @Filename: /b.ts -////const [|b|] = 0; -////export default [|b|]; +////[|const [|{| "declarationRangeIndex": 6 |}b|] = 0;|] +////[|export default [|{| "declarationRangeIndex": 8 |}b|];|] -const [r0, r1, r2, r3, r4] = test.ranges(); +const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4Def, r4] = test.ranges(); verify.renameLocations(r0, [r0]); verify.renameLocations(r1, [r1]); verify.renameLocations(r2, [r2]); diff --git a/tests/cases/fourslash/transitiveExportImports.ts b/tests/cases/fourslash/transitiveExportImports.ts index fb5480b28c8..f492f28862a 100644 --- a/tests/cases/fourslash/transitiveExportImports.ts +++ b/tests/cases/fourslash/transitiveExportImports.ts @@ -3,20 +3,20 @@ // @Filename: a.ts ////[|class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}A|] { ////}|] -////export = [|A|]; +////[|export = [|{| "declarationRangeIndex": 2 |}A|];|] // @Filename: b.ts -////[|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}b|] = require('./a');|] +////[|export import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}b|] = require('./a');|] // @Filename: c.ts -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}b|] = require('./b');|] +////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}b|] = require('./b');|] ////var a = new [|b|]./**/[|b|](); goTo.marker(); verify.quickInfoExists(); verify.noErrors(); -const [a0Def, a0, a1, b0Def, b0, c0Def, c0, c1, c2] = test.ranges(); +const [a0Def, a0, a1Def, a1, b0Def, b0, c0Def, c0, c1, c2] = test.ranges(); const aRanges = [a0, a1]; const bRanges = [b0, c2]; const cRanges = [c0, c1];