microsoft / microsoft/TypeScript

Autocomplete Filepath Strings.

Aperta
#42,054 5 commenti 26 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Search Terms

Autocomplete, fs, require, strings.

Suggestion

I would like to be able to mark a string as a relative path, and get autocomplete for it if it's initialised with a constant.

Examples

var path: tsRelativePath;
path = "./fi 
//pressing ctrl-space should autocomplete to ./file or ./file.txt.
fs.readFile("./fi 
//pressing ctrl-space should autocomplete to ./file or ./file.txt.

Obviously some name for the type that doesn't conflict with common type names will have to be chosen.

Use Cases

It would be nice to have autocomplete for fs.read etc.

I'm making a modified require.js library which allows me to use a custom import function on the client to load resources (html templates, css, 3D models, animations, shaders, etc.) relative to the current script file. I'd like to be able to get auto-complete on the paths and compiler errors if the resource doesn't exist (e.g. i forgot to build my scss files).

I would also like these paths to update when you move or rename a resource the same way paths update when you move or rename a script file.

I'm aware this functionality can be enabled in VSCode with plugins but I'm stuck using Visual Studio and would like it to be supported natively.

Checklist

My suggestion meets these guidelines:

  • [ y] This wouldn't be a breaking change in existing TypeScript/JavaScript code (as long as the type name is chosen well)
  • [ y] This wouldn't change the runtime behavior of existing JavaScript code
  • [ y] This could be implemented without emitting different JS based on the types of the expressions
  • [ y] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • [ y] This feature would agree with the rest of TypeScript's Design Goals.

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 o test del repository. Inizia individuando il percorso di autocomplete di language-service per i letterali stringa e verificando come sono rappresentati gli esempi di fs.readFile e require. Il lavoro sarà considerato completato quando sarà disponibile un design concordato per la tipizzazione dei percorsi, la completion, la validazione delle risorse e gli aggiornamenti dei rename, insieme ai test per il comportamento proposto.

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

Valutazione

Stack tecnologico
javascript, typescript
Ambito
developer-experience, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.