microsoft / microsoft/TypeScript
Allow importModuleSpecifier: "relative" to be overridden for explicitly configured "paths" in a jsconfig/tsconfig
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从复现路径解析开始,重点关注 test.js、test2.js 以及所引用的 jsconfig/tsconfig paths 配置;启用相对路径优先后,复现自动导入建议。跟踪对显式配置路径的自动导入处理。完成的标准是:基于 paths 的导入应以绝对路径形式被建议,而其他导入仍保持相对路径。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, typescript, vscode
- 领域
- developer-experience, tooling
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100