microsoft / microsoft/TypeScript

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

Offen
#63,498 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

### 🔎 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`.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Reproduktion in .vscode/settings.json und a.ts, indem du fs.d.ts umschaltest und dabei das Verhalten von Quick Fix mit den IntelliSense-Vervollständigungsvorschlägen vergleichst. Verfolge die Konfigurationsverarbeitung für js/ts.preferences.autoImportFileExcludePatterns und den von ihr beeinflussten Vervollständigungszustand. Die Aufgabe ist abgeschlossen, wenn eine Änderung der Einstellung die aktuellen IntelliSense-Vorschläge sofort aktualisiert und die gemeldete Reproduktion durch einen Regressionstest abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
developer-experience, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.