microsoft / microsoft/TypeScript
Allow importModuleSpecifier: "relative" to be overridden for explicitly configured "paths" in a jsconfig/tsconfig
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
This is a follow-up issue of https://github.com/microsoft/TypeScript/issues/40139
As per the docs, once you've imported a variable somewhere, vscode knows where to find it (bypassing the issue above).
I want all my code to be imported with relative imports everywhere for consistency. so I set "javascript.preferences.importModuleSpecifier": "relative". However, I don't want relative paths to be used when importing from a module declared in tsconfig's paths, as I specifically put it there so it can be resolved as an absolute import for convenience.
Clearly these 2 settings are conflicting, but I wonder if the current compromise is the best one (i.e. settings.json wins over tsconfig)?
I would expect to be able to auto-import variables from my paths module absolutely, even though I want everything else to import relatively.
- VSCode Version: Insiders
- OS Version: macOS 10.15.6
Steps to Reproduce:
- Clone this repo:
https://github.com/Floriferous/paths-resolution - Go to branch
absolute-import-paths - Notice
test2.jsimportssomeVarproperly - Open
test.js, try to auto-importsomeVar, notice intellisense only suggests a relative import
Does this issue occur when all extensions are disabled?: Yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the paths-resolution reproduction, especially test.js, test2.js, and the referenced jsconfig/tsconfig paths configuration; reproduce the auto-import suggestions with the relative preference enabled. Trace the auto-import handling for explicitly configured paths. Done means paths-based imports are suggested absolutely while other imports remain relative.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100