TypeScript/tests/baselines/reference/findAllRefs_importType_js.2.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

107 lines
2 KiB
Plaintext

// === /a.js ===
// module.exports = class C {};
// module.exports./*FIND ALL REFS*/[|D|] = class D {};
// === /b.js ===
// /** @type {import("./a")} */
// const x = 0;
// /** @type {import("./a").[|D|]} */
// const y = 0;
[
{
"definition": {
"containerKind": "",
"containerName": "",
"fileName": "/a.js",
"kind": "alias",
"name": "(alias) (local class) D\nimport D",
"textSpan": {
"start": 44,
"length": 1
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "alias",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "local class",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "D",
"kind": "aliasName"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "import",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "D",
"kind": "aliasName"
}
],
"contextSpan": {
"start": 29,
"length": 16
}
},
"references": [
{
"textSpan": {
"start": 44,
"length": 1
},
"fileName": "/a.js",
"contextSpan": {
"start": 29,
"length": 30
},
"isWriteAccess": true,
"isDefinition": true
},
{
"textSpan": {
"start": 67,
"length": 1
},
"fileName": "/b.js",
"isWriteAccess": false,
"isDefinition": false
}
]
}
]