microsoft / microsoft/TypeScript

`js/ts.preferences.autoImportFileExcludePatterns` is not reflected promptly in IntelliSense suggestions

Đang mở
#63,498 1 bình luận 2 reaction 0 người được giao Xem trên GitHub

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

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

autoImportFileExcludePatterns

### 🕗 Version & Regression Information

- I test this in 4.8.4, 6.0.3 and tsgo 0.20260520.1

### ⏯ Playground Link

_No response_

### 💻 Code
in `.vscode/settings.json`
```json
"js/ts.preferences.autoImportFileExcludePatterns": [
//"**/node_modules/@types/node",
// "node",
"fs.d.ts",
// "node_modules/@types/node/fs.d.ts",
// "node:fs"
]
```

a.ts

```ts
readFileSync('','');
readF
```

### 🙁 Actual behavior

In VSCode,
when repeatedly toggling `"fs.d.ts"` in the config above:
Normal part: you will find that for the first line `readFileSync('','')`, the `Quick Fix` menu item like `import from "fs"` will appear or disappear as expected when `"fs.d.ts"` is added or removed from the config.
But for the case when you type `readF` and trigger IntelliSense, whether `readFileSync...` appears in the completion suggestions is unpredictable. Sometimes using "Reload Window" can fix it, but in most cases, it doesn't work as expected—toggling `"fs.d.ts"` doesn't immediately change the current IntelliSense state.

### 🙂 Expected behavior

For the above example, after modifying `"js/ts.preferences.autoImportFileExcludePatterns"` in the VSCode config, I expect the IntelliSense suggestions to reflect the changes immediately.

### Additional information about the issue

There is a similar issue: https://github.com/microsoft/TypeScript/issues/60082
However, that one is a bit old and the phenomenon I described is somewhat different.

Additionally, I have a question: For the setting `js/ts.preferences.autoImportFileExcludePatterns`, does it only match a single file, or does it match the `xxx` part in` import ... from 'xxx'`? After all, a single file can define multiple modules, and multiple "exports" can also be defined in `package.json`.

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 với việc tái hiện trong .vscode/settings.json và a.ts, chuyển đổi fs.d.ts trong khi so sánh hành vi của Quick Fix với các đề xuất hoàn tất của IntelliSense. Theo dõi quá trình xử lý cấu hình cho js/ts.preferences.autoImportFileExcludePatterns và trạng thái hoàn tất mà nó ảnh hưởng. Hoàn thành khi việc thay đổi cài đặt cập nhật ngay các đề xuất IntelliSense hiện tại và bản tái hiện được báo cáo được bao phủ bởi một bài kiểm thử hồi quy.

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
developer-experience, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/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.