Skip to content

Commit

Permalink
Update tree-sitter-robot (#7970)
Browse files Browse the repository at this point in the history
* Update tree-sitter-robot

* Update Robot highlights query for Helix

* Change @comment.single to @comment

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
  • Loading branch information
Hubro and the-mikedavis committed Aug 18, 2023
1 parent 2b7e7c8 commit 18a79aa
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 14 deletions.
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ language-servers = [ "robotframework_ls" ]

[[grammar]]
name = "robot"
source = { git = "https://github.com/Hubro/tree-sitter-robot", rev = "f1142bfaa6acfce95e25d2c6d18d218f4f533927" }
source = { git = "https://github.com/Hubro/tree-sitter-robot", rev = "322e4cc65754d2b3fdef4f2f8a71e0762e3d13af" }

[[language]]
name = "r"
Expand Down
64 changes: 51 additions & 13 deletions runtime/queries/robot/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,21 +1,59 @@
(comment) @comment
[
(comment)
(extra_text)
] @comment

[
(section_header)
(setting_statement)
(keyword_setting)
(test_case_setting)
] @keyword

(variable_definition (variable_name) @variable)
(keyword_definition (name) @function)
(test_case_definition (name) @function)

(keyword_invocation (keyword) @function)
(ellipses) @punctuation.delimiter

(section_header) @keyword
(extra_text) @comment
(text_chunk) @string
(inline_python_expression) @string.special
[
(scalar_variable)
(list_variable)
(dictionary_variable)
] @variable

(setting_statement) @keyword
; Control structures

(variable_definition (variable_name) @variable)
"RETURN" @keyword.control.return

(keyword_definition (name) @function)
(keyword_definition (body (keyword_setting) @keyword))
[
"FOR"
"IN"
"IN RANGE"
"IN ENUMERATE"
"IN ZIP"
(break_statement)
(continue_statement)
] @keyword.control.repeat
(for_statement "END" @keyword.control.repeat)

(test_case_definition (name) @property)
"WHILE" @keyword.control.repeat
(while_statement "END" @keyword.control.repeat)

(keyword_invocation (keyword) @function)
[
"IF"
"ELSE IF"
] @keyword.control.conditional
(if_statement "END" @keyword.control.conditional)
(if_statement (else_statement "ELSE" @keyword.control.conditional))

(argument (text_chunk) @string)
(argument (scalar_variable) @string.special)
(argument (list_variable) @string.special)
(argument (dictionary_variable) @string.special)
[
"TRY"
"EXCEPT"
"FINALLY"
] @keyword.control.exception
(try_statement "END" @keyword.control.exception)
(try_statement (else_statement "ELSE" @keyword.control.exception))

0 comments on commit 18a79aa

Please sign in to comment.