Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 src/services/findAllReferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ namespace ts.FindAllReferences {
return node.parent.parent;

case SyntaxKind.ImportClause:
case SyntaxKind.NamespaceExport:
return node.parent;

case SyntaxKind.BinaryExpression:
Expand Down
3 changes: 3 additions & 0 deletions 3 src/services/importTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@ namespace ts.FindAllReferences {
return exportInfo(symbol, getExportKindForDeclaration(exportNode));
}
}
else if (isNamespaceExport(parent)) {
return exportInfo(symbol, ExportKind.Named);
}
// If we are in `export = a;` or `export default a;`, `parent` is the export assignment.
else if (isExportAssignment(parent)) {
return getExportAssignmentExport(parent);
Expand Down
16 changes: 10 additions & 6 deletions 16 tests/cases/fourslash/findAllRefsReExportStarAs.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
/// <reference path="fourslash.ts" />

// @Filename: /leafModule.ts
////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}hello|] = () => 'Hello';|]
////[|{| "id": "helloDecl" |}export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "helloDecl" |}hello|] = () => 'Hello';|]

// @Filename: /exporting.ts
////export * as Leaf from './leafModule';
////[|{| "id": "leafExportDecl" |}export * as [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "leafExportDecl" |}Leaf|] from './leafModule';|]

// @Filename: /importing.ts
//// import { Leaf } from './exporting';
//// Leaf.[|hello|]()
//// [|{| "id": "leafImportDecl" |}import { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "leafImportDecl" |}Leaf|] } from './exporting';|]
//// [|Leaf|].[|hello|]()

verify.noErrors();
const ranges = test.ranges();
const [r0Def, r0, r1] = ranges;
verify.singleReferenceGroup("const hello: () => string", [r0, r1]);
const [helloDecl, helloDef, leafExportDecl, leafDef, leafImportDecl, leafImportDef, leafUse, helloUse] = ranges;
verify.singleReferenceGroup("const hello: () => string", [helloDef, helloUse]);
const leafExportAsRef = { definition: "import Leaf", ranges: [leafDef] };
const leafImportRef = { definition: "import Leaf", ranges: [leafImportDef, leafUse] };
verify.referenceGroups([leafDef], [leafExportAsRef, leafImportRef]);
verify.referenceGroups([leafImportDef, leafUse], [leafImportRef, leafExportAsRef]);
2 changes: 1 addition & 1 deletion 2 tests/cases/fourslash/referencesForStatementKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////
////// export ... from ...
////[|{| "id": "exportDecl1" |}[|export|] [|type|] * [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl1" |}./g|]";|]
////[|{| "id": "exportDecl2" |}[|export|] [|type|] [|{| "id": "exportDecl2_namespaceExport" |}* [|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl2_namespaceExport" |}H|]|] [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl2" |}./h|]";|]
////[|{| "id": "exportDecl2" |}[|export|] [|type|] [|{| "id": "exportDecl2_namespaceExport" |}* [|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl2" |}H|]|] [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl2" |}./h|]";|]
////[|{| "id": "exportDecl3" |}[|export|] [|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl3" |}I|] } [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl3" |}./i|]";|]
////[|{| "id": "exportDecl4" |}[|export|] [|type|] { j1, j2 [|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl4" |}j3|] } [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl4" |}./j|]";|]
////[|{| "id": "typeDecl1" |}type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "typeDecl1" |}Z1|] = 1;|]
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.