aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-07-03 19:15:45 +0200
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2023-07-03 19:15:45 +0200
commit73460ffcdd764556bc3b683f5c14a6846ef48d9a (patch)
tree80a7a2d97d53c5e53ce100959a377bf290e30b53 /lua
parent850f49dee880c6881c53c1decbb6aedf857fec1f (diff)
downloadnvim-conf-73460ffcdd764556bc3b683f5c14a6846ef48d9a.tar.gz
nvim-conf-73460ffcdd764556bc3b683f5c14a6846ef48d9a.zip
update servers to support nixos binaries
Diffstat (limited to 'lua')
-rw-r--r--lua/alpha/lsp/init.lua6
-rw-r--r--lua/alpha/lsp/mason.lua3
-rw-r--r--lua/alpha/lsp/servers.lua24
3 files changed, 25 insertions, 8 deletions
diff --git a/lua/alpha/lsp/init.lua b/lua/alpha/lsp/init.lua
index d280e53..03bd61d 100644
--- a/lua/alpha/lsp/init.lua
+++ b/lua/alpha/lsp/init.lua
@@ -1,14 +1,12 @@
-- LSP configuration
--- install servers and tools
-require "alpha.lsp.mason"
-
local lspconfig = require "lspconfig"
local servers = require "alpha.lsp.servers"
-
for server, setup in pairs(servers) do
lspconfig[server].setup(setup())
end
+-- install servers and tools
+require "alpha.lsp.mason"
require "alpha.lsp.null-ls"
diff --git a/lua/alpha/lsp/mason.lua b/lua/alpha/lsp/mason.lua
index 6948454..161a205 100644
--- a/lua/alpha/lsp/mason.lua
+++ b/lua/alpha/lsp/mason.lua
@@ -7,9 +7,8 @@ mason.setup()
local mason_servers = {}
--- TODO: can be improve checking the setup function to see if sets the cmd
for server, _ in pairs(servers) do
- local cmd = lspconfig[server].document_config.default_config.cmd[1]
+ local cmd = lspconfig[server].cmd[1]
if vim.fn.executable(cmd) == 0 then
table.insert(mason_servers, server)
end
diff --git a/lua/alpha/lsp/servers.lua b/lua/alpha/lsp/servers.lua
index 926ed7e..028b4b2 100644
--- a/lua/alpha/lsp/servers.lua
+++ b/lua/alpha/lsp/servers.lua
@@ -28,8 +28,28 @@ return {
flags = lsp_flags,
}
end,
- ["html"] = default,
- ["jsonls"] = default,
+ ["html"] = function ()
+ local config = {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ }
+ if vim.fn.executable("html-languageserver") == 1 then
+ config.cmd = { "html-languageserver", "--stdio" }
+ end
+
+ return config
+ end,
+ ["jsonls"] = function ()
+ local config = {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ }
+ if vim.fn.executable("json-languageserver") == 1 then
+ config.cmd = { "json-languageserver", "--stdio" }
+ end
+
+ return config
+ end,
["lua_ls"] = function()
return {
on_attach = lsp_attach,