microsoft / microsoft/TypeScript

Support `@import` JSDoc tag for auto-imports

Đang mở
#62,008 3 bình luận 13 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Awaiting More Feedback Suggestion
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ả

🔍 Search Terms

"jsdoc @import", "@import auto-import", "jsdoc auto-import"

✅ Viability Checklist
⭐ Suggestion

Since #57207 it is possible to use the JSDoc @import tag.

/** @import { Foo } from 'foo.js'; */

/** @type {Foo} */
const foo = ...;

However, auto-imports still only use the old inline syntax:

/** @type {import('foo.js').Foo} */
const foo = ...;

It would be nice to also have the option to chose the new @import syntax for the auto-imports, either by configuring an option somewhere or simply by adding another action that can be exposed in IDEs.

📃 Motivating Example

I believe this falls in line with the ergonomics goals outlined by the original issue about having a nicer syntax for JSDoc imports #22160.

I will not repeat the arguments made therein, but suffice to say that it produces more readable code.

💻 Use Cases

Having the auto-import work with this syntax would:

  • Save time, not having to write import statements by hand.
  • Avoid mistakes due to typos, etc.
  • Help people adopt the existing feature.

(I have opened the issue here instead of over in vscode. Based on my understanding, this behavior is exposed by the TypeScript Language Server and not by the individual IDEs. Please correct me if I'm wrong.)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách đọc hành vi của TypeScript Language Server được mô tả ở đây và bối cảnh trong các issue #57207 và #22160. Theo dõi cách auto-imports hiện tạo ra các import JSDoc inline, sau đó xác định liệu kết quả được hỗ trợ nên là một tùy chọn cấu hình hay một action riêng; hoàn tất khi auto-imports có thể tạo ra cú pháp @import được yêu cầu.

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

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.