zeroc-ice / vscode-slice

Slice syntax highlighter for Visual Studio Code
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Move All Configuration Loading into `initialize` #31

Closed InsertCreativityHere closed 9 months ago

InsertCreativityHere commented 9 months ago

This PR simplifies the server's initialization process.

Initialization starts when the client sends an initialize request, the server responds, and finally the client sends initialized to acknowledge everything is good to go.

But the initialization of our server is split between these two functions. We pass in some of the config during initialize, then in initialized we request the remaining configuration from the client.

This split approach means:


This PR changes this so all the initialization is done up front, in one-shot. The client now sends all it's configuration in the first initialize request, so the server can fully initialize itself then.

We still receive the initialized request, because the server waits for it before sending diagnostics back. Because it's unsound to send arbitrary data to the client before everyone is initialized and ready for it.


I remember talking about the nuance around these functions, and there's a comment that alludes that "the client might not be ready to send it's config". Reading the spec sounds like this PR is the right way to go though, and I've tested it on my machine to no issues. If anyone has any insight (or testing capabilities to offer!), I welcome it.

But currently, all our configuration just comes right out of settings.json, which is known and loaded by the time the extension starts. It has to be, because that's how we check if the server is enabled at all.