-
-
Notifications
You must be signed in to change notification settings - Fork 414
Description
Your environment
Debian testing, emacs with eglot (or lsp-mode), working on GHC.
Steps to reproduce
Configure emacs to use eglot, open a file in GHC, e.g. GHC.Parser.PostProcess
Look at the log file
Expected behaviour
The registration of workspace/didChangeWatchedFiles should either use separate IDs if multiple, or multiple file watchers for one only
Actual behaviour
We get multiple client/RegisterCapability requests for workspace/didChangeWatchedFiles all having the same id, globalFileWatches.
The spec for Registration gives
/**
* General parameters to register for a capability.
*/
export interface Registration {
/**
* The id used to register the request. The id can be used to deregister
* the request again.
*/
id: string;
/**
* The method / capability to register for.
*/
method: string;
/**
* Options necessary for the registration.
*/
registerOptions?: LSPAny;
}The id is intended to provide a way to unregister, which means the registration is indexed by this. Most clients will either unregister a pre-existing registration against an id before registering a new one (eglot), or overwrite it.
The registrationParams interface allows multiple watch specs for a single id, so this may be the simplest way to resolve the information.
Debug information
Log excerpt
[jsonrpc] e[16:57:03.693] <-- client/registerCapability[3] {"id":3,"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"globalFileWatches","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/alanz/mysrc/git.haskell.org/worktree/bisect/hie.yaml","kind":7}]}}]}}
[jsonrpc] e[16:57:06.966] --> client/registerCapability[3] {"jsonrpc":"2.0","id":3,"result":null}
[jsonrpc] e[16:57:06.966] <-- client/registerCapability[4] {"id":4,"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"globalFileWatches","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/alanz/mysrc/git.haskell.org/worktree/bisect/.hie-bios/stage0/compiler/build/GHC/Settings/Config.hs","kind":7}]}}]}}
[jsonrpc] e[16:57:10.125] --> client/registerCapability[4] {"jsonrpc":"2.0","id":4,"result":null}
[jsonrpc] e[16:57:10.125] <-- client/registerCapability[5] {"id":5,"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"globalFileWatches","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/home/alanz/mysrc/git.haskell.org/worktree/bisect/.hie-bios/stage0/compiler/build/GHC/Cmm/Lexer.hs","kind":7}]}}]}}
[jsonrpc] e[16:57:13.357] --> client/registerCapability[5] {"jsonrpc":"2.0","id":5,"result":null}