neovimUtils.grammarToPlugin: improve error message on invalid grammarPlugins (#357062)

This commit is contained in:
Austin Horstman 2024-11-19 11:09:05 -06:00 committed by GitHub
commit 36be531246
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -176,7 +176,11 @@ let
(lib.replaceStrings [ "-" ] [ "_" ])
];
nvimGrammars = lib.mapAttrsToList (name: value: value.origGrammar) vimPlugins.nvim-treesitter.grammarPlugins;
nvimGrammars = lib.mapAttrsToList (
name: value:
value.origGrammar
or (builtins.throw "additions to `pkgs.vimPlugins.nvim-treesitter.grammarPlugins` set should be passed through `pkgs.neovimUtils.grammarToPlugin` first")
) vimPlugins.nvim-treesitter.grammarPlugins;
isNvimGrammar = x: builtins.elem x nvimGrammars;
toNvimTreesitterGrammar = callPackage ({ }: