microsoft / microsoft/TypeScript

Autocomplete Filepath Strings.

Offen
#42,054 5 Kommentare 26 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

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.

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

Es werden keine Repository-Dateien oder Tests genannt. Beginnen Sie damit, den Autocomplete-Pfad des language-service für String-Literale zu finden und zu prüfen, wie die Beispiele für fs.readFile und require dargestellt werden. Als abgeschlossen würde gelten, wenn ein abgestimmtes Design für Pfadtypisierung, Completion, Ressourcenvalidierung und Aktualisierungen bei Umbenennungen vorliegt, zusammen mit Tests für das vorgeschlagene Verhalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
developer-experience, tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

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