Skip to content

Commit fefe9c9

Browse files
committed
plugins/friendly-snippets: add warning when using performance.combinePlugins
Signed-off-by: saygo-png <[email protected]>
1 parent 68b07c2 commit fefe9c9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

plugins/by-name/friendly-snippets/default.nix

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
lib,
3+
config,
4+
options,
35
...
46
}:
57
lib.nixvim.plugins.mkVimPlugin {
@@ -9,6 +11,30 @@ lib.nixvim.plugins.mkVimPlugin {
911
maintainers = [ lib.maintainers.GaetanLepage ];
1012

1113
extraConfig = {
14+
warnings = lib.nixvim.mkWarnings "plugins.friendly-snippets" (
15+
let
16+
snippetConsumers = map (lib.splitString ".") [
17+
"plugins.luasnip.enable"
18+
"plugins.cmp.enable"
19+
"plugins.blink-cmp.enable"
20+
"plugins.nvim-snippets.enable"
21+
];
22+
enabledConsumers = builtins.filter (path: lib.getAttrFromPath path config) snippetConsumers;
23+
enabledConsumersPretty = lib.concatMapStringsSep ", " (
24+
path: lib.getAttrFromPath path options
25+
) enabledConsumers;
26+
in
27+
{
28+
when =
29+
config.performance.combinePlugins.enable
30+
&& !(builtins.elem "friendly-snippets" config.performance.combinePlugins.standalonePlugins)
31+
&& (enabledConsumers != [ ]);
32+
message = ''
33+
When using ${options.performance.combinePlugins.enable}, ${options.plugins.friendly-snippets.enable} and ${enabledConsumersPretty}:
34+
"friendly-snippets" has to be added to ${options.performance.combinePlugins.standalonePlugins} in order to be picked up by the aforementioned plugins.
35+
'';
36+
}
37+
);
1238
# Simply add an element to the `fromVscode` list to trigger the import of friendly-snippets
1339
plugins.luasnip.fromVscode = [ { } ];
1440
};

0 commit comments

Comments
 (0)