-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current LSP backend is not compositional #42
Comments
After having implemented quite a few LSP features I can give some feedback on this. In a nutshell, I don't know what a compositional asai lsp handler would look like. Any serious language server implementation would need to do so much custom stuff that I don't know if it makes sense for the asai library to contain the main loop. I think that asai should ship with the Now granted, the current lsp implementation contains a lot of useful code, but I think it makes sense to publish this separately. |
For some context: the original design I had for Asai had it tracking arbitrary source-span related information, not just diagnostics. The idea was the |
One possible point in the design space is to factor out the Tying it all back into an LSP server would be tricky though. I see a couple of options:
Lsp_core.default_handlers @@ fun () -> (* Big effect handler that ignores all messages we haven't handled already *)
Lsp_declarations.handle_hover @@ fun () ->
Lsp_identifiers.handle_goto_definition @@ fun () ->
Lsp_asai.handle_diagnostics @@ fun () ->
Lsp_core.run_event_loop
... (* All the stuff that actually does file loading etc goes here *) |
In that case, I think that this goal has (to some extent) been achieved. We keep track of location info up until the final phase of compilation, and it allows me to write, say, a document symbols handler like this: |
It should be noted that autocompletion, semantic tokens, document synchronization, go to definition/declaration, find references, hover, etc. are all out of the scope of
asai
. The current LSP backend is exclusive and makes it difficult to create an LSP server that has error reporting and other features. This has to be changed.The text was updated successfully, but these errors were encountered: