mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 12:06:55 -04:00
Add fish queries
Add isatty as builtin Update function_definition option Update highlights.scm per review Fix list indentation Add maintainer names
This commit is contained in:
parent
509bc1a8e1
commit
83f7739071
6 changed files with 191 additions and 0 deletions
|
|
@ -145,6 +145,7 @@ list.fish = {
|
|||
url = "https://github.com/krnik/tree-sitter-fish",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
},
|
||||
maintainers = {"@krnik", "@ram02z"},
|
||||
}
|
||||
|
||||
list.php = {
|
||||
|
|
|
|||
8
queries/fish/folds.scm
Normal file
8
queries/fish/folds.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[
|
||||
(function_definition)
|
||||
(if_statement)
|
||||
(switch_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(begin_statement)
|
||||
] @fold
|
||||
155
queries/fish/highlights.scm
Normal file
155
queries/fish/highlights.scm
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
;; Fish highlighting
|
||||
|
||||
;; Operators
|
||||
|
||||
[
|
||||
"&&"
|
||||
"||"
|
||||
"|"
|
||||
"&"
|
||||
"="
|
||||
"!="
|
||||
".."
|
||||
"!"
|
||||
(direction)
|
||||
(stream_redirect)
|
||||
] @operator
|
||||
|
||||
[
|
||||
"not"
|
||||
"and"
|
||||
"or"
|
||||
] @keyword.operator
|
||||
|
||||
;; Conditionals
|
||||
|
||||
(if_statement
|
||||
[
|
||||
"if"
|
||||
"end"
|
||||
] @conditional)
|
||||
|
||||
(switch_statement
|
||||
[
|
||||
"switch"
|
||||
"end"
|
||||
] @conditional)
|
||||
|
||||
(case_clause
|
||||
[
|
||||
"case"
|
||||
] @conditional)
|
||||
|
||||
(else_clause
|
||||
[
|
||||
"else"
|
||||
] @conditional)
|
||||
|
||||
(else_if_clause
|
||||
[
|
||||
"else"
|
||||
"if"
|
||||
] @conditional)
|
||||
|
||||
;; Loops/Blocks
|
||||
|
||||
(while_statement
|
||||
[
|
||||
"while"
|
||||
"end"
|
||||
] @repeat)
|
||||
|
||||
(for_statement
|
||||
[
|
||||
"for"
|
||||
"end"
|
||||
] @repeat)
|
||||
|
||||
(begin_statement
|
||||
[
|
||||
"begin"
|
||||
"end"
|
||||
] @repeat)
|
||||
|
||||
;; Keywords
|
||||
|
||||
[
|
||||
"in"
|
||||
"return"
|
||||
(break)
|
||||
(continue)
|
||||
] @keyword
|
||||
|
||||
;; Punctuation
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
"," @punctuation.delimiter
|
||||
|
||||
;; Commands
|
||||
|
||||
(command
|
||||
argument: [
|
||||
(word) @parameter (#match? @parameter "^-")
|
||||
]
|
||||
)
|
||||
|
||||
; non-bultin command names
|
||||
(command name: (word) @function)
|
||||
|
||||
; derived from builtin -n (fish 3.2.2)
|
||||
(command
|
||||
name: [
|
||||
(word) @function.builtin
|
||||
(#match? @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
|
||||
|
||||
(function_definition ["function" "end"] @keyword.function)
|
||||
|
||||
(function_definition
|
||||
name: [
|
||||
(word) (concatenation)
|
||||
]
|
||||
@function)
|
||||
|
||||
(function_definition
|
||||
option: [
|
||||
(word)
|
||||
(concatenation (word))
|
||||
] @parameter (#match? @parameter "^-")
|
||||
)
|
||||
|
||||
;; Strings
|
||||
|
||||
[(double_quote_string) (single_quote_string)] @string
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
;; Variables
|
||||
|
||||
(variable_name) @variable
|
||||
(variable_expansion) @constant
|
||||
|
||||
;; Nodes
|
||||
|
||||
[(integer) (float)] @number
|
||||
(comment) @comment
|
||||
(test_option) @string
|
||||
|
||||
((word) @boolean
|
||||
(#match? @boolean "^(true|false)$"))
|
||||
|
||||
;; Error
|
||||
|
||||
(ERROR) @error
|
||||
|
||||
16
queries/fish/indents.scm
Normal file
16
queries/fish/indents.scm
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[
|
||||
(function_definition)
|
||||
(while_statement)
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(begin_statement)
|
||||
(switch_statement)
|
||||
] @indent
|
||||
|
||||
[
|
||||
(else_if_clause)
|
||||
(else_clause)
|
||||
"end"
|
||||
] @branch
|
||||
|
||||
(comment) @ignore
|
||||
1
queries/fish/injections.scm
Normal file
1
queries/fish/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(comment) @comment @combined
|
||||
10
queries/fish/locals.scm
Normal file
10
queries/fish/locals.scm
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
;; Scopes
|
||||
(function_definition) @scope
|
||||
|
||||
;; Definitions
|
||||
(function_definition
|
||||
name: (word) @definition.function)
|
||||
|
||||
;; References
|
||||
(variable_name) @reference
|
||||
(word) @reference
|
||||
Loading…
Add table
Add a link
Reference in a new issue