deno
c9a604af - fix(lsp): watch .wasm files for changes (#35560)

Commit
101 days ago
fix(lsp): watch .wasm files for changes (#35560) Fixes #28334 ## Problem When a local `.wasm` file is recompiled on disk to export a new function, the LSP keeps reporting the function as not exported. It only recovers after the `.wasm` file is manually deleted and recreated. ## Cause On `initialized`, the LSP registers a `workspace/didChangeWatchedFiles` watcher so it can evict cached on-disk documents when their source files change (issue #12813). The registered glob was: ``` **/*.{json,jsonc,lock,js,mjs,cjs,jsx,ts,mts,cts,tsx} ``` `wasm` is missing, so editors never send a change notification when a `.wasm` file's contents change. The LSP therefore keeps serving the stale d.ts (generated via `wasm_module_to_dts`) it read the first time, and dependents see the old exports. Deleting and recreating the file works around it because that drops the cached server document entirely. ## Fix Add `wasm` to the watcher glob. The existing `did_change_watched_files` handler already evicts the changed on-disk document and refreshes diagnostics/TSC caches, so once the change is reported the module's types update correctly. ## Test Adds `lsp_wasm_module_change_watched` in `tests/integration/lsp_tests.rs`: it writes a minimal wasm module that doesn't export `add` (asserts a `2305` diagnostic), rewrites the file on disk so it exports `add`, sends a `didChangeWatchedFiles` change event, and asserts the diagnostic clears. Co-authored-by: divybot <divybot@users.noreply.github.com>
Author
Parents
Loading