Skip to content

fix: use LSP-compliant dynamic file watcher registration#75

Open
Swahjak wants to merge 1 commit intomoetelo:masterfrom
toppynl:fix/lsp-compliant-file-watcher
Open

fix: use LSP-compliant dynamic file watcher registration#75
Swahjak wants to merge 1 commit intomoetelo:masterfrom
toppynl:fix/lsp-compliant-file-watcher

Conversation

@Swahjak
Copy link

@Swahjak Swahjak commented Jan 6, 2026

Summary

  • Moves file watching from client-side (VSCode-specific) to server-side using the LSP standard client/registerCapability request
  • Removes client-side FileSystemWatcher from extension.ts
  • Adds dynamic registration for didChangeWatchedFiles in onInitialized
  • Handles file changes via connection.onDidChangeWatchedFiles
  • Adds remove() and refresh() methods to DocumentCache

Benefits

  • LSP-compliant: Follows LSP 3.17 specification
  • Editor-agnostic: Works with any LSP-compliant editor (Neovim, Sublime, Emacs, etc.)
  • Flexible patterns: Server controls which files to watch

Test plan

  • Verify file watching works in VSCode after modifications
  • Verify file watching works when files are created/deleted externally
  • Test with another LSP-compliant editor if possible

Fixes #54

Move file watching from client-side (VSCode-specific) to server-side
using the LSP standard `client/registerCapability` request.

This makes the extension compatible with other LSP-compliant editors
(Neovim, Sublime, Emacs, etc.) by:

- Removing client-side FileSystemWatcher from extension.ts
- Adding dynamic registration for didChangeWatchedFiles in onInitialized
- Handling file changes via connection.onDidChangeWatchedFiles
- Adding remove() and refresh() methods to DocumentCache

Fixes moetelo#54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should use LSP-complient way to register file watcher

1 participant