microsoft / microsoft/TypeScript
VSCode auto-import ignores typescript.preferences.importModuleSpecifierEnding when using a path from the package.json imports
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.95.1
- OS Version: MacOS 14.7
I have these settings in VSCode:
{
"javascript.preferences.importModuleSpecifierEnding": "minimal",
"typescript.preferences.importModuleSpecifierEnding": "minimal"
}
I have these setting in my package.json:
"imports": {
"#src": ["./src/index.ts", "./src/index/tsx"],
"#src/*": [
"./src/*",
"./src/*.ts",
"./src/*.tsx",
"./src/*/index.ts",
"./src/*/index.tsx"
]
},
I have these settings in my tsconfig.json
"target": "esnext",
"module": "esnext",
"moduleResolution": "bundler",
However, when I auto-import something that starts with #src/, it automatically appends a .js to the import (or a .ts if I have allowImportingTsExtensions on. This is ignoring my settings to use the minimum module specifier ending I set in VSCode.
It looks like the addition of the .ts functionality was added in this bugfix: https://github.com/microsoft/TypeScript/issues/52167. I'm not sure why it wasn't set to respect the vscode settings.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduzieren Sie das Auto-Import-Verhalten anhand der gemeldeten package.json-Imports, tsconfig.json-Einstellungen und VS Code-Einstellungen. Beginnen Sie damit, die Handhabung von TypeScript für Modul-Spezifizierer nachzuverfolgen, und überprüfen Sie anschließend, dass Imports mit Pfaden wie #src/ die konfigurierte minimale Endung berücksichtigen, ohne das bestehende .js- oder .ts-Verhalten zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript, vscode
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100