feat(nvim): add golang lsp

This commit is contained in:
matt1432 2025-04-21 02:02:23 -04:00
parent 83bc927a8d
commit 4d6a733a6e
4 changed files with 45 additions and 0 deletions
homeManagerModules/neovim/langs/golang

View file

@ -0,0 +1,39 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
config = mkIf (cfg.enable && cfg.ideConfig.enableGolang) {
programs = {
neovim = {
extraPackages = with pkgs; [go gopls];
plugins = [
{
plugin = pkgs.vimPlugins.clangd_extensions-nvim;
type = "lua";
config =
# lua
''
local lsp = require('lspconfig');
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
lsp.gopls.setup({
cmd = { '${pkgs.gopls}/bin/gopls' },
capabilities = default_capabilities,
});
'';
}
];
};
};
};
# For accurate stack trace
_file = ./default.nix;
}