You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File changed on disk with a content-mapped or .d.ts extension never triggers workspace/diagnostic/refresh #64943
// index.ts. toy-mapper turns each `name: type` line of shape.data into a member of `Data`.importtype{Dep}from'./dep.js';importtype{Data}from'./shape.data';declareconstdep: Dep;declareconstdata: Data;exportconstfromTs=dep.age;// error until `age` is added to dep.tsexportconstfromData=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.
changed the title [-]Content-mapped file changed on disk never triggers workspace/diagnostic/refresh[/-][+]File changed on disk with a content-mapped or .d.ts extension never triggers workspace/diagnostic/refresh[/+]on Oct 23, 2026
changed the title [-]File changed on disk with a content-mapped or .d.ts extension never triggers workspace/diagnostic/refresh[/-][+]File changed on disk with a content-mapped or `.d.ts` extension never triggers workspace/diagnostic/refresh[/+]on Oct 23, 2026
Activity
[-]Content-mapped file changed on disk never triggers workspace/diagnostic/refresh[/-][+]File changed on disk with a content-mapped or .d.ts extension never triggers workspace/diagnostic/refresh[/+][-]File changed on disk with a content-mapped or .d.ts extension never triggers workspace/diagnostic/refresh[/-][+]File changed on disk with a content-mapped or `.d.ts` extension never triggers workspace/diagnostic/refresh[/+]Refresh diagnostics when a content-mapped or declaration file changes…