microsoft / microsoft/TypeScript
Code completion: suggest tokens from "paths" in tsconfig.json
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
Search Terms
Code completion; module
Suggestion
Use Cases
For those paths which contains no wildcard character, can we suggest tokens from module it points?
For example:
{
"baseUrl": '.',
"paths": {
"my-base-module": [
"../../dest/base"
],
}
in the example, we can say that bare module specifier "my-base-module" is mapped to path "../../dest/base", which is actually a .d.ts.
However, my IDE(Visual Studio Code) do not list available symbols in "my-base-module",
such as, When I type:
const v: Ve // I 'm going to type Vec3, which is defined in "../../dest/base".
I hopo IDE can suggest Vec3 and auto-complete the importing statement as:
import { Vec3 } from "my-base-module";
You may ask: Why don't you put "../../dest/base" in "types" option in tsconfig.json.
Well, the "../../dest/base" is just a library of me. It is indeed another Typescript project's output bundle file(bundling use rollup). It is bundled as a single module, which, in later, maybe registered as a SystemJS module with name "my-base-module" because I hope users of the library treat the library as a single JS module so they can write:
import /* xx */ from "my-base-module";
Examples
As stated above, I would upload my example if it's needed.
Checklist
My suggestion meets these guidelines:
- [-] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [-] This wouldn't change the runtime behavior of existing JavaScript code
- [-] This could be implemented without emitting different JS based on the types of the expressions
- [-] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- [-] This feature would agree with the rest of TypeScript's Design Goals.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
La issue fornisce un esempio di percorsi tsconfig.json e uno scenario di completamento del codice TypeScript, ma non indica file o test del repository. Inizia riproducendo il completamento mancante per Vec3 tramite il modulo bare mappato; il lavoro è completato quando vengono suggeriti i simboli dal bundle mappato e l'import usa "my-base-module".
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- developer-experience
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 28/100