plugins/conform: change state semantics
Didn't realize `darwinOnly` didn't actually warn/fail install on linux only. It just passes a state message to the auto-install function. Change the state function to automatically handle the expected condition.
This commit is contained in:
parent
ed0424f0b0
commit
9077e2f2bc
3 changed files with 13 additions and 3 deletions
|
|
@ -23,7 +23,12 @@ rec {
|
|||
name:
|
||||
let
|
||||
permittedNames = lib.optionals (lib.isAttrs configuredFormatters) (attrNames configuredFormatters);
|
||||
stateList = map (state: lib.fix (lib.toFunction state)) (attrValues states);
|
||||
stateList = lib.pipe states [
|
||||
attrValues
|
||||
(map lib.toFunction)
|
||||
(map (fn: fn null))
|
||||
(filter isString)
|
||||
];
|
||||
isState =
|
||||
maybePackage:
|
||||
lib.throwIf (isFunction maybePackage) "The '${name}' conform-nvim formatter package is a function" (
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ with pkgs;
|
|||
let
|
||||
states = {
|
||||
broken = _package: "broken";
|
||||
darwinOnly = _package: "Darwin only";
|
||||
darwinOnly = p: if stdenv.hostPlatform.isDarwin then p else "Darwin only";
|
||||
unpackaged = "unpackaged";
|
||||
};
|
||||
in
|
||||
|
|
|
|||
|
|
@ -11,7 +11,12 @@
|
|||
formatter-packages
|
||||
states
|
||||
;
|
||||
stateList = map (state: lib.fix (lib.toFunction state)) (builtins.attrValues states);
|
||||
stateList = lib.pipe states [
|
||||
builtins.attrValues
|
||||
(map lib.toFunction)
|
||||
(map (fn: fn null))
|
||||
(builtins.filter builtins.isString)
|
||||
];
|
||||
allFormatters = builtins.filter (
|
||||
name:
|
||||
let
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue