microsoft / microsoft/TypeScript
Allow importModuleSpecifier: "relative" to be overridden for explicitly configured "paths" in a jsconfig/tsconfig
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.3k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 132
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với việc tái hiện quá trình phân giải đường dẫn, đặc biệt là test.js, test2.js và cấu hình paths của jsconfig/tsconfig được tham chiếu; tái hiện các đề xuất auto-import khi đã bật tùy chọn ưu tiên đường dẫn tương đối. Theo dõi cách xử lý auto-import đối với các đường dẫn được cấu hình tường minh. Hoàn tất khi các import dựa trên paths được đề xuất dưới dạng tuyệt đối, trong khi các import khác vẫn giữ dạng tương đối.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, typescript, vscode
- Lĩnh vực
- developer-experience, tooling
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100