File changed on disk with a content-mapped or `.d.ts` extension never triggers workspace/diagnostic/refresh
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, node.js, typescript
- Área
- backend, devtools, testing-qa
Línea de trabajo
Start with the change in #64159 and trace Session.DidChangeWatchedFiles, path.Extension(), and the content mapper extension check described in the issue. Use the linked repro repository with npm install && npm run repro to compare changes to dep.ts, shape.data, and an open shape.data file. Done when disk changes to mapped files and .d.ts files trigger diagnostic refreshes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🔎 Search Terms
"content mapper", "contentMappers", "workspace/diagnostic/refresh", "didChangeWatchedFiles", "isRelevantExtension", "stale diagnostics", "restart TS server", ".d.ts"
🕗 Version & Regression Information
- This changed in #64159, which switched
Session.DidChangeWatchedFilesfrom taking everything after the last dot topath.Extension(). Seen on [email protected].
⏯ Playground Link
No response
💻 Code
Repro: https://github.com/mrlubos/ts-content-mapper-refresh (npm install && npm run repro)
// tsconfig.json
{ "compilerOptions": { "module": "nodenext", "strict": true, "noEmit": true },
"contentMappers": [{ "package": "toy-mapper", "extensions": [".data"] }] }
// index.ts. toy-mapper turns each `name: type` line of shape.data into a member of `Data`.
import type { Dep } from './dep.js';
import type { Data } from './shape.data';
declare const dep: Dep;
declare const data: Data;
export const fromTs = dep.age; // error until `age` is added to dep.ts
export const fromData = data.age; // error until `age: number` is added to shape.data
🙁 Actual behavior
After shape.data changes on disk (written by another process, with the editor sending workspace/didChangeWatchedFiles), the server never sends workspace/diagnostic/refresh. In VS Code the error on data.age stays until "TypeScript: Restart TS Server". The server already has the right answer: a textDocument/diagnostic request made by hand returns no errors. npm run repro drives tsc --lsp as VS Code does and prints:
- dep.ts changed on disk, refresh requests: 1
- shape.data changed on disk, refresh requests: 0
errors when pulled by hand: [] - shape.data edited while open, refresh requests: 1
🙂 Expected behavior
A change on disk to a file a registered content mapper handles should refresh diagnostics the way a change to a .ts file does, since it changes the program. This matters most when a tool regenerates the mapped file, for example a dev server writing an API description on each reload, because the editor never has that file open.
Additional information about the issue
path.Extension() returns only the extensions TypeScript reads itself. For shape.data it returns "", so the path is treated as a possible directory: DirectoryExists is false and the change is dropped. The check against the extensions a project's contentMappers register is in the else branch, which a mapped extension never reaches.
The same change breaks .d.ts files: path.Extension() returns .d.ts, which isRelevantExtension does not list, so a declaration file changed on disk does not refresh diagnostics either.
A workaround for mapped files is to keep the file open in an editor tab, so VS Code reloads it and sends didChange.
- Lenguaje dominante
- Go
- Estrellas
- 112k
- Forks
- 15.4k
- Merge medio
- 2 d 21 h
- PR fusionados (30 d)
- 126
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/TypeScript
-
Won't Fix
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
microsoft/TypeScript#65107 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file locationPosiblemente ocupada @timurzvural la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/TypeScript#65087 ·
Los mantenedores suelen responder en 1 día
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. AbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/TypeScript#64758 ·
Los mantenedores suelen responder en 1 día
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`Posiblemente ocupada @rajnish-verma-22172 la tomó hace 12 días. AbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
microsoft/TypeScript#64742 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindingsPosiblemente ocupada @dmety la tomó hace 26 días. AbiertoBug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/TypeScript#64661 ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/TypeScript
Issues similares
-
fix(scan): validate and normalize output format in validate-contractPosiblemente ocupada @WKr1shna la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
argoproj/argo-workflows#17397 ·
Los mantenedores suelen responder en 1 día
-
[mesheryctl] design delete fails when passing file or URL as positional argumentPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertocomponent/mesheryctl kind/bug language/go
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
meshery/meshery#22772 · 3 comentarios ·
Los mantenedores suelen responder en 1 día