diff options
| author | Pham Huy Hoang <hoangtun0810@gmail.com> | 2024-01-06 15:05:50 +0900 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-19 16:58:37 +0100 |
| commit | 57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch) | |
| tree | 70bf645539882b88e6fa129cefd30986b89bbac3 /queries/fish | |
| parent | ci: add query lint job (diff) | |
| download | nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2 nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip | |
chore: query formatting
Diffstat (limited to 'queries/fish')
| -rw-r--r-- | queries/fish/folds.scm | 12 | ||||
| -rw-r--r-- | queries/fish/highlights.scm | 217 | ||||
| -rw-r--r-- | queries/fish/indents.scm | 18 | ||||
| -rw-r--r-- | queries/fish/injections.scm | 4 | ||||
| -rw-r--r-- | queries/fish/locals.scm | 7 |
5 files changed, 135 insertions, 123 deletions
diff --git a/queries/fish/folds.scm b/queries/fish/folds.scm index 6075e2e04..06363e15e 100644 --- a/queries/fish/folds.scm +++ b/queries/fish/folds.scm @@ -1,8 +1,8 @@ [ - (function_definition) - (if_statement) - (switch_statement) - (for_statement) - (while_statement) - (begin_statement) + (function_definition) + (if_statement) + (switch_statement) + (for_statement) + (while_statement) + (begin_statement) ] @fold diff --git a/queries/fish/highlights.scm b/queries/fish/highlights.scm index 28ddf0b98..77dccbf89 100644 --- a/queries/fish/highlights.scm +++ b/queries/fish/highlights.scm @@ -1,163 +1,174 @@ -;; Fish highlighting - -;; Operators - +; Fish highlighting +; Operators [ - "&&" - "||" - "|" - "&" - ".." - "!" - (direction) - (stream_redirect) + "&&" + "||" + "|" + "&" + ".." + "!" + (direction) + (stream_redirect) ] @operator -;; match operators of test command +; match operators of test command (command - name: (word) @function.builtin (#eq? @function.builtin "test") - argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + name: (word) @function.builtin + (#eq? @function.builtin "test") + argument: (word) @operator + (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) -;; match operators of [ command +; match operators of [ command (command - name: (word) @punctuation.bracket (#eq? @punctuation.bracket "[") - argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + name: (word) @punctuation.bracket + (#eq? @punctuation.bracket "[") + argument: (word) @operator + (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) [ - "not" - "and" - "or" + "not" + "and" + "or" ] @keyword.operator -;; Conditionals - +; Conditionals (if_statement -[ - "if" - "end" -] @keyword.conditional) + [ + "if" + "end" + ] @keyword.conditional) (switch_statement -[ - "switch" - "end" -] @keyword.conditional) + [ + "switch" + "end" + ] @keyword.conditional) (case_clause -[ - "case" -] @keyword.conditional) + "case" @keyword.conditional) -(else_clause -[ - "else" -] @keyword.conditional) - -(else_if_clause -[ - "else" - "if" -] @keyword.conditional) +(else_clause + "else" @keyword.conditional) -;; Loops/Blocks +(else_if_clause + [ + "else" + "if" + ] @keyword.conditional) +; Loops/Blocks (while_statement -[ - "while" - "end" -] @keyword.repeat) + [ + "while" + "end" + ] @keyword.repeat) (for_statement -[ - "for" - "end" -] @keyword.repeat) + [ + "for" + "end" + ] @keyword.repeat) (begin_statement -[ - "begin" - "end" -] @keyword.repeat) - -;; Keywords + [ + "begin" + "end" + ] @keyword.repeat) +; Keywords [ - "in" - (break) - (continue) + "in" + (break) + (continue) ] @keyword "return" @keyword.return -;; Punctuation - +; Punctuation [ - "[" - "]" - "{" - "}" - "(" - ")" + "[" + "]" + "{" + "}" + "(" + ")" ] @punctuation.bracket "," @punctuation.delimiter -;; Commands - +; Commands (command - argument: [ - (word) @variable.parameter (#lua-match? @variable.parameter "^[-]") - ] -) + argument: + [ + (word) @variable.parameter + (#lua-match? @variable.parameter "^[-]") + ]) -(command_substitution "$" @punctuation.bracket) +(command_substitution + "$" @punctuation.bracket) ; non-builtin command names -(command name: (word) @function.call) +(command + name: (word) @function.call) ; derived from builtin -n (fish 3.2.2) (command - name: [ - (word) @function.builtin - (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") - ] -) - -;; Functions + name: + [ + (word) @function.builtin + (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") + ]) -(function_definition ["function" "end"] @keyword.function) +; Functions +(function_definition + [ + "function" + "end" + ] @keyword.function) (function_definition - name: [ - (word) (concatenation) - ] -@function) + name: + [ + (word) + (concatenation) + ] @function) (function_definition - option: [ - (word) - (concatenation (word)) - ] @variable.parameter (#lua-match? @variable.parameter "^[-]") -) + option: + [ + (word) + (concatenation + (word)) + ] @variable.parameter + (#lua-match? @variable.parameter "^[-]")) -;; Strings +; Strings +[ + (double_quote_string) + (single_quote_string) +] @string -[(double_quote_string) (single_quote_string)] @string (escape_sequence) @string.escape -;; Variables - +; Variables (variable_name) @variable + (variable_expansion) @constant -;; Nodes +; Nodes +[ + (integer) + (float) +] @number -[(integer) (float)] @number (comment) @comment + (comment) @spell ((word) @boolean -(#any-of? @boolean "true" "false")) + (#any-of? @boolean "true" "false")) -((program . (comment) @keyword.directive) +((program + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/fish/indents.scm b/queries/fish/indents.scm index 526c56e69..4984c4cb2 100644 --- a/queries/fish/indents.scm +++ b/queries/fish/indents.scm @@ -1,16 +1,16 @@ [ - (function_definition) - (while_statement) - (for_statement) - (if_statement) - (begin_statement) - (switch_statement) + (function_definition) + (while_statement) + (for_statement) + (if_statement) + (begin_statement) + (switch_statement) ] @indent.begin [ - "else" ; else and else if must both start the line with "else", so tag the string directly - "case" - "end" + "else" ; else and else if must both start the line with "else", so tag the string directly + "case" + "end" ] @indent.branch "end" @indent.end diff --git a/queries/fish/injections.scm b/queries/fish/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/fish/injections.scm +++ b/queries/fish/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/fish/locals.scm b/queries/fish/locals.scm index 15c3aac1d..904d568f9 100644 --- a/queries/fish/locals.scm +++ b/queries/fish/locals.scm @@ -1,4 +1,4 @@ -;; Scopes +; Scopes [ (command) (function_definition) @@ -9,10 +9,11 @@ (switch_statement) ] @local.scope -;; Definitions +; Definitions (function_definition name: (word) @local.definition.function) -;; References +; References (variable_name) @local.reference + (word) @local.reference |
