mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/none-ls: refactor mkRaw
- Allow passing raw types through mkRaw - Throw an error when passing invalid input into mkRaw
This commit is contained in:
parent
6ac0d2869d
commit
69e43a6bf9
2 changed files with 16 additions and 3 deletions
|
@ -7,7 +7,7 @@
|
||||||
let
|
let
|
||||||
nixvimBuilders = import ./builders.nix { inherit lib pkgs; };
|
nixvimBuilders = import ./builders.nix { inherit lib pkgs; };
|
||||||
nixvimTypes = import ./types.nix { inherit lib nixvimOptions; };
|
nixvimTypes = import ./types.nix { inherit lib nixvimOptions; };
|
||||||
nixvimUtils = import ./utils.nix { inherit lib _nixvimTests; };
|
nixvimUtils = import ./utils.nix { inherit lib nixvimTypes _nixvimTests; };
|
||||||
nixvimOptions = import ./options.nix { inherit lib nixvimTypes nixvimUtils; };
|
nixvimOptions = import ./options.nix { inherit lib nixvimTypes nixvimUtils; };
|
||||||
inherit (import ./to-lua.nix { inherit lib; }) toLuaObject;
|
inherit (import ./to-lua.nix { inherit lib; }) toLuaObject;
|
||||||
in
|
in
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{ lib, _nixvimTests }:
|
{
|
||||||
|
lib,
|
||||||
|
nixvimTypes,
|
||||||
|
_nixvimTests,
|
||||||
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
listToUnkeyedAttrs =
|
listToUnkeyedAttrs =
|
||||||
|
@ -98,7 +102,16 @@ with lib;
|
||||||
|
|
||||||
ifNonNull' = x: y: if (x == null) then null else y;
|
ifNonNull' = x: y: if (x == null) then null else y;
|
||||||
|
|
||||||
mkRaw = r: if (isString r && (r != "")) then { __raw = r; } else null;
|
mkRaw =
|
||||||
|
r:
|
||||||
|
if r == null || r == "" then
|
||||||
|
null
|
||||||
|
else if isString r then
|
||||||
|
{ __raw = r; }
|
||||||
|
else if nixvimTypes.isRawType r then
|
||||||
|
r
|
||||||
|
else
|
||||||
|
throw "mkRaw: invalid input: ${generators.toPretty { multiline = false; } r}";
|
||||||
|
|
||||||
wrapDo = string: ''
|
wrapDo = string: ''
|
||||||
do
|
do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue