mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/treesitter: Add injections to highlight lua in nixvim options (#344)
This commit is contained in:
parent
5a498edd14
commit
9c8bee9da6
2 changed files with 25 additions and 0 deletions
|
@ -91,6 +91,10 @@ in {
|
|||
default = {};
|
||||
description = "This is the configuration for extra modules. It should not be used directly";
|
||||
};
|
||||
|
||||
nixvimInjections =
|
||||
mkEnableOption
|
||||
"nixvim specific injections, like lua highlighting in extraConfigLua";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -148,6 +152,20 @@ in {
|
|||
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
|
||||
'';
|
||||
|
||||
extraFiles = mkIf cfg.nixvimInjections {
|
||||
"queries/nix/injections.scm" = ''
|
||||
;; extends
|
||||
|
||||
(binding
|
||||
attrpath: (attrpath (identifier) @_path)
|
||||
expression: [
|
||||
(string_expression (string_fragment) @lua)
|
||||
(indented_string_expression (string_fragment) @lua)
|
||||
]
|
||||
(#match? @_path "^extraConfigLua(Pre|Post)?$"))
|
||||
'';
|
||||
};
|
||||
|
||||
extraPlugins = with pkgs;
|
||||
if cfg.nixGrammars
|
||||
then [(cfg.package.withPlugins (_: cfg.grammarPackages))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue