microsoft / microsoft/TypeScript

"javascript.preferences.importModuleSpecifier" relative path, but with current directory prefix

Offen
#40,442 2 Kommentare 0 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

I'm not sure if there is a way to do this already, but I tried so many different setting combinations without any success, so it would be nice to have an option to prefix relative import paths with ./, either as part of the importModuleSpecifier or somewhere else.

So it would go from this:

import FML from '../components/FML'

To this (optional of course, not changing the default behaviour):

import FML from './../components/FML'

I accidentally posted this in the TypeScript Repository first, so here's the original (now deleted) post explaining this further:

I'm having trouble getting the autoimport feature to include ./ at the start of the path for local imports. I tried changing all the settings mentioned above and more to all the possible options and I tried setting it with jsconfig.json - tried pretty much all the possible combinations of these settings - but I just can't get it to work.

The closest I got was the default setting, which made the import paths like this import FML from '../components/FML', but I still have to manually put the ./ before each import path to change it to this import FML from './../components/FML' :( Can anyone help me please (if so, you can send me a mail to not clutter up this post)?

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 Dateien oder Tests genannt. Beginne mit der Suche nach der Einstellung javascript.preferences.importModuleSpecifier und dem Einstiegspunkt für die Pfaderzeugung von Autoimports; die Aufgabe ist abgeschlossen, wenn eine optionale Einstellung lokale relative Importe mit dem gewünschten ./-Präfix erzeugt, ohne das Standardverhalten zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, vscode
Bereich
developer-experience, tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
32/100

Neue Issues direkt in Ihr Postfach

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