From 98a79590474c3a6bdf41b6cfb9af161cf48823c3 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sat, 11 Jan 2025 14:02:21 +0100 Subject: [PATCH 1/6] snippets/luasnip: add setupOpts Also fixed a bug where the plugin previously would not get loaded, as lazy was set to true without a trigger event. --- modules/plugins/snippets/luasnip/config.nix | 12 ++++++------ modules/plugins/snippets/luasnip/luasnip.nix | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/plugins/snippets/luasnip/config.nix b/modules/plugins/snippets/luasnip/config.nix index 927b21fd..60a5ca6d 100644 --- a/modules/plugins/snippets/luasnip/config.nix +++ b/modules/plugins/snippets/luasnip/config.nix @@ -9,12 +9,12 @@ in { config = mkIf cfg.enable { vim = { - lazy.plugins = { - luasnip = { - package = "luasnip"; - lazy = true; - after = cfg.loaders; - }; + lazy.plugins.luasnip = { + package = "luasnip"; + event = "BufEnter"; + after = cfg.loaders; + setupModule = "luasnip"; + inherit (cfg) setupOpts; }; startPlugins = cfg.providers; autocomplete.nvim-cmp = { diff --git a/modules/plugins/snippets/luasnip/luasnip.nix b/modules/plugins/snippets/luasnip/luasnip.nix index d9563a5b..edfd72b9 100644 --- a/modules/plugins/snippets/luasnip/luasnip.nix +++ b/modules/plugins/snippets/luasnip/luasnip.nix @@ -1,7 +1,7 @@ {lib, ...}: let inherit (lib.options) mkEnableOption mkOption literalExpression literalMD; inherit (lib.types) listOf lines; - inherit (lib.nvim.types) pluginType; + inherit (lib.nvim.types) pluginType mkPluginSetupOption; in { options.vim.snippets.luasnip = { enable = mkEnableOption "luasnip"; @@ -32,5 +32,7 @@ in { ``` ''; }; + + setupOpts = mkPluginSetupOption "LuaSnip" {}; }; } From 69cb99dc2bf6f57af48fdea98a6c653f214d4d67 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sat, 11 Jan 2025 14:04:40 +0100 Subject: [PATCH 2/6] snippets/luasnip: add example option to setupOpts --- modules/plugins/snippets/luasnip/luasnip.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/plugins/snippets/luasnip/luasnip.nix b/modules/plugins/snippets/luasnip/luasnip.nix index edfd72b9..6b189b61 100644 --- a/modules/plugins/snippets/luasnip/luasnip.nix +++ b/modules/plugins/snippets/luasnip/luasnip.nix @@ -33,6 +33,8 @@ in { ''; }; - setupOpts = mkPluginSetupOption "LuaSnip" {}; + setupOpts = mkPluginSetupOption "LuaSnip" { + enable_autosnippets = mkEnableOption "autosnippets"; + }; }; } From 7012938e21ec105813ba857cf4ae8e0a632ae472 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sat, 11 Jan 2025 14:06:14 +0100 Subject: [PATCH 3/6] snippets/luasnip: add changelog entry --- docs/release-notes/rl-0.8.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index c65defeb..f79eb940 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -51,3 +51,5 @@ - Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes issue with setting the workspace directory. +- Add `vim.snippets.luasnip.setupOpts`, which was previously missing. +- Add a trigger event for luasnip lazy-loading From 9818d199378ff70c7bf77d0988e9da05fc27f1a4 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sun, 12 Jan 2025 09:58:55 +0100 Subject: [PATCH 4/6] snippets/luasnip: revert adding lazy event --- docs/release-notes/rl-0.8.md | 1 - modules/plugins/snippets/luasnip/config.nix | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index f79eb940..3c07aa09 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -52,4 +52,3 @@ - Remove `vim.notes.obsidian.setupOpts.dir`, which was set by default. Fixes issue with setting the workspace directory. - Add `vim.snippets.luasnip.setupOpts`, which was previously missing. -- Add a trigger event for luasnip lazy-loading diff --git a/modules/plugins/snippets/luasnip/config.nix b/modules/plugins/snippets/luasnip/config.nix index 60a5ca6d..0f887e5f 100644 --- a/modules/plugins/snippets/luasnip/config.nix +++ b/modules/plugins/snippets/luasnip/config.nix @@ -11,7 +11,7 @@ in { vim = { lazy.plugins.luasnip = { package = "luasnip"; - event = "BufEnter"; + lazy = true; after = cfg.loaders; setupModule = "luasnip"; inherit (cfg) setupOpts; From c59f8922b298d471b561a49573f739dd9529b1f6 Mon Sep 17 00:00:00 2001 From: LilleAila <67327023+LilleAila@users.noreply.github.com> Date: Sun, 12 Jan 2025 11:39:41 +0100 Subject: [PATCH 5/6] snippets/luasnip: add whitespace, organize options Co-authored-by: diniamo <55629891+diniamo@users.noreply.github.com> --- modules/plugins/snippets/luasnip/config.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/plugins/snippets/luasnip/config.nix b/modules/plugins/snippets/luasnip/config.nix index 0f887e5f..a3767aa7 100644 --- a/modules/plugins/snippets/luasnip/config.nix +++ b/modules/plugins/snippets/luasnip/config.nix @@ -11,10 +11,13 @@ in { vim = { lazy.plugins.luasnip = { package = "luasnip"; + lazy = true; - after = cfg.loaders; + setupModule = "luasnip"; inherit (cfg) setupOpts; + + after = cfg.loaders; }; startPlugins = cfg.providers; autocomplete.nvim-cmp = { From fedbee3a30e9b0043b77bb1c705dd83c0860dbc6 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sun, 12 Jan 2025 12:48:44 +0100 Subject: [PATCH 6/6] snippets/luasnip: fix formatting --- modules/plugins/snippets/luasnip/config.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/plugins/snippets/luasnip/config.nix b/modules/plugins/snippets/luasnip/config.nix index a3767aa7..b05f9f27 100644 --- a/modules/plugins/snippets/luasnip/config.nix +++ b/modules/plugins/snippets/luasnip/config.nix @@ -11,12 +11,12 @@ in { vim = { lazy.plugins.luasnip = { package = "luasnip"; - + lazy = true; - + setupModule = "luasnip"; inherit (cfg) setupOpts; - + after = cfg.loaders; }; startPlugins = cfg.providers;