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

Support multiple language servers per filetype #17

Closed
ul opened this issue Apr 30, 2018 · 12 comments · Fixed by #686
Closed

Support multiple language servers per filetype #17

ul opened this issue Apr 30, 2018 · 12 comments · Fixed by #686
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ul
Copy link
Collaborator

ul commented Apr 30, 2018

Use case: for javascript files I want diagnostics from both eslint and flow language servers.

@ul ul added the enhancement New feature or request label May 19, 2018
@EmmChriss
Copy link

Contextual language recognition would be practically impossible, but a comment-based approach could be feasible

@gbrlsnchs
Copy link
Contributor

This would enable using diagnostic-languageserver to lint code and also run formatters not supported by LSP servers themselves.

@perpen
Copy link

perpen commented Oct 28, 2019

Or could we make a "proxy" language server, which kak-lsp talks to, and that interacts with potentially multiple language servers?

@ul ul added the help wanted Extra attention is needed label Jan 29, 2020
@ul
Copy link
Collaborator Author

ul commented Jan 29, 2020

The proxy solution has benefits that it potentially could be re-used outside of kak-lsp. We need to draft how is it supposed to behave, i.e. merge strategies for various responses etc.

@joefiorini
Copy link

I know this issue is a little stale, but I just found a project that proxies to multiple language servers. Has anyone tried this?

@sclu1034
Copy link
Contributor

As far as I can tell, that project's purpose is to create a websocket interface for language servers that don't support one themselves.
I don't see anything about this that would enable running different language servers against a single file simultaneously.

@krobelus
Copy link
Member

I know this issue is a little stale

I think it's still a good idea, especially considering that VSCode already supports that (it can display diagnostics from multiple language servers, for example).

I don't see anything about this that would enable running different language servers against a single file simultaneously.

Right, it looks like this project only forwards requests to one language server.

We need something that forwards one request to (potentially) multiple servers. I like to call it language-server-tee like the tee command.
It only needs to support stdio mode for kak-lsp, not TCP.

Merging strategies can get a bit complicated, but if we start by showing the union of all diagnostics (and take everything else only from a "primary" language server) that sounds easy and could already be good enough?

@gbrlsnchs
Copy link
Contributor

We need something that forwards one request to (potentially) multiple servers.

Wouldn't that imply having to provide the same set of configurations from an individual language server to this "sink" language server as well? This feels a little redundant.

Also, this strategy would leave the responsibility of managing processes up to the sink server, which is not always desired.

I think this would only be useful for kak-lsp while it doesn't support multiple servers, but I don't see value for other projects. Other editors like Neovim and Emacs already support multiple language servers at a client level, which IMO is a sane long-term decision.

If we consider a client-level approach, what are the current blockers that make supporting multiple language servers unviable in kak-lsp?

@krobelus
Copy link
Member

krobelus commented Nov 14, 2022 via email

@raiguard
Copy link
Contributor

Adding my usecase: I run lua-language-server for my Factorio modding projects. A fellow modder recently released a small language server for Factorio's locale system, which includes autocomplete of localised strings in Lua code. I currently can't run both servers at once in Lua files.

@krobelus
Copy link
Member

looks like someone implemented the proxy language server, see https://github.com/messense/multi-lsp-proxy
haven't tried it yet

@gbrlsnchs
Copy link
Contributor

gbrlsnchs commented Jun 10, 2023

Anyone here willing to try #686? It shouldn't be too hard to set up a multi-language config (there's an example in the PR description).

krobelus pushed a commit to gbrlsnchs/kak-lsp that referenced this issue Oct 29, 2023
Today, kak-lsp.toml maps language IDs to language servers.
Each filetype is assigned one language ID, which in turn is assigned one server.
For example,

	[language.typescriptreact]
	filetypes = ["javascript", "typescript"]
	command = "my-language-server"

assigns filetypes "javascript" and "typescript" to language ID
"typescriptreact" and one language server.

Allow multiple language servers per filetype.
This looks like

	[language_server.my-language-server1]
	filetypes = ["javascript", "typescript"]
	[language_server.my-language-server2]
	filetypes = ["javascript", "typescript"]

The`my-language-server1` part is no longer the language ID (which is
required by LSP) but the unique (but arbitrary) server name.
The language ID defaults to the filetype; add new top-level
`language_ids` for cases where they do not match. For example,

	[language_ids]
	javascript = "javascriptreact"
	typescript = "typescriptreact"

The old configuration syntax is still supported for now (but not
tested much).

Closes kakoune-lsp#17
krobelus pushed a commit to gbrlsnchs/kak-lsp that referenced this issue Oct 29, 2023
Today, kak-lsp.toml maps language IDs to language servers.
Each filetype is assigned one language ID, which in turn is assigned one server.
For example,

	[language.typescriptreact]
	filetypes = ["javascript", "typescript"]
	command = "my-language-server"

assigns filetypes "javascript" and "typescript" to language ID
"typescriptreact" and one language server.

Allow multiple language servers per filetype.
This looks like

	[language_server.my-language-server1]
	filetypes = ["javascript", "typescript"]
	[language_server.my-language-server2]
	filetypes = ["javascript", "typescript"]

The`my-language-server1` part is no longer the language ID (which is
required by LSP) but the unique (but arbitrary) server name.
The language ID defaults to the filetype; add new top-level
`language_ids` for cases where they do not match. For example,

	[language_ids]
	javascript = "javascriptreact"
	typescript = "typescriptreact"

The old configuration syntax is still supported for now (but not
tested much).

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>

Closes kakoune-lsp#17
krobelus pushed a commit that referenced this issue Oct 29, 2023
Today, kak-lsp.toml maps language IDs to language servers.
Each filetype is assigned one language ID, which in turn is assigned one server.
For example,

	[language.typescriptreact]
	filetypes = ["javascript", "typescript"]
	command = "my-language-server"

assigns filetypes "javascript" and "typescript" to language ID
"typescriptreact" and one language server.

Allow multiple language servers per filetype.
This looks like

	[language_server.my-language-server1]
	filetypes = ["javascript", "typescript"]
	[language_server.my-language-server2]
	filetypes = ["javascript", "typescript"]

The`my-language-server1` part is no longer the language ID (which is
required by LSP) but the unique (but arbitrary) server name.
The language ID defaults to the filetype; add new top-level
`language_ids` for cases where they do not match. For example,

	[language_ids]
	javascript = "javascriptreact"
	typescript = "typescriptreact"

The old configuration syntax is still supported for now (but not
tested much).

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>

Closes #17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants