microsoft / microsoft/TypeScript

Enable auto imports and add missing import for module/package names

Aperta
#52,527 2 commenti 4 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Domain: LS: Auto-import Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Suggestion

🔍 Search Terms

  • auto import
  • quick fix
  • missing import

⭐ Suggestion

Auto imports / add missing imports should be able to add import * as XYZ from 'XYZ' when triggered on the symbol name XYZ in a file. This is useful if you prefer using namespace imports and can also help with discovering/exploring new packages

Right now we have auto imports and an add missing import quick fix for symbols in a module, but I don't see these options for the module itself

📃 Motivating Example

  1. In a new project
  2. npm I @types/vscode
  3. Open new TS file and write vscode.

Right now I don't get an auto import for vscode. I'd expect an import that adds: import * as vscode from 'vscode'; at the top of the file

💻 Use Cases

  • Make it easier to reference a symbol if you prefer using namespaces from the start
  • Helping users explore new packages (just type vscode. to see suggestions in the vscode package)
  • Working with node packages. It'd be nice to be able to type fs. to get an fs import
  • Fixing code that has been copy and pasted between files

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

Non vengono indicati file, test o punti di ingresso. Inizia riproducendo l'esempio TypeScript con vscode. e confronta il comportamento esistente per l'importazione automatica e l'aggiunta delle importazioni mancanti per i simboli. Il lavoro è completato quando un nome di modulo può attivare un'importazione dello spazio dei nomi come import * as vscode from 'vscode'; negli scenari descritti.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.