microsoft / microsoft/TypeScript

Add TS Server command for 'add all missing imports'

Aperta
#40,921 1 commento 6 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Domain: LS: Quick Fixes Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla gestione esistente di getCombinedCodeFix nel server TypeScript per l'azione source.addMissingImports. Traccia il modo in cui vengono esposti i comandi e le modifiche ai file, quindi verifica che il nuovo comando restituisca le modifiche per aggiungere tutti gli import mancanti in un determinato file senza richiedere il flusso più ampio della richiesta code-action.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.