TypeScript/tests/baselines/reference/findAllRefsForImportCall.baseline.jsonc
Andrew Branch 9dfbf07d8a
Find references of a module by filename (#41805)
* 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
2020-12-11 12:37:02 -08:00

98 lines
1.9 KiB
Plaintext

// === /app.ts ===
// export function [|he/*FIND ALL REFS*/llo|]() {};
// === /indirect-use.ts ===
// import("./re-export").then(mod => mod.services.app.[|hello|]());
// === /direct-use.ts ===
// async function main() {
// const mod = await import("./app")
// mod.[|hello|]();
// }
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/app.ts",
"kind": "function",
"name": "function hello(): void",
"textSpan": {
"start": 16,
"length": 5
},
"displayParts": [
{
"text": "function",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "hello",
"kind": "functionName"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "void",
"kind": "keyword"
}
],
"contextSpan": {
"start": 0,
"length": 26
}
},
"references": [
{
"textSpan": {
"start": 16,
"length": 5
},
"fileName": "/app.ts",
"contextSpan": {
"start": 0,
"length": 26
},
"isWriteAccess": true,
"isDefinition": true
},
{
"textSpan": {
"start": 51,
"length": 5
},
"fileName": "/indirect-use.ts",
"isWriteAccess": false,
"isDefinition": false
},
{
"textSpan": {
"start": 70,
"length": 5
},
"fileName": "/direct-use.ts",
"isWriteAccess": false,
"isDefinition": false
}
]
}
]