diff options
| author | Phạm Huy Hoàng <hoangtun0810@gmail.com> | 2024-01-30 22:19:54 +0700 |
|---|---|---|
| committer | Phạm Huy Hoàng <hoangtun0810@gmail.com> | 2024-01-30 22:59:27 +0700 |
| commit | 5f950cdcb82d2cf74e6b30338897b3a4897f52b3 (patch) | |
| tree | 32f116d4c7f1b32df70c70b896f7ac0fc164eda9 | |
| parent | fix(format): improve error message (diff) | |
| download | nvim-treesitter-5f950cdcb82d2cf74e6b30338897b3a4897f52b3.tar nvim-treesitter-5f950cdcb82d2cf74e6b30338897b3a4897f52b3.tar.gz nvim-treesitter-5f950cdcb82d2cf74e6b30338897b3a4897f52b3.tar.bz2 nvim-treesitter-5f950cdcb82d2cf74e6b30338897b3a4897f52b3.tar.lz nvim-treesitter-5f950cdcb82d2cf74e6b30338897b3a4897f52b3.tar.xz nvim-treesitter-5f950cdcb82d2cf74e6b30338897b3a4897f52b3.tar.zst nvim-treesitter-5f950cdcb82d2cf74e6b30338897b3a4897f52b3.zip | |
fix(format): handle list with 300 nodes
| -rw-r--r-- | queries/gdscript/highlights.scm | 2 | ||||
| -rw-r--r-- | queries/gnuplot/highlights.scm | 4 | ||||
| -rw-r--r-- | queries/make/highlights.scm | 3 | ||||
| -rw-r--r-- | queries/matlab/highlights.scm | 3 | ||||
| -rwxr-xr-x | scripts/format-queries.lua | 18 |
5 files changed, 7 insertions, 23 deletions
diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 0e514eec7..f9d2b762f 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -277,9 +277,9 @@ )) ; Builtin Funcs +; format-ignore (call (identifier) @function.builtin - ; format-ignore (#any-of? @function.builtin ; @GlobalScope "abs" "absf" "absi" "acos" "asin" "atan" "atan2" "bezier_derivative" diff --git a/queries/gnuplot/highlights.scm b/queries/gnuplot/highlights.scm index 1ba789118..d8e546a03 100644 --- a/queries/gnuplot/highlights.scm +++ b/queries/gnuplot/highlights.scm @@ -165,8 +165,7 @@ "background" "rounded" "butt" - ]* - @attribute) + ]* @attribute) ; (t_canvas) ; (t_cgm) @@ -288,7 +287,6 @@ ] @variable.member ; Workaround because formatter cannot handle 300 list nodes -; format-ignore [ (angles) (clip) diff --git a/queries/make/highlights.scm b/queries/make/highlights.scm index 01b8438f5..38adac07f 100644 --- a/queries/make/highlights.scm +++ b/queries/make/highlights.scm @@ -74,8 +74,7 @@ ; ":::=" "?=" "!=" - ]? - @operator + ]? @operator "endef" @keyword) (variable_assignment diff --git a/queries/matlab/highlights.scm b/queries/matlab/highlights.scm index d92808078..a2ebc153a 100644 --- a/queries/matlab/highlights.scm +++ b/queries/matlab/highlights.scm @@ -116,8 +116,7 @@ [ "end" "endfunction" - ]? - @keyword.function) + ]? @keyword.function) (function_signature name: (identifier) @function) diff --git a/scripts/format-queries.lua b/scripts/format-queries.lua index b7c230096..5cb0fb1a2 100755 --- a/scripts/format-queries.lua +++ b/scripts/format-queries.lua @@ -106,25 +106,19 @@ local format_queries = [[ ;; Only starts indent if 2 or more elements (list "[" @format.indent.begin - . - (_) - . - (_) "]" @format.indent.dedent) ;; Otherwise, remove brackets (list - "[" @format.remove + "[" @format.remove @format.cancel-append . (_) @format.cancel-append . "]" @format.remove) ;; [ ... ] @capture1 @capture2 -(list - (capture) @format.prepend-space) ;; Append newlines for nodes inside the list (list (_) @format.append-newline - (#not-has-type? @format.append-newline capture)) + (#not-has-type? @format.append-newline capture quantifier)) ;; (_), "_" and _ handler ;; Start indents if it's one of these patterns @@ -176,9 +170,6 @@ local format_queries = [[ (anonymous_node) "." ] @format.append-newline) -(named_node - (list - "[" . (_) @format.append-newline . "]")) ;; Collapse closing parentheses (named_node @@ -192,10 +183,7 @@ local format_queries = [[ (#not-has-type? @format.cancel-append comment)) ;; All captures should be separated with a space -(named_node - (capture) @format.prepend-space) -(anonymous_node - (capture) @format.prepend-space) +(capture) @format.prepend-space ;; Workaround to just use the string's content (anonymous_node (identifier) @format.keep) |
