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

Commit b397d1f

Browse filesBrowse files
authored
Fixes searches for export * as 'identifier' (microsoft#39533)
* Fixes searches for export * as 'identifier' Fixes microsoft#39006 * Fix the context span to export declaration (was incorrectly set to sourceFile in prev commit)
1 parent bf1ea65 commit b397d1f
Copy full SHA for b397d1f

4 files changed

+15-7Lines changed: 15 additions & 7 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/services/findAllReferences.ts‎

Copy file name to clipboardExpand all lines: src/services/findAllReferences.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ namespace ts.FindAllReferences {
132132
return node.parent.parent;
133133

134134
case SyntaxKind.ImportClause:
135+
case SyntaxKind.NamespaceExport:
135136
return node.parent;
136137

137138
case SyntaxKind.BinaryExpression:
Collapse file

‎src/services/importTracker.ts‎

Copy file name to clipboardExpand all lines: src/services/importTracker.ts
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ namespace ts.FindAllReferences {
481481
return exportInfo(symbol, getExportKindForDeclaration(exportNode));
482482
}
483483
}
484+
else if (isNamespaceExport(parent)) {
485+
return exportInfo(symbol, ExportKind.Named);
486+
}
484487
// If we are in `export = a;` or `export default a;`, `parent` is the export assignment.
485488
else if (isExportAssignment(parent)) {
486489
return getExportAssignmentExport(parent);
Collapse file
+10-6Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
/// <reference path="fourslash.ts" />
22

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

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

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

1313
verify.noErrors();
1414
const ranges = test.ranges();
15-
const [r0Def, r0, r1] = ranges;
16-
verify.singleReferenceGroup("const hello: () => string", [r0, r1]);
15+
const [helloDecl, helloDef, leafExportDecl, leafDef, leafImportDecl, leafImportDef, leafUse, helloUse] = ranges;
16+
verify.singleReferenceGroup("const hello: () => string", [helloDef, helloUse]);
17+
const leafExportAsRef = { definition: "import Leaf", ranges: [leafDef] };
18+
const leafImportRef = { definition: "import Leaf", ranges: [leafImportDef, leafUse] };
19+
verify.referenceGroups([leafDef], [leafExportAsRef, leafImportRef]);
20+
verify.referenceGroups([leafImportDef, leafUse], [leafImportRef, leafExportAsRef]);
Collapse file

‎tests/cases/fourslash/referencesForStatementKeywords.ts‎

Copy file name to clipboardExpand all lines: tests/cases/fourslash/referencesForStatementKeywords.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
////
1818
////// export ... from ...
1919
////[|{| "id": "exportDecl1" |}[|export|] [|type|] * [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl1" |}./g|]";|]
20-
////[|{| "id": "exportDecl2" |}[|export|] [|type|] [|{| "id": "exportDecl2_namespaceExport" |}* [|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl2_namespaceExport" |}H|]|] [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl2" |}./h|]";|]
20+
////[|{| "id": "exportDecl2" |}[|export|] [|type|] [|{| "id": "exportDecl2_namespaceExport" |}* [|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl2" |}H|]|] [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl2" |}./h|]";|]
2121
////[|{| "id": "exportDecl3" |}[|export|] [|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl3" |}I|] } [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl3" |}./i|]";|]
2222
////[|{| "id": "exportDecl4" |}[|export|] [|type|] { j1, j2 [|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl4" |}j3|] } [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl4" |}./j|]";|]
2323
////[|{| "id": "typeDecl1" |}type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "typeDecl1" |}Z1|] = 1;|]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.