mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-10 01:04:34 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
|
@ -5,85 +5,86 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lspkind;
|
||||
in {
|
||||
options.plugins.lspkind =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
in
|
||||
{
|
||||
options.plugins.lspkind = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||
|
||||
mode =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["text" "text_symbol" "symbol_text" "symbol"]
|
||||
"symbol_text"
|
||||
"Defines how annotations are shown";
|
||||
mode = helpers.defaultNullOpts.mkEnum [
|
||||
"text"
|
||||
"text_symbol"
|
||||
"symbol_text"
|
||||
"symbol"
|
||||
] "symbol_text" "Defines how annotations are shown";
|
||||
|
||||
preset = helpers.defaultNullOpts.mkEnum ["default" "codicons"] "codicons" "Default symbol map";
|
||||
preset = helpers.defaultNullOpts.mkEnum [
|
||||
"default"
|
||||
"codicons"
|
||||
] "codicons" "Default symbol map";
|
||||
|
||||
symbolMap = helpers.mkNullOrOption (types.attrsOf types.str) "Override preset symbols";
|
||||
symbolMap = helpers.mkNullOrOption (types.attrsOf types.str) "Override preset symbols";
|
||||
|
||||
cmp = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Integrate with nvim-cmp";
|
||||
};
|
||||
|
||||
maxWidth =
|
||||
helpers.mkNullOrOption types.int
|
||||
"Maximum number of characters to show in the popup";
|
||||
|
||||
ellipsisChar =
|
||||
helpers.mkNullOrOption types.str
|
||||
"Character to show when the popup exceeds maxwidth";
|
||||
|
||||
menu = helpers.mkNullOrOption (types.attrsOf types.str) "Show source names in the popup";
|
||||
|
||||
after =
|
||||
helpers.mkNullOrOption types.str
|
||||
"Function to run after calculating the formatting. function(entry, vim_item, kind)";
|
||||
cmp = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Integrate with nvim-cmp";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
|
||||
options =
|
||||
{
|
||||
inherit (cfg) mode preset;
|
||||
symbol_map = cfg.symbolMap;
|
||||
}
|
||||
// (
|
||||
if doCmp
|
||||
then {
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
inherit (cfg.cmp) menu;
|
||||
maxWidth = helpers.mkNullOrOption types.int "Maximum number of characters to show in the popup";
|
||||
|
||||
ellipsisChar = helpers.mkNullOrOption types.str "Character to show when the popup exceeds maxwidth";
|
||||
|
||||
menu = helpers.mkNullOrOption (types.attrsOf types.str) "Show source names in the popup";
|
||||
|
||||
after = helpers.mkNullOrOption types.str "Function to run after calculating the formatting. function(entry, vim_item, kind)";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
|
||||
options =
|
||||
{
|
||||
inherit (cfg) mode preset;
|
||||
symbol_map = cfg.symbolMap;
|
||||
}
|
||||
else {}
|
||||
)
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
// (
|
||||
if doCmp then
|
||||
{
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
inherit (cfg.cmp) menu;
|
||||
}
|
||||
else
|
||||
{ }
|
||||
)
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = optionalString (!doCmp) ''
|
||||
require('lspkind').init(${helpers.toLuaObject options})
|
||||
'';
|
||||
|
||||
plugins.cmp.settings.formatting.format =
|
||||
if cfg.cmp.after != null
|
||||
then ''
|
||||
function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||
if cfg.cmp.after != null then
|
||||
''
|
||||
function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||
|
||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||
end
|
||||
''
|
||||
else ''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
'';
|
||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||
end
|
||||
''
|
||||
else
|
||||
''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue