-
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.
Make findAllReferences work on triple-slash reference paths that reso…
…lve to scripts (#41936) * Support find-all-references on triple-slash references that resolve to scripts * Rename terrible name * Add test for <reference types="..." /> * Actually accept baselines
- Loading branch information
1 parent
9dfbf07
commit 78ded65
Showing
4 changed files
with
174 additions
and
23 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
99 changes: 99 additions & 0 deletions
99
tests/baselines/reference/findAllReferencesTripleSlash.baseline.jsonc
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,99 @@ | ||
// === /c.js === | ||
// require([|"./b"|]); | ||
// require("globals"); | ||
|
||
// === /a.ts === | ||
// /// <reference path="[|b.ts|]/*FIND ALL REFS*/" /> | ||
// /// <reference types="globals" /> | ||
|
||
[ | ||
{ | ||
"definition": { | ||
"containerKind": "", | ||
"containerName": "", | ||
"fileName": "/a.ts", | ||
"kind": "string", | ||
"name": "b.ts", | ||
"textSpan": { | ||
"start": 21, | ||
"length": 4 | ||
}, | ||
"displayParts": [ | ||
{ | ||
"text": "\"b.ts\"", | ||
"kind": "stringLiteral" | ||
} | ||
] | ||
}, | ||
"references": [ | ||
{ | ||
"textSpan": { | ||
"start": 21, | ||
"length": 4 | ||
}, | ||
"fileName": "/a.ts", | ||
"isWriteAccess": false, | ||
"isDefinition": false | ||
}, | ||
{ | ||
"textSpan": { | ||
"start": 8, | ||
"length": 5 | ||
}, | ||
"fileName": "/c.js", | ||
"isWriteAccess": false, | ||
"isDefinition": false | ||
} | ||
] | ||
} | ||
] | ||
|
||
// === /c.js === | ||
// require("./b"); | ||
// require([|"globals"|]); | ||
|
||
// === /a.ts === | ||
// /// <reference path="b.ts" /> | ||
// /// <reference types="[|globals|]/*FIND ALL REFS*/" /> | ||
|
||
[ | ||
{ | ||
"definition": { | ||
"containerKind": "", | ||
"containerName": "", | ||
"fileName": "/a.ts", | ||
"kind": "string", | ||
"name": "globals", | ||
"textSpan": { | ||
"start": 52, | ||
"length": 7 | ||
}, | ||
"displayParts": [ | ||
{ | ||
"text": "\"globals\"", | ||
"kind": "stringLiteral" | ||
} | ||
] | ||
}, | ||
"references": [ | ||
{ | ||
"textSpan": { | ||
"start": 52, | ||
"length": 7 | ||
}, | ||
"fileName": "/a.ts", | ||
"isWriteAccess": false, | ||
"isDefinition": false | ||
}, | ||
{ | ||
"textSpan": { | ||
"start": 24, | ||
"length": 9 | ||
}, | ||
"fileName": "/c.js", | ||
"isWriteAccess": false, | ||
"isDefinition": false | ||
} | ||
] | ||
} | ||
] |
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,19 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @checkJs: true | ||
|
||
// @Filename: /node_modules/@types/globals/index.d.ts | ||
//// declare const someAmbientGlobal: unknown; | ||
|
||
// @Filename: /a.ts | ||
//// /// <reference path="b.ts/*1*/" /> | ||
//// /// <reference types="globals/*2*/" /> | ||
|
||
// @Filename: /b.ts | ||
//// console.log("b.ts"); | ||
|
||
// @Filename: /c.js | ||
//// require("./b"); | ||
//// require("globals"); | ||
|
||
verify.baselineFindAllReferences("1", "2"); |