microsoft / microsoft/TypeScript

Add TS Server command for 'add all missing imports'

Offen
#40,921 1 Kommentar 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Domain: LS: Quick Fixes Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

Search terms

  • code action
  • source action
  • Add missing imports
  • getCombinedCodeFix

Feature request

Add a new TS Server command that triggers 'add all missing imports' for a given file.

Use case

VS Code allows users to configure code actions that are run on save. One of the supported code actions is source.addMissingImports which attempts to add all missing imports in a file. Users can also setup keybindings for these specific actions

To implement this, right now we request all code actions for the file and then try fetching the 'add all missing imports' combined fix for one of them. This is complicated and results in the TS Server doing extra work.

It would be better for us if we could ask the Typescript server: give me the edits that add the missing imports in this file

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 bei der bestehenden Verarbeitung von getCombinedCodeFix im TypeScript-Server für die Aktion source.addMissingImports. Verfolge, wie Befehle und Dateiänderungen bereitgestellt werden, und überprüfe anschließend, dass der neue Befehl die Änderungen zum Hinzufügen aller fehlenden Imports in einer bestimmten Datei zurückgibt, ohne den umfassenderen code-action-Anfragefluss zu erfordern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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