Skip to content

Commit 77c5fe8

Browse files
committed
modules/lua-loader: use new 0.11 API for enabling/disabling
1 parent 0ff025c commit 77c5fe8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

modules/lua-loader.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
lib,
33
config,
4-
helpers,
54
...
65
}:
76
let
87
cfg = config.luaLoader;
8+
inherit (lib.nixvim) mkNullOrOption mkIfNonNull' toLuaObject;
99
in
1010
{
11-
options.luaLoader.enable = helpers.mkNullOrOption lib.types.bool ''
11+
options.luaLoader.enable = mkNullOrOption lib.types.bool ''
1212
Whether to enable/disable the experimental lua loader:
1313
1414
If `true`: Enables the experimental Lua module loader:
@@ -24,7 +24,7 @@ in
2424
If `null`: Nothing is configured.
2525
'';
2626

27-
config = helpers.mkIfNonNull' cfg.enable {
28-
extraConfigLuaPre = if cfg.enable then "vim.loader.enable()" else "vim.loader.disable()";
27+
config = mkIfNonNull' cfg.enable {
28+
extraConfigLuaPre = "vim.loader.enable(${toLuaObject cfg.enable})";
2929
};
3030
}

tests/test-sources/modules/lua-loader.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
assertions = [
2929
{
30-
assertion = lib.hasInfix "vim.loader.enable()" config.content;
30+
assertion = lib.hasInfix "vim.loader.enable(true)" config.content;
3131
message = "luaLoader is expected to be explicitly enabled.";
3232
}
3333
{
@@ -47,7 +47,7 @@
4747

4848
assertions = [
4949
{
50-
assertion = lib.hasInfix "vim.loader.disable()" config.content;
50+
assertion = lib.hasInfix "vim.loader.enable(false)" config.content;
5151
message = "luaLoader is expected to be explicitly disabled.";
5252
}
5353
{

0 commit comments

Comments
 (0)