nix-community.nixvim/modules/lsp/default.nix
Matt Sturgeon a45b5f372f modules/lsp: add onAttach option
Similar to `plugins.lsp.onAttach`, implement a "global" equivalent to
the per-server `on_attach` callback.

This is implemented using a `LspAttach` autoCmd.
2025-05-06 14:08:03 +01:00

37 lines
666 B
Nix

{ lib, config, ... }:
let
cfg = config.lsp;
in
{
options.lsp = {
luaConfig = lib.mkOption {
type = lib.types.pluginLuaConfig;
default = { };
description = ''
Lua code configuring LSP.
'';
};
inlayHints = {
enable = lib.mkEnableOption "inlay hints globally";
};
};
imports = [
./servers
./keymaps.nix
./on-attach.nix
];
config = {
lsp.luaConfig.content = lib.mkIf cfg.inlayHints.enable "vim.lsp.inlay_hint.enable(true)";
extraConfigLua = lib.mkIf (cfg.luaConfig.content != "") ''
-- LSP {{{
do
${cfg.luaConfig.content}
end
-- }}}
'';
};
}