fwcd / curry-language-server

IDE support for the functional logic language Curry
BSD 3-Clause "New" or "Revised" License
27 stars 2 forks source link

Display initialization progress and index asynchronously #24

Closed fwcd closed 3 weeks ago

fwcd commented 3 years ago

This causes e.g. VSCode to display initialization progress in the status bar. This PR also moves the indexing to a forkIO thread, since otherwise the progress will not show up.

image

In the future we may also consider displaying more fine-grained progress.

One problem with asynchronous initialization is that the client will eagerly emit errors while the modules are still compiling (unless a .curry/language-server directory with previously compiled artifacts already exists):

image

Hence why this PR is marked as a draft for now.

fwcd commented 3 weeks ago

Alternatively we could also look into LSP/VSCode's support for progress reporting during initialization, which requires using the progress token provided in the initialize params: https://hackage.haskell.org/package/lsp-types-2.3.0.0/docs/Language-LSP-Protocol-Types.html#t:InitializeParams

For that it would probably also make sense to move out all of our heavy lifting (compiling/indexing) from the initialized notification handler to doInitialize, where we can actually access these params. This could be done in a separate PR, essentially we'd just have to migrate the function signature of initializedHandler to whatever doInitialize expects and then remove the handler from the notification handlers.