* Naive implementation enough to build and write a test * Add simple test * Add project references test * Add deduplication test, accept baselines * Add test for referencing a script (doesn’t do anything) * Update API baselines * Use refFileMap for non-module references * Fix find-all-refs on module specifier * Remove unused util * Don’t store text range on ts.RefFile * Ensure string literal could itself be a file reference * Remove unused utilities * Improve baseline format * Preserve old behavior of falling back to string literal references * Update baselines from master * Fix old RefFileMap code after merge * Add test for additional response info * Undo test change
186 lines
3.6 KiB
Plaintext
186 lines
3.6 KiB
Plaintext
// === /import.ts ===
|
|
// import [|"./script/*FIND ALL REFS*/"|];
|
|
|
|
// === /require.js ===
|
|
// require([|"./script"|]);
|
|
// console.log("./script");
|
|
|
|
// === /tripleSlash.ts ===
|
|
// /// <reference path="[|script.ts|]" />
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/import.ts",
|
|
"kind": "var",
|
|
"name": "./script",
|
|
"textSpan": {
|
|
"start": 8,
|
|
"length": 8
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "\"./script\"",
|
|
"kind": "stringLiteral"
|
|
}
|
|
]
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 7,
|
|
"length": 10
|
|
},
|
|
"fileName": "/import.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 8,
|
|
"length": 10
|
|
},
|
|
"fileName": "/require.js",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 21,
|
|
"length": 9
|
|
},
|
|
"fileName": "/tripleSlash.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
// === /import.ts ===
|
|
// import [|"./script"|];
|
|
|
|
// === /require.js ===
|
|
// require([|"./script/*FIND ALL REFS*/"|]);
|
|
// console.log("./script");
|
|
|
|
// === /tripleSlash.ts ===
|
|
// /// <reference path="[|script.ts|]" />
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/require.js",
|
|
"kind": "var",
|
|
"name": "./script",
|
|
"textSpan": {
|
|
"start": 9,
|
|
"length": 8
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "\"./script\"",
|
|
"kind": "stringLiteral"
|
|
}
|
|
]
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 7,
|
|
"length": 10
|
|
},
|
|
"fileName": "/import.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 8,
|
|
"length": 10
|
|
},
|
|
"fileName": "/require.js",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 21,
|
|
"length": 9
|
|
},
|
|
"fileName": "/tripleSlash.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
// === /require.js ===
|
|
// require("[|./script|]");
|
|
// console.log("[|./script|]/*FIND ALL REFS*/");
|
|
|
|
// === /stringLiteral.ts ===
|
|
// console.log("[|./script|]");
|
|
|
|
[
|
|
{
|
|
"definition": {
|
|
"containerKind": "",
|
|
"containerName": "",
|
|
"fileName": "/require.js",
|
|
"kind": "var",
|
|
"name": "./script",
|
|
"textSpan": {
|
|
"start": 34,
|
|
"length": 8
|
|
},
|
|
"displayParts": [
|
|
{
|
|
"text": "\"./script\"",
|
|
"kind": "stringLiteral"
|
|
}
|
|
]
|
|
},
|
|
"references": [
|
|
{
|
|
"textSpan": {
|
|
"start": 9,
|
|
"length": 8
|
|
},
|
|
"fileName": "/require.js",
|
|
"contextSpan": {
|
|
"start": 0,
|
|
"length": 20
|
|
},
|
|
"isWriteAccess": false,
|
|
"isDefinition": false,
|
|
"isInString": true
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 34,
|
|
"length": 8
|
|
},
|
|
"fileName": "/require.js",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false,
|
|
"isInString": true
|
|
},
|
|
{
|
|
"textSpan": {
|
|
"start": 13,
|
|
"length": 8
|
|
},
|
|
"fileName": "/stringLiteral.ts",
|
|
"isWriteAccess": false,
|
|
"isDefinition": false,
|
|
"isInString": true
|
|
}
|
|
]
|
|
}
|
|
] |