From 3f9d0584c29cbeb5cf71ab35f8fb123f244d5430 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 8 Nov 2024 18:03:08 +0300 Subject: [PATCH] plugins/nvim-treesitter: add extraQueries --- modules/plugins/style/nvim-treesitter.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/plugins/style/nvim-treesitter.nix b/modules/plugins/style/nvim-treesitter.nix index 719c722..ea4dc9d 100644 --- a/modules/plugins/style/nvim-treesitter.nix +++ b/modules/plugins/style/nvim-treesitter.nix @@ -34,6 +34,15 @@ let fi '' )) + ++ lib.flatten (lib.flip lib.mapAttrsToList cfg.extraQueries ( + lang: + lib.mapAttrsToList (queryKind: queries: + '' + mkdir -p queries/${lang} + echo "${queries}" >> queries/${lang}/${queryKind}.scm + '' + ) + )) ); }); in @@ -62,6 +71,18 @@ in default = { }; }; + extraQueries = mkOption { + type = with types; attrsOf (submodule { + injections = mkOption { + type = either str (arrayOf str); + default = [ ]; + }; + }); + example = { + javascript.injections = ''(comment) @comment''; + }; + }; + settings = mkOption { type = types.attrs; default = { };