mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
fix(nix): refactor nixosTest injections for better performance (#8378)
This commit is contained in:
parent
36fcb4a423
commit
7efc1b58a8
2 changed files with 32 additions and 14 deletions
|
|
@ -251,17 +251,35 @@
|
||||||
(#lua-match? @_func "^%a*%.*writeRust%a*$")
|
(#lua-match? @_func "^%a*%.*writeRust%a*$")
|
||||||
(#set! injection.combined))
|
(#set! injection.combined))
|
||||||
|
|
||||||
; (nixosTest) testScript
|
; (runTest) testScript
|
||||||
((binding
|
(apply_expression
|
||||||
attrpath: (attrpath) @_attr_name
|
function: (_) @_func
|
||||||
(#eq? @_attr_name "nodes"))
|
argument: (_
|
||||||
(binding
|
(_)*
|
||||||
attrpath: (attrpath) @_func_name
|
|
||||||
(#eq? @_func_name "testScript")
|
|
||||||
(_
|
(_
|
||||||
(string_fragment) @injection.content
|
(binding
|
||||||
(#set! injection.language "python")))
|
attrpath: (attrpath) @_func_name
|
||||||
(#set! injection.combined))
|
expression: (_
|
||||||
|
(string_fragment) @injection.content
|
||||||
|
(#set! injection.language "python")))
|
||||||
|
(#eq? @_func_name "testScript")
|
||||||
|
(#lua-match? @_func "^.*%.*runTest$")
|
||||||
|
(#set! injection.combined))))
|
||||||
|
|
||||||
|
; (nixosTest) testScript
|
||||||
|
(apply_expression
|
||||||
|
function: (_) @_func
|
||||||
|
argument: (_
|
||||||
|
(_)*
|
||||||
|
(_
|
||||||
|
(binding
|
||||||
|
attrpath: (attrpath) @_func_name
|
||||||
|
expression: (_
|
||||||
|
(string_fragment) @injection.content
|
||||||
|
(#set! injection.language "python")))
|
||||||
|
(#eq? @_func_name "testScript")
|
||||||
|
(#lua-match? @_func "^.*%.*nixosTest$")
|
||||||
|
(#set! injection.combined))))
|
||||||
|
|
||||||
; home-manager Neovim plugin config
|
; home-manager Neovim plugin config
|
||||||
(attrset_expression
|
(attrset_expression
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# NOTE: This file is for testing queries. If evaluated with nix, this will probably error.
|
# NOTE: This file is for testing queries. If evaluated with nix, this will probably error.
|
||||||
{ pkgs, stdenv }: let
|
{ pkgs, stdenv, lib }: let
|
||||||
match = builtins.match;
|
match = builtins.match;
|
||||||
in {
|
in {
|
||||||
regex = builtins.match "^.*[{](.+)[}].*$" "blahblah {something} blahblah" [ "something" ];
|
regex = builtins.match "^.*[{](.+)[}].*$" "blahblah {something} blahblah" [ "something" ];
|
||||||
|
|
||||||
regex2 = match "^.*[{](.+)[}].*$" "blahblah {something} blahblah" [ "something" ];
|
regex2 = match "^.*[{](.+)[}].*$" "blahblah {something} blahblah" [ "something" ];
|
||||||
|
|
@ -12,7 +12,7 @@ in {
|
||||||
echo "bar" > $out/foo.txt
|
echo "bar" > $out/foo.txt
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
drv2 = pkgs.writeShellApplication {
|
drv2 = pkgs.writeShellApplication {
|
||||||
name = "shellApp";
|
name = "shellApp";
|
||||||
buildInputs = [];
|
buildInputs = [];
|
||||||
|
|
@ -62,7 +62,7 @@ in {
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
drv12 = {
|
drv12 = lib.nixos.runTest {
|
||||||
nodes = null;
|
nodes = null;
|
||||||
testScript = ''
|
testScript = ''
|
||||||
print("Hello world!");
|
print("Hello world!");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue