microsoft / microsoft/TypeScript
Destructured function does not show outline of inner function parameters
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- PR merge metrics
- PR metrics pending
Description
### 🔎 Search Terms
outline model
### 🕗 Version & Regression Information
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
### ⏯ Playground Link
_No response_
### 💻 Code
```ts
// Your code here
```
### 🙁 Actual behavior
Essentially for the code:
```
export const [var1, var2] = processLightDarkTokens({
a : {
b : {
}
},
c : {
}
});
```
The outline model returned by TypeScript does not show a, b and c. But for:
```
export const abc = processLightDarkTokens({
a : {
b : {
}
},
c : {
}
});
```
It does.
### 🙂 Expected behavior
I would expect a, b, and c to be visible in the outline model in both cases.
### Additional information about the issue
Hi, I am a developer on the VS Code team, and I recently received the following bug : https://github.com/microsoft/vscode/issues/241563. The bug is that the VS Code editor sticky scroll does not display the expected sticky lines. This happens because the outline model returned by the TypeScript server changes unexpectedly depending on if the function return variable is destructured or not. I attach a screen recording here to show the issue.
Essentially for the code:
```
export const [var1, var2] = processLightDarkTokens({
a : {
b : {
}
},
c : {
}
});
```
The outline does not show a, b and c. But for:
```
export const abc = processLightDarkTokens({
a : {
b : {
}
},
c : {
}
});
```
It does. Is this expected?
https://github.com/user-attachments/assets/1b425011-ae36-4b54-bb75-fc193a3246ba
Contributor guide
Research direction
Start with the TypeScript server's outline model and reproduce the two code examples from the issue, comparing the entries produced for a destructured return with those for a named variable. Trace why the nested a, b, and c entries are omitted in the destructured case, and consider the issue done when both forms expose those entries consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100