microsoft / microsoft/TypeScript

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

Aperta
#40,442 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

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)?

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 sono indicati file né test. Inizia cercando l'impostazione javascript.preferences.importModuleSpecifier e il punto di ingresso per la generazione dei percorsi degli autoimport; il lavoro è completato quando un'impostazione opzionale produce importazioni relative locali con il prefisso ./ richiesto senza modificare il comportamento predefinito.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.