-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support finding references at
module
in module.exports =
or `expo…
…rt` in `export =` (#28221) * Support finding references at `module` in `module.exports =` or `export` in `export =` * Add json test
- Loading branch information
Andy
authored
Nov 9, 2018
1 parent
69c61cd
commit aaf1d80
Showing
8 changed files
with
82 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @allowJs: true | ||
// @checkJs: true | ||
// @resolveJsonModule: true | ||
|
||
// @Filename: /a.ts | ||
////import [|{| "isWriteAccess": true, "isDefinition": true |}j|] = require("[|./j.json|]"); | ||
////[|j|]; | ||
|
||
// @Filename: /b.js | ||
////const [|{| "isWriteAccess": true, "isDefinition": true |}j|] = require("[|./j.json|]"); | ||
////[|j|]; | ||
|
||
// @Filename: /j.json | ||
////[|{ "x": 0 }|] | ||
|
||
verify.noErrors(); | ||
|
||
const [r0, r1, r2, r3, r4, r5, r6] = test.ranges(); | ||
verify.singleReferenceGroup('import j = require("./j.json")', [r0, r2]); | ||
verify.referenceGroups([r1, r4], [{ definition: 'module "/j"', ranges: [r1, r4, r6] }]); | ||
verify.singleReferenceGroup('const j: {\n "x": number;\n}', [r3, r5]); | ||
verify.referenceGroups(r6, undefined); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @allowJs: true | ||
|
||
// @Filename: /a.js | ||
////const b = require("[|./b|]"); | ||
|
||
// @Filename: /b.js | ||
////[|module|].exports = 0; | ||
|
||
verify.singleReferenceGroup('module "/b"') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters