mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 01:08:43 +02:00
lib/helpers: add defaultNullOpts.mkSeverity
This commit is contained in:
parent
86508ced91
commit
e49bec3901
1 changed files with 31 additions and 0 deletions
|
@ -165,6 +165,37 @@ with lib; rec {
|
|||
${desc}
|
||||
${defaultDesc}
|
||||
'');
|
||||
mkSeverity = default: desc:
|
||||
mkOption {
|
||||
type = with types;
|
||||
nullOr
|
||||
(
|
||||
either ints.unsigned
|
||||
(
|
||||
enum
|
||||
["error" "warn" "info" "hint"]
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
apply =
|
||||
mapNullable
|
||||
(
|
||||
value:
|
||||
if isInt value
|
||||
then value
|
||||
else mkRaw "vim.diagnostic.severity.${strings.toUpper value}"
|
||||
);
|
||||
description = let
|
||||
defaultDesc = "default: `${toString default}`";
|
||||
in
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
'';
|
||||
};
|
||||
|
||||
mkHighlight = default: name: desc:
|
||||
mkNullable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue