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

How would I configure this with nvim built-in LSP client? #43

Open
mrjones2014 opened this issue Sep 1, 2021 · 2 comments
Open

How would I configure this with nvim built-in LSP client? #43

mrjones2014 opened this issue Sep 1, 2021 · 2 comments

Comments

@mrjones2014
Copy link

Any idea how I'd integrate this with the neovim built-in LSP?

I'm using lspconfig, but they only have a config for the sumneko Lua lsp, which IMHO is far too complex to set up just to get an LSP (you have to install several dependencies and build from source).

I'd much prefer to use this one, but I'm not sure how to configure it with the neovim built-in LSP?

@Alloyed
Copy link
Owner

Alloyed commented Sep 6, 2021

So just as a caveat, I haven't been updating this package that often, or even using it more than on weekends! Sumneko's package is better maintained, has more features, and all that good stuff.

That said: I looked really quickly at how the native LSP system works and supporting it seems pretty easy, even without making upstream changes. The official docs make use of a "cmd" parameter, since we don't use any weird configs and neither does sumneko's server, this means they are totally interchangeable on that level. just swap out the sumneko binary with a call to your lua-lsp command.

so in this example:

https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#sumneko_lua

we can just swap the entire cmd to something like so

local lua_lsp_binary = "<>" -- call `which lua-lsp` on your machine and paste the result here, or do something more complicated like the original example
require'lspconfig'.sumneko_lua.setup {
  cmd = {lua_lsp_binary};
  settings = {},
  },
}

In terms of other things that example configures, like package.path, we use a .luacompleterc file to provide the same environment info: https://github.com/dapetcu21/atom-autocomplete-lua#configuration

@mrvon
Copy link

mrvon commented Feb 7, 2022

I switch to lua-lsp since Sumneko's version haven't respected luacheck.
Your tips is really helpful, Thank you @Alloyed

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

3 participants