mirror of
https://github.com/nix-community/nixvim.git
synced 2026-08-24 10:14:03 -05:00
plugins/treesitter: simplify nested expressions
Looks like we can actually nest this inside the parenthesized_expression to simplify a small amount.
This commit is contained in:
@@ -24,26 +24,23 @@
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
|
||||
; Function wrappers (handles 1-2 levels of nesting)
|
||||
; Function wrappers (handles 1-3 levels of nesting)
|
||||
; extraConfigLua = mkIf true "..."
|
||||
; extraConfigLua = mkIf true (mkOverride 10 "...")
|
||||
; extraConfigLua = mkIf true (mkOverride 10 (mkDefault "..."))
|
||||
(apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
]))
|
||||
]))
|
||||
])
|
||||
|
||||
; Three-level nested wrappers
|
||||
; extraConfigLua = mkIf true (mkOverride 10 (mkDefault "..."))
|
||||
(apply_expression argument: (parenthesized_expression (apply_expression argument:
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
])))))
|
||||
|
||||
; Lists (with or without wrapped items)
|
||||
; extraConfigLua = mkMerge [ "..." "..." ]
|
||||
; extraConfigLua = mkMerge [ (mkIf true "...") "..." ]
|
||||
@@ -85,26 +82,23 @@
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
|
||||
; Function wrappers (handles 1-2 levels of nesting)
|
||||
; Function wrappers (handles 1-3 levels of nesting)
|
||||
; luaConfig = { pre = mkIf true "..." }
|
||||
; luaConfig = { pre = mkIf true (mkOverride 10 "...") }
|
||||
; luaConfig = { pre = mkIf true (mkOverride 10 (mkDefault "...")) }
|
||||
(apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
]))
|
||||
]))
|
||||
])
|
||||
|
||||
; Three-level nested wrappers
|
||||
; luaConfig = { pre = mkIf true (mkOverride 10 (mkDefault "...")) }
|
||||
(apply_expression argument: (parenthesized_expression (apply_expression argument:
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
])))))
|
||||
|
||||
; Let expressions
|
||||
; luaConfig = { pre = let x = ...; in ''...'' }
|
||||
(let_expression body: [
|
||||
@@ -129,26 +123,23 @@
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
|
||||
; Function wrappers (handles 1-2 levels of nesting)
|
||||
; Function wrappers (handles 1-3 levels of nesting)
|
||||
; luaConfig.pre = mkIf true "..."
|
||||
; luaConfig.content = mkIf true (mkOverride 10 "...")
|
||||
; luaConfig.post = mkIf true (mkOverride 10 (mkDefault "..."))
|
||||
(apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
]))
|
||||
]))
|
||||
])
|
||||
|
||||
; Three-level nested wrappers
|
||||
; luaConfig.post = mkIf true (mkOverride 10 (mkDefault "..."))
|
||||
(apply_expression argument: (parenthesized_expression (apply_expression argument:
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
])))))
|
||||
|
||||
; Let expressions
|
||||
; luaConfig.pre = let x = ...; in ''...''
|
||||
(let_expression body: [
|
||||
@@ -172,26 +163,23 @@
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
|
||||
; Function wrappers (handles 1-2 levels of nesting)
|
||||
; Function wrappers (handles 1-3 levels of nesting)
|
||||
; extraConfigVim = mkIf true "..."
|
||||
; extraConfigVim = mkIf true (mkOverride 10 "...")
|
||||
; extraConfigVim = mkIf true (mkOverride 10 (mkDefault "..."))
|
||||
(apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
]))
|
||||
]))
|
||||
])
|
||||
|
||||
; Three-level nested wrappers
|
||||
; extraConfigVim = mkIf true (mkOverride 10 (mkDefault "..."))
|
||||
(apply_expression argument: (parenthesized_expression (apply_expression argument:
|
||||
(parenthesized_expression (apply_expression argument: [
|
||||
(string_expression (string_fragment) @injection.content)
|
||||
(indented_string_expression (string_fragment) @injection.content)
|
||||
])))))
|
||||
|
||||
; Lists (with or without wrapped items)
|
||||
; extraConfigVim = mkMerge [ "..." "..." ]
|
||||
; extraConfigVim = mkMerge [ (mkIf true "...") "..." ]
|
||||
|
||||
Reference in New Issue
Block a user