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

Cross server communication #2062

Open
ecstrema opened this issue Nov 26, 2024 · 1 comment
Open

Cross server communication #2062

ecstrema opened this issue Nov 26, 2024 · 1 comment
Labels
feature-request Request for new features or functionality
Milestone

Comments

@ecstrema
Copy link

The current state of inter lsp servers communication leaves much to be desired. Indeed there are embedded language services and request forwarding, but these

  • Are for embedded contents
  • Are not LSP client agnostic (require the use of vscode APIs)

Since the goal of the LSP is to provide access to any language's parsed and analyzed content in a standard way, I believe that it should be the language server's job to get all the information it needs through the other language servers.

Possible solutions

  1. Get the running LSP server addresses with their corresponding language.
  • During initialization, the server says it will need access to the LSP server for languageID.
  • The client sends the other language's server address in every request.
  • The server can then fetch this other server for all the data it needs.
  1. The data is requested through the client, which acts as a Proxy.
  • A method from the server can be forwarded to the other language server, by sending an englobing request:
{
  method: "forward/css", // or any other language id
  params: {
    method: "some/forwarded/method",
    params: {
      // ...
    }
}

With this solution, two servers can communicate one with the other without having to implement any of the client functionality.

Examples

VHDL <-> Verilog <-> System Verilog

These can be used together without bindings, and language servers fail to resolve available variables coming from other languages, even though they are available. This would be fixed by asking the other language servers for the variables they export.

JS <- JSON

Currently, AFAIK there is no JSON LSP, but reading JSON is embedded into the JS LSP. That means when a json file is imported, we get autocompletion for its data from within JS.

However, did we have a language server specifically for JSON, there would be no way to get the available keys for the JS LSP server, without it reimplementing the JS functionality.

The case of all bindings based inter language communication:

All of these break the single source of truth principle by creating bindings, but at least they get editor auto complete. This may be a viable option for some languages, but definitely not for all.

... To be continued, will write more tomorrow.

@dbaeumer
Copy link
Member

Easiest implementation to allow servers to send language model requests to the client which then can do the routing.

@dbaeumer dbaeumer added the feature-request Request for new features or functionality label Dec 18, 2024
@dbaeumer dbaeumer added this to the Backlog milestone Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants