feat: add lspconfig support, with wrapped lsp's

This commit is contained in:
Guz
2024-12-05 19:26:15 -03:00
parent 26793ef834
commit 19b1f317b1
2 changed files with 51 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
local lsps = {
["lua_ls"] = {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then
return
end
end
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
},
},
})
end,
settings = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
},
}
return {
"nvim-lspconfig",
after = function()
local lsp = require("lspconfig")
for k, v in pairs(lsps) do
lsp[k].setup(v)
end
end,
}

View File

@@ -12,6 +12,7 @@
catppuccin-nvim
indent-blankline-nvim
lze
nvim-lspconfig
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
nvim-treesitter-textsubjects
@@ -32,6 +33,10 @@
tmux-nvim
];
languageServers = with pkgs; [
lua-language-server
];
foldPlugins = builtins.foldl' (acc: next: acc ++ [next] ++ (foldPlugins (next.dependencies or []))) [];
startPluginsWithDeps = lib.unique (foldPlugins startPlugins);
@@ -76,7 +81,12 @@ in
name = "neovim-custom";
pname = "nvim";
paths = [nvimPkg];
paths = let
wrappedNvim = pkgs.writeShellScriptBin "nvim" ''
export PATH=${lib.makeBinPath languageServers}:$PATH
${lib.getExe nvimPkg} "$@"
'';
in [wrappedNvim];
nativeBuildInputs = [makeWrapper];
postBuild = ''
wrapProgram $out/bin/nvim \