microsoft / microsoft/TypeScript

If autoimporting import that is commented out - uncomment it instead of adding new one

Đang mở
#39,690 1 bình luận 1 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

autoimport commented uncomment import

Suggestion

Consider we have such imports already in some file:

import React, {
  useState,
  // useEffect,
} from 'react';

Then - if you write useEffect - TS will suggest auto importing it - which is cool. If you choose to auto import it - your import statement will look something like:

import React, {
  useState,
  // useEffect,
  useEffect,
} from 'react';

Which is not a big deal, but leads to some kind of duplication.

Desired result would be:

import React, {
  useState,
  useEffect,
} from 'react';

Which is just removing the comment next to the import I want to use.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

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 từ phần xử lý auto-import của language-service trong TypeScript và tìm các test bao quát các import có named import bị chú thích. Thêm một ca hồi quy cho import theo kiểu React được hiển thị và xác minh rằng việc chọn auto-import sẽ xóa chú thích thay vì thêm một import trùng lặp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
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.