Merge branch 'main' into fzf-lua-fix

This commit is contained in:
Ching Pei Yang 2025-04-05 15:54:09 +02:00 committed by GitHub
commit 6e82a568f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 83 additions and 52 deletions

View file

@ -4,6 +4,7 @@
pkgs,
...
}: let
inherit (lib.generators) mkLuaInline;
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString;
@ -28,6 +29,25 @@ in {
sourcePlugins = ["cmp-nvim-lsp"];
};
autocmds =
if cfg.inlayHints.enable
then [
{
callback = mkLuaInline ''
function(event)
local bufnr = event.buf
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
end
end
'';
desc = "LSP on-attach enable inlay hints autocmd";
event = ["LspAttach"];
}
]
else [];
pluginRC.lsp-setup = ''
vim.g.formatsave = ${boolToString cfg.formatOnSave};

View file

@ -5,6 +5,9 @@ in {
options.vim.lsp = {
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
formatOnSave = mkEnableOption "format on save";
inlayHints = {
enable = mkEnableOption "inlay hints";
};
mappings = {
goToDefinition =
mkMappingOption "Go to definition"