git/gitsigns: switch to new null-ls sources API

This commit is contained in:
raf 2025-03-29 20:50:34 +03:00
parent 5d2d249a46
commit 43b99474e6
No known key found for this signature in database
GPG key ID: 29D95B64378DB4BF

View file

@ -5,6 +5,7 @@
}: let }: let
inherit (builtins) toJSON; inherit (builtins) toJSON;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault; inherit (lib.nvim.binds) addDescriptionsToMappings mkSetExprBinding mkSetLuaBinding pushDownDefault;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
@ -32,6 +33,7 @@ in {
return '<Ignore>' return '<Ignore>'
end end
'') '')
(mkSetExprBinding gsMappings.previousHunk '' (mkSetExprBinding gsMappings.previousHunk ''
function() function()
if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end if vim.wo.diff then return ${toJSON gsMappings.previousHunk.value} end
@ -77,13 +79,12 @@ in {
} }
(mkIf cfg.codeActions.enable { (mkIf cfg.codeActions.enable {
vim.lsp.null-ls.enable = true; vim.lsp.null-ls = {
vim.lsp.null-ls.sources.gitsigns-ca = '' enable = true;
table.insert( setupOpts.sources.gitsigns-ca = mkLuaInline ''
ls_sources, require("null-ls").builtins.code_actions.gitsigns
null_ls.builtins.code_actions.gitsigns '';
) };
'';
}) })
]); ]);
} }