lsp: Wait for client to send initialized at boot#1909
lsp: Wait for client to send initialized at boot#1909charlieegan3 merged 1 commit intoopen-policy-agent:mainfrom
Conversation
Now the server will wait for the client to send the initialized (empty) message before starting work. Previously we got away with sending diagnostics but now we have a custom test location handler, we need to ensure that we wait for that to be registered before sending test location notifications. So we have moved the load workspace contents to the post initialized state, and added a gate to block the test locations worker from running if the client does not support it. Signed-off-by: Charlie Egan <charlie_egan@apple.com>
a9217d9 to
202dd59
Compare
anderseknert
left a comment
There was a problem hiding this comment.
Code looks good to me. Are there any undesirable side-effects of doing this? Like slower init time? Is this what we should have done all the time?
|
I think this is what we should have done all the time and it is what others like gopls do. That said, it's not super clear, and is phrased more in terms of client responsibility than server.
|
|
It so happened that clients were able to accept diagnostics before the initialized message was sent back, so yes, this is a little slower. |
|
Thanks @charlieegan3 👍 |
Now the server will wait for the client to send the initialized (empty) message before starting work. Previously we got away with sending diagnostics but now we have a custom test location handler, we need to ensure that we wait for that to be registered before sending test location notifications.
So we have moved the load workspace contents to the post initialized state, and added a gate to block the test locations worker from running if the client does not support it.