digama0 / mm0

Metamath Zero specification language
Creative Commons Zero v1.0 Universal
315 stars 40 forks source link

make server aware of vscode options, add better elab on save option #55

Closed ammkrn closed 3 years ago

ammkrn commented 3 years ago

The first commit makes the server aware of the options tracked by the vscode extension. when server::run gets called, it makes an initial request for the user's stored preferences, and after that it will ask for them again when it gets a notification of an update. According to this issue you're not supposed to/able to get the actual config contents by using the change notification, hence the two-step process.

The struct/enum approach for the options is a little bit heavy, but I think in conjunction with the serde macros it's less error prone.

The second commit is a rework of the elaborate on save thing that applies changes eagerly (and can now be toggled in the vscode extension settings for Metamath Zero). The two window/workspace edge case works fine this way. I left it so that hover will always elaborate since it needs the spans to match what users are seeing, but I changed document_symbol and completion_resolve to try and fetch an old environment iff the user wants to elaborate on save, since they trigger often enough to negate the usefulness of elab on save otherwise.