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

[Request] Easier configuring LSP server after initialization #89

Open
ghost opened this issue Feb 9, 2024 · 3 comments
Open

[Request] Easier configuring LSP server after initialization #89

ghost opened this issue Feb 9, 2024 · 3 comments

Comments

@ghost
Copy link

ghost commented Feb 9, 2024

Currently, if you want to configure something at runtime (eg; change the command for a specific project) you need to do something like this in your .lite_project.lua

local lsp = require "plugins.lsp"
lsp.servers.server_name.option = value

Real world example of adding another path to Jedi's init_options:

local lsp = require "plugins.lsp"
lsp.servers.jedi.init_options.workspace.extraPaths[2] = "foo"

I think it would be easier if you could configure things using lspconfig, something like this:

local lspconfig = require "plugins.lsp.config"
lspconfig.jedi.init_options.workspace.extraPaths[2] = "foo"

instead of digging through the code to find how to configure settings

@ghost ghost changed the title [Request] Configuring LSP server using project module [Request] Easier configuring LSP server after initialization Feb 9, 2024
@Guldoman
Copy link
Member

Guldoman commented Feb 9, 2024

What do you think about adding a function to retrieve a server table by name?
Mostly because lspconfig only contains the "preconfigured" servers, and it wouldn't contain anything added directly via lsp.add_server.

So something like

local sumneko = lsp.get_server_by_name("lua-language-server")
sumneko.settings.Lua.signatureHelp.enable = false

Or even something like

lsp.update_server_config("lua-language-server", {
  settings = {
    Lua = {
      signatureHelp = { enable = false }
    }
  }
})

@ghost
Copy link
Author

ghost commented Feb 9, 2024

yeah that seems much better, I proposed lspconfig because it looked like the most obvious place to configure LSP servers

@Guldoman
Copy link
Member

Guldoman commented Feb 9, 2024

Until the end of the month I won't be able to implement this as I don't have much time.
Until then, anyone that wants to give this a try, I'd be glad to review and merge their proposal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant