-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Description
TypeScript Version: 3.6.0-dev.20190618
Search Terms:
tsserver
references
peek references
array destructuring assignment
Code
index.ts
import { a, b, c } from './mod';
console.log(a, b, c);
mod.ts
export const [a, b] = [1, 2];
export const c = 3;
- run following script that is to get variable
b
's references
npx tsserver <<EOF | tail -n 1
{"command":"open","arguments":{"file":"/path/to/mod.ts"}}
{"command":"references","arguments":{"file":"/path/to/mod.ts","line":1,"offset":19}}
EOF
Expected behavior:
tsserver returned all variable b
's references( refs
field should contain index.ts
's result), like following
script(to get variable c
's references) result
{"seq":0,"type":"response","command":"references","success":true,"body":{"refs":[{"file":"/path/to/ts-array-destructured-refs/src/mod.ts","start":{"line":2,"offset":14},"end":{"line":2,"offset":15},"lineText":"export const c = 3;","isWriteAccess":true,"isDefinition":true},{"file":"/path/to/ts-array-destructured-refs/src/index.ts","start":{"line":1,"offset":16},"end":{"line":1,"offset":17},"lineText":"import { a, b, c } from './mod';","isWriteAccess":true,"isDefinition":true},{"file":"/path/to/ts-array-destructured-refs/src/index.ts","start":{"line":2,"offset":19},"end":{"line":2,"offset":20},"lineText":"console.log(a, b, c);","isWriteAccess":false,"isDefinition":false}],"symbolName":"c","symbolStartOffset":14,"symbolDisplayString":"const c: 3"}}
Actual behavior:
tsserver returned refs
field that contain index.ts
's variables.
result output
{"seq":0,"type":"response","command":"references","success":true,"body":{"refs":[{"file":"/path/to/ts-array-destructured-refs/src/mod.ts","start":{"line":1,"offset":18},"end":{"line":1,"offset":19},"lineText":"export const [a, b] = [1, 2];","isWriteAccess":true,"isDefinition":true}],"symbolName":"b","symbolStartOffset":18,"symbolDisplayString":"const b: number"}}
Playground Link:
https://github.com/sisisin-sandbox/ts-array-destructured-refs
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript