aboutsummaryrefslogtreecommitdiffstats
path: root/queries/nix
diff options
context:
space:
mode:
authorPhạm Huy Hoàng <hoangtun0810@gmail.com>2024-03-21 20:44:35 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-03-21 15:51:26 +0100
commit722617e6726c1508adadf83d531f54987c703be0 (patch)
tree951cdcf1cd2571647a3e5afdc11d6fae5e88b630 /queries/nix
parentfeat(rust): improve indents (diff)
downloadnvim-treesitter-722617e6726c1508adadf83d531f54987c703be0.tar
nvim-treesitter-722617e6726c1508adadf83d531f54987c703be0.tar.gz
nvim-treesitter-722617e6726c1508adadf83d531f54987c703be0.tar.bz2
nvim-treesitter-722617e6726c1508adadf83d531f54987c703be0.tar.lz
nvim-treesitter-722617e6726c1508adadf83d531f54987c703be0.tar.xz
nvim-treesitter-722617e6726c1508adadf83d531f54987c703be0.tar.zst
nvim-treesitter-722617e6726c1508adadf83d531f54987c703be0.zip
refactor(format): drop extra indentation for field
Diffstat (limited to 'queries/nix')
-rw-r--r--queries/nix/highlights.scm25
-rw-r--r--queries/nix/injections.scm262
2 files changed, 127 insertions, 160 deletions
diff --git a/queries/nix/highlights.scm b/queries/nix/highlights.scm
index 9baf8c4a7..9f00167c4 100644
--- a/queries/nix/highlights.scm
+++ b/queries/nix/highlights.scm
@@ -84,9 +84,8 @@
; function calls
(apply_expression
- function:
- (variable_expression
- name: (identifier) @function.call))
+ function: (variable_expression
+ name: (identifier) @function.call))
; basic identifiers
(variable_expression) @variable
@@ -101,12 +100,10 @@
; builtin functions (with builtins prefix)
(select_expression
- expression:
- (variable_expression
- name: (identifier) @_id)
- attrpath:
- (attrpath
- attr: (identifier) @function.builtin)
+ expression: (variable_expression
+ name: (identifier) @_id)
+ attrpath: (attrpath
+ attr: (identifier) @function.builtin)
(#eq? @_id "builtins"))
; builtin functions (without builtins prefix)
@@ -158,9 +155,8 @@
(select_expression
expression: (_) @_expr
- attrpath:
- (attrpath
- attr: (identifier) @variable.member)
+ attrpath: (attrpath
+ attr: (identifier) @variable.member)
(#not-eq? @_expr "builtins"))
(attrset_expression
@@ -179,9 +175,8 @@
; function definition
(binding
- attrpath:
- (attrpath
- attr: (identifier) @function)
+ attrpath: (attrpath
+ attr: (identifier) @function)
expression: (function_expression))
; unary operators
diff --git a/queries/nix/injections.scm b/queries/nix/injections.scm
index 5d86d3697..8feff0f8a 100644
--- a/queries/nix/injections.scm
+++ b/queries/nix/injections.scm
@@ -14,193 +14,165 @@
(apply_expression
function: (_) @_func
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "regex")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "regex")))
- ]
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "regex")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "regex")))
+ ]
(#match? @_func "(^|\\.)match$")
(#set! injection.combined))
(binding
- attrpath:
- (attrpath
- (identifier) @_path)
- expression:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "bash")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "bash")))
- ]
+ attrpath: (attrpath
+ (identifier) @_path)
+ expression: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "bash")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "bash")))
+ ]
(#match? @_path "(^\\w+(Phase|Hook|Check)|(pre|post)[A-Z]\\w+|script)$"))
(apply_expression
function: (_) @_func
- argument:
+ argument: (_
+ (_)*
(_
(_)*
- (_
- (_)*
- (binding
- attrpath:
- (attrpath
- (identifier) @_path)
- expression:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "bash")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "bash")))
- ])))
+ (binding
+ attrpath: (attrpath
+ (identifier) @_path)
+ expression: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "bash")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "bash")))
+ ])))
(#match? @_func "(^|\\.)writeShellApplication$")
(#match? @_path "^text$")
(#set! injection.combined))
(apply_expression
- function:
- (apply_expression
- function:
- (apply_expression
- function: (_) @_func))
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "bash")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "bash")))
- ]
+ function: (apply_expression
+ function: (apply_expression
+ function: (_) @_func))
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "bash")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "bash")))
+ ]
(#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$")
(#set! injection.combined))
((apply_expression
- function:
- (apply_expression
- function: (_) @_func)
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "bash")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "bash")))
- ])
+ function: (apply_expression
+ function: (_) @_func)
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "bash")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "bash")))
+ ])
(#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$")
(#set! injection.combined))
((apply_expression
- function:
- (apply_expression
- function: (_) @_func)
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "fish")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "fish")))
- ])
+ function: (apply_expression
+ function: (_) @_func)
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "fish")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "fish")))
+ ])
(#match? @_func "(^|\\.)writeFish(Bin)?$")
(#set! injection.combined))
((apply_expression
- function:
- (apply_expression
- function:
- (apply_expression
- function: (_) @_func))
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "haskell")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "haskell")))
- ])
+ function: (apply_expression
+ function: (apply_expression
+ function: (_) @_func))
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "haskell")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "haskell")))
+ ])
(#match? @_func "(^|\\.)writeHaskell(Bin)?$")
(#set! injection.combined))
((apply_expression
- function:
- (apply_expression
- function:
- (apply_expression
- function: (_) @_func))
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "javascript")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "javascript")))
- ])
+ function: (apply_expression
+ function: (apply_expression
+ function: (_) @_func))
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "javascript")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "javascript")))
+ ])
(#match? @_func "(^|\\.)writeJS(Bin)?$")
(#set! injection.combined))
((apply_expression
- function:
- (apply_expression
- function:
- (apply_expression
- function: (_) @_func))
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "perl")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "perl")))
- ])
+ function: (apply_expression
+ function: (apply_expression
+ function: (_) @_func))
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "perl")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "perl")))
+ ])
(#match? @_func "(^|\\.)writePerl(Bin)?$")
(#set! injection.combined))
((apply_expression
- function:
- (apply_expression
- function:
- (apply_expression
- function: (_) @_func))
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "python")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "python")))
- ])
+ function: (apply_expression
+ function: (apply_expression
+ function: (_) @_func))
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "python")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "python")))
+ ])
(#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$")
(#set! injection.combined))
((apply_expression
- function:
- (apply_expression
- function:
- (apply_expression
- function: (_) @_func))
- argument:
- [
- (string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "rust")))
- (indented_string_expression
- ((string_fragment) @injection.content
- (#set! injection.language "rust")))
- ])
+ function: (apply_expression
+ function: (apply_expression
+ function: (_) @_func))
+ argument: [
+ (string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "rust")))
+ (indented_string_expression
+ ((string_fragment) @injection.content
+ (#set! injection.language "rust")))
+ ])
(#match? @_func "(^|\\.)writeRust(Bin)?$")
(#set! injection.combined))