Skip to content
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

Unbundle LSP.Sever #417

Open
michaelpj opened this issue Apr 8, 2022 · 1 comment
Open

Unbundle LSP.Sever #417

michaelpj opened this issue Apr 8, 2022 · 1 comment
Labels
v3 Next really big release

Comments

@michaelpj
Copy link
Collaborator

At the moment LSP.Sever is "framework-like": you provide various kinds of functions via the monolithic SeverDefinition, and then the server framework is responsible for calling them. This has some warts:

  • It is unclear what is handled by the framework and what isn't (see e.g. Changing the configuration after workspace/didChangeConfiguration requests #414)
  • It is difficult to customize parts of the behaviour
    • A big example is the message dispatch loop. Our "reactor" example is (IMO) godawful: you have to override the handlers in order to sneak in some custom dispatch logic. ghcide similarly tries to completely bypass this. (Also see e.g. Concurrent handling of lsp handlers #409)
    • Another example is whether or not to feed the intializationOptions to the configuration changed function. This isn't specified in the spec, but some clients expect it, so it's really something the server author should decide about, not us.
  • It is difficult to mange state differently. For example, HLS wants to delay updates to the VFS so that long-running processes don't see inconsistent states. To do this they have to implement a complete second layer which takes VFS snapshots!

Here's some ideas for how to unbundle this:

  • Modularise the server in/out into IO actions that communicate over a channel, which clients can fork as they like.
  • Modularise the initialization handlers so we provide a number of standard handlers which do common actions and which can be combined with <>.
  • Modularise state accesses so that they access the state via a typeclass, allowing multiple implementations.
  • More?

Big questions:

  • Is this a good direction of travel?
  • Are there going to be any bits that will be really difficult?
@michaelpj
Copy link
Collaborator Author

@wz1000 thoughts?

@michaelpj michaelpj added the v3 Next really big release label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 Next really big release
Projects
None yet
Development

No branches or pull requests

1 participant