Don't send bundled file watchers to client#3840
Conversation
The LSP server was requesting clients to watch embedded TypeScript library files using the pattern 'bundled:///libs/**/*'. This commit filter out bundled watchers before sending them to the client in the updateWatch function to prevent this invalid request.
|
I have never seen this happen. Do you have a test which shows this? Note that we largely don't expect anyone to ever actually run the server with assets bundled. |
There was a problem hiding this comment.
Pull request overview
This PR prevents the language server from requesting client-side filesystem watches for embedded (“bundled:///…”) TypeScript library paths, which are not watchable by the client. It does this by filtering bundled watch globs before calling the LSP client registration API in updateWatch.
Changes:
- Added
internal/bundleddependency to session watch-updating logic. - Skipped registering
FileSystemWatcherentries whose glob patterns arebundled:///…URIs to avoid invalid client watch requests.
| // Skip bundled paths - they are embedded so the client cannot watch them. | ||
| if bundled.IsBundled(fileSystemWatcherGlobString(watcher)) { | ||
| continue | ||
| } |
|
I'm currently using the
Is this documented anywhere? If this is a intended constraint, I'll raise an issue over at nixpkgs |
|
No, but it's just |
|
I don't think this PR is wrong, but we probably need a test that is conditional on whether or not embedding is enabled |
The LSP server was requesting clients to watch embedded TypeScript library files using the pattern 'bundled:///libs/**/*'.
This PR filter out bundled watchers before sending them to the client in the updateWatch function to prevent this invalid request.