microsoft / microsoft/TypeScript

Destructured function does not show outline of inner function parameters

Offen
#63,551 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

### 🔎 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem Outline-Modell des TypeScript-Servers und reproduziere die beiden Codebeispiele aus dem Issue. Vergleiche dabei die für eine destrukturierte Rückgabe erzeugten Einträge mit denen für eine benannte Variable. Verfolge, warum die verschachtelten Einträge a, b und c im destrukturierten Fall fehlen, und betrachte das Issue als erledigt, wenn beide Formen diese Einträge konsistent offenlegen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.