Compare commits

..

No commits in common. "8ad6233c41e2733cc42831517fae07eb844ba939" and "053ca39e102f7872ff85ebbb3bc15362578b1b18" have entirely different histories.

3 changed files with 46 additions and 22 deletions

View file

@ -246,7 +246,7 @@ inputs: let
}; };
presence = { presence = {
neocord.enable = false; neocord.enable = true;
}; };
}; };
}; };

View file

@ -58,7 +58,7 @@ in rec {
# Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first # Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first
luaTable = items: ''{${concatStringsSep "," items}}''; luaTable = items: ''{${concatStringsSep "," items}}'';
isLuaInline = object: (object._type or null) == "lua-inline"; isLuaInline = {_type ? null, ...}: _type == "lua-inline";
toLuaObject = args: toLuaObject = args:
if isAttrs args if isAttrs args

View file

@ -7,8 +7,8 @@
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.attrsets) mapAttrs; inherit (lib.attrsets) mapAttrs;
inherit (lib.strings) toUpper; inherit (lib.strings) toUpper;
inherit (lib.types) int float bool str enum listOf attrsOf anything; inherit (lib.types) int float bool str enum listOf attrsOf;
inherit (lib.nvim.types) mkPluginSetupOption luaInline; inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
in { in {
imports = [ imports = [
@ -42,14 +42,30 @@ in {
type = bool; type = bool;
default = false; default = false;
}; };
clear_on_detach = mkOption {
description = "Clear notification group when LSP server detaches";
type = bool;
default = true;
apply = clear:
if clear
then
mkLuaInline ''
function(client_id)
local client = vim.lsp.get_client_by_id(client_id)
return client and client.name or nil
end
''
else null;
};
notification_group = mkOption { notification_group = mkOption {
description = "How to get a progress message's notification group key"; description = "How to get a progress message's notification group key";
type = luaInline; type = str;
default = mkLuaInline '' default = ''
function(msg) function(msg)
return msg.lsp_client.name return msg.lsp_client.name
end end
''; '';
apply = mkLuaInline;
}; };
ignore = mkOption { ignore = mkOption {
description = "Ignore LSP servers by name"; description = "Ignore LSP servers by name";
@ -156,29 +172,33 @@ in {
}; };
format_message = mkOption { format_message = mkOption {
description = "How to format a progress message"; description = "How to format a progress message";
type = luaInline; type = str;
default = mkLuaInline '' default = ''
require("fidget.progress.display").default_format_message require("fidget.progress.display").default_format_message
''; '';
apply = mkLuaInline;
}; };
format_annote = mkOption { format_annote = mkOption {
description = "How to format a progress annotation"; description = "How to format a progress annotation";
type = luaInline; type = str;
default = mkLuaInline '' default = ''
function(msg) return msg.title end function(msg) return msg.title end
''; '';
apply = mkLuaInline;
}; };
format_group_name = mkOption { format_group_name = mkOption {
description = "How to format a progress notification group's name"; description = "How to format a progress notification group's name";
type = luaInline; type = str;
default = mkLuaInline '' default = ''
function(group) return tostring(group) end function(group) return tostring(group) end
''; '';
apply = mkLuaInline;
}; };
overrides = mkOption { overrides = mkOption {
description = "Override options from the default notification config"; description = "Override options from the default notification config";
type = attrsOf (attrsOf anything); type = attrsOf str;
default = {rust_analyzer = {name = "rust-analyzer";};}; default = {rust_analyzer = "{ name = 'rust-analyzer' }";};
apply = mapAttrs (key: lua: mkLuaInline lua);
}; };
}; };
@ -220,19 +240,21 @@ in {
}; };
configs = mkOption { configs = mkOption {
description = "How to configure notification groups when instantiated"; description = "How to configure notification groups when instantiated";
type = attrsOf luaInline; type = attrsOf str;
default = {default = mkLuaInline "require('fidget.notification').default_config";}; default = {default = "require('fidget.notification').default_config";};
apply = mapAttrs (key: lua: mkLuaInline lua);
}; };
redirect = mkOption { redirect = mkOption {
description = "Conditionally redirect notifications to another backend"; description = "Conditionally redirect notifications to another backend";
type = luaInline; type = str;
default = mkLuaInline '' default = ''
function(msg, level, opts) function(msg, level, opts)
if opts and opts.on_open then if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts) return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
end end
end end
''; '';
apply = mkLuaInline;
}; };
view = { view = {
@ -258,12 +280,13 @@ in {
}; };
render_message = mkOption { render_message = mkOption {
description = "How to render notification messages"; description = "How to render notification messages";
type = luaInline; type = str;
default = mkLuaInline '' default = ''
function(msg, cnt) function(msg, cnt)
return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg) return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
end end
''; '';
apply = mkLuaInline;
}; };
}; };
@ -363,10 +386,11 @@ in {
}; };
path = mkOption { path = mkOption {
description = "Where Fidget writes its logs to"; description = "Where Fidget writes its logs to";
type = luaInline; type = str;
default = mkLuaInline '' default = ''
string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache")) string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache"))
''; '';
apply = mkLuaInline;
}; };
}; };
}; };