summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/plugins/lsp/init.lua
diff options
context:
space:
mode:
authorChloƩ Vulquin <code@toast.bunkerlabs.net>2024-08-06 14:11:59 +0200
committerChloƩ Vulquin <code@toast.bunkerlabs.net>2024-08-06 14:11:59 +0200
commit7425eda3e544fcb1ce81a09c5ff49d839e58ac94 (patch)
treee74368e016160f5c7aa5b532b46c9190e21fc32e /dot_config/nvim/lua/plugins/lsp/init.lua
parentnvim: expand .lua gitattributes, mark as non-diffable (diff)
nvim: rework lsp module
There's still some improvements to be made, but this is cleaner. We lose global caps defaults, but those made no sense to begin with. We do also lose caps overrides, I'll add them back in if I need them. In the process, we gain `every?` and `executable?`. There's also a misc comp print vim.inspect to vim.print change.
Diffstat (limited to 'dot_config/nvim/lua/plugins/lsp/init.lua')
-rw-r--r--dot_config/nvim/lua/plugins/lsp/init.lua33
1 files changed, 13 insertions, 20 deletions
diff --git a/dot_config/nvim/lua/plugins/lsp/init.lua b/dot_config/nvim/lua/plugins/lsp/init.lua
index d26a949..2f05e41 100644
--- a/dot_config/nvim/lua/plugins/lsp/init.lua
+++ b/dot_config/nvim/lua/plugins/lsp/init.lua
@@ -1,35 +1,28 @@
-- [nfnl] Compiled from fnl/plugins/lsp/init.fnl by https://github.com/Olical/nfnl, do not edit.
+local _local_1_ = require("toast.core")
+local assoc = _local_1_["assoc"]
+local _local_2_ = require("toast.nvim")
+local executable_3f = _local_2_["executable?"]
local function gopts(plist)
return {clangd = {}, clojure_lsp = {root_dir = plist("project.clj", "deps.edn", "bb.edn", "build.boot", "shadow-cljs.edn", ".git")}, denols = {root_dir = plist("deno.json", "deno.jsonc"), autostart = false}, gopls = {}, ltex = {}, lua_ls = {}, pyright = {}, ruff = {cmd = {"ruff", "server", "--preview"}}, texlab = {filetypes = {"tex", "plaintex", "bib", "latex"}}, tsserver = {root_dir = plist("tsconfig.json", "package.json"), autostart = false}, zls = {}}
end
local attach = require("plugins.lsp.attach")
-local caps = require("plugins.lsp.capabilities")
-local function _1_(_, opts)
+local function _3_(_, opts)
for k, v in pairs(opts) do
- v.on_attach = (attach or v.on_attach)
- if ("table" == type(caps)) then
- v.capabilities = (v.capabilities or caps)
- else
- end
local s = require("lspconfig")[k]
local c = (v.cmd or s.document_config.default_config.cmd)
- if (0 ~= vim.fn.executable(c[1])) then
- s.setup(v)
+ local att = (attach or v.on_attach)
+ if executable_3f(c[1]) then
+ s.setup(assoc(v, "on_attach", att))
else
end
end
return nil
end
-local function _4_()
- local plist
- local function _5_(...)
- local p = require("lspconfig.util").root_pattern(...)
- local function _6_(_241)
- return p(_241)
- end
- return _6_
+local function _5_()
+ local function _6_(...)
+ return require("lspconfig.util").root_pattern(...)
end
- plist = _5_
- return gopts(plist)
+ return gopts(_6_)
end
-return {{"neovim/nvim-lspconfig", config = _1_, opts = _4_}}
+return {{"neovim/nvim-lspconfig", config = _3_, opts = _5_}}