Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/nix/injections.scm')
| -rw-r--r-- | runtime/queries/nix/injections.scm | 128 |
1 files changed, 4 insertions, 124 deletions
diff --git a/runtime/queries/nix/injections.scm b/runtime/queries/nix/injections.scm index f9e0267b..62b48233 100644 --- a/runtime/queries/nix/injections.scm +++ b/runtime/queries/nix/injections.scm @@ -1,34 +1,18 @@ ((comment) @injection.content (#set! injection.language "comment")) -; mark arbitrary languages with a comment +; mark arbitary languages with a comment ((((comment) @injection.language) . (indented_string_expression (string_fragment) @injection.content)) (#set! injection.combined)) -((binding - (comment) @injection.language - expression: (indented_string_expression (string_fragment) @injection.content)) - (#set! injection.combined)) - -; Common attribute keys corresponding to Python scripts, -; such as those for NixOS VM tests in nixpkgs/nixos/tests. -((binding - attrpath: (attrpath (identifier) @_path) - expression: (indented_string_expression - (string_fragment) @injection.content)) - (#match? @_path "(^|\\.)testScript$") - (#set! injection.language "python") - (#set! injection.combined)) ; Common attribute keys corresponding to scripts, ; such as those of stdenv.mkDerivation. ((binding attrpath: (attrpath (identifier) @_path) - expression: [ - (indented_string_expression (string_fragment) @injection.content) - (binary_expression (indented_string_expression (string_fragment) @injection.content)) - ]) - (#match? @_path "(^\\w*Phase|command|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$") + expression: (indented_string_expression + (string_fragment) @injection.content)) + (#match? @_path "(^\\w*Phase|(pre|post)\\w*|(.*\\.)?\\w*([sS]cript|[hH]ook)|(.*\\.)?startup)$") (#set! injection.language "bash") (#set! injection.combined)) @@ -50,15 +34,6 @@ (#set! injection.language "json") (#set! injection.combined)) -; builtins.fromTOML toml -; Example: https://github.com/NixOS/nix/blob/3e8cd2ffe6c2c6ed8aae7853ddcfcc6d2a49b0ce/tests/functional/lang/eval-okay-fromTOML.nix -((apply_expression - function: (_) @_func - argument: (indented_string_expression (string_fragment) @injection.content)) - (#match? @_func "(^|\\.)fromTOML$") - (#set! injection.language "toml") - (#set! injection.combined)) - ; trivial-builders.nix pkgs.writeShellScript[Bin] name content ((apply_expression function: (apply_expression function: (_) @_func) @@ -136,16 +111,6 @@ (#set! injection.language "haskell") (#set! injection.combined)) -; pkgs.writers.writeNim[Bin] name attrs content -(apply_expression - (apply_expression - function: (apply_expression - function: ((_) @_func))) - argument: (indented_string_expression (string_fragment) @injection.content) - (#match? @_func "(^|\\.)writeNim(Bin)?$") - (#set! injection.language "nim") - (#set! injection.combined)) - ; pkgs.writers.writeJS[Bin] name attrs content (apply_expression (apply_expression @@ -176,67 +141,6 @@ (#set! injection.language "python") (#set! injection.combined)) -; pkgs.writers.writeNu[Bin] name attrs content -(apply_expression - (apply_expression - function: (apply_expression - function: ((_) @_func))) - argument: (indented_string_expression (string_fragment) @injection.content) - (#match? @_func "(^|\\.)writeNu(Bin)?$") - (#set! injection.language "nu") - (#set! injection.combined)) - -; pkgs.writers.writeRuby[Bin] name attrs content -(apply_expression - (apply_expression - function: (apply_expression - function: ((_) @_func))) - argument: (indented_string_expression (string_fragment) @injection.content) - (#match? @_func "(^|\\.)writeRuby(Bin)?$") - (#set! injection.language "ruby") - (#set! injection.combined)) - -; pkgs.writers.writeLua[Bin] name attrs content -(apply_expression - (apply_expression - function: (apply_expression - function: ((_) @_func))) - argument: (indented_string_expression (string_fragment) @injection.content) - (#match? @_func "(^|\\.)writeLua(Bin)?$") - (#set! injection.language "lua") - (#set! injection.combined)) - -; pkgs.writers.writeNginxConfig name attrs content -(apply_expression - (apply_expression - function: (apply_expression - function: ((_) @_func))) - argument: (indented_string_expression (string_fragment) @injection.content) - (#match? @_func "(^|\\.)writeNginxConfig$") - (#set! injection.language "nginx") - (#set! injection.combined)) - -; pkgs.writers.writeGuile[Bin] name attrs content -(apply_expression - (apply_expression - function: (apply_expression - function: ((_) @_func))) - argument: (indented_string_expression (string_fragment) @injection.content) - (#match? @_func "(^|\\.)writeGuile(Bin)?$") - (#set! injection.language "scheme") ; Guile is a GNU specific implementation of scheme - (#set! injection.combined)) - - -; pkgs.writers.writeBabashka[Bin] name attrs content -(apply_expression - (apply_expression - function: (apply_expression - function: ((_) @_func))) - argument: (indented_string_expression (string_fragment) @injection.content) - (#match? @_func "(^|\\.)writeBabashka(Bin)?$") - (#set! injection.language "clojure") - (#set! injection.combined)) - ; pkgs.writers.writeFSharp[Bin] name content ; No query available for f-sharp as of the time of writing ; See: https://github.com/helix-editor/helix/issues/4943 @@ -246,27 +150,3 @@ ; (#match? @_func "(^|\\.)writeFSharp(Bin)?$") ; (#set! injection.language "f-sharp") ; (#set! injection.combined)) - -((apply_expression - function: (apply_expression function: (_) @_func - argument: (string_expression (string_fragment) @injection.filename)) - argument: (indented_string_expression (string_fragment) @injection.content)) - (#match? @_func "(^|\\.)write(Text|Script(Bin)?)$") - (#set! injection.combined)) - -((indented_string_expression (string_fragment) @injection.shebang @injection.content) - (#set! injection.combined)) - -; string contents of lib.literalExpression is nix code -((apply_expression - function: [ - (select_expression) ; `lib.literalExpression` - (variable_expression) ; `literalExpression` this is the case when the symbol is brougth into scope e.g. `let inherit (lib) literalExpression; in` - ] @_func - argument: [ - (indented_string_expression (string_fragment) @injection.content) ; lib.literalExpression ''...'' - (string_expression (string_fragment) @injection.content) ; lib.literalExpression "..." - ]) - (#any-of? @_func "lib.literalExpression" "literalExpression") - (#set! injection.language "nix") - (#set! injection.combined)) |