microsoft / microsoft/TypeScript

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

Abierto
#63,498 1 comentario 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Needs Investigation
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con la reproducción en .vscode/settings.json y a.ts, alternando fs.d.ts mientras comparas el comportamiento de Quick Fix con las sugerencias de completado de IntelliSense. Sigue el procesamiento de la configuración de js/ts.preferences.autoImportFileExcludePatterns y el estado de completado que afecta. La tarea estará terminada cuando cambiar la configuración actualice inmediatamente las sugerencias actuales de IntelliSense y la reproducción reportada esté cubierta por una prueba de regresión.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
developer-experience, tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.