Skip to content

Commit

Permalink
style: format queries with neovim script
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotfontaine committed Oct 8, 2024
1 parent 94f8a6e commit 33416f7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 31 deletions.
9 changes: 4 additions & 5 deletions runtime/queries/cylc/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
quotes_close: _ @string)

[
(graph_logical)
(graph_logical)
(graph_arrow)
(graph_parenthesis)
] @operator
Expand All @@ -80,11 +80,11 @@
"]" @tag)

(task_output
":" @tag
(nametag) @variable.other)
":" @tag
(nametag) @variable.other)

(task_output
"?"? @tag)
"?"? @tag)

(setting
key: (key) @variable
Expand All @@ -98,4 +98,3 @@
]?)

(datetime) @constant.numeric.float

29 changes: 12 additions & 17 deletions runtime/queries/cylc/indents.scm
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
[
(top_section)
(sub_section_1)
(sub_section_2)
(graph_section)
(runtime_section)
(task_section)
(top_section)
(sub_section_1)
(sub_section_2)
(graph_section)
(runtime_section)
(task_section)
] @indent

[
(top_section)
(sub_section_1)
(sub_section_2)
(graph_section)
(runtime_section)
(task_section)
(top_section)
(sub_section_1)
(sub_section_2)
(graph_section)
(runtime_section)
(task_section)
] @extend

; Doesn't work ?
; (unquoted_string
; (string_content) @anchor) @align

(line_continuation) @indent.always

14 changes: 8 additions & 6 deletions runtime/queries/cylc/injections.scm
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
((setting
key: (key) @key (#match? @key "^script$|-script$|^script-")
value: (_
key: (key) @key
(#match? @key "^script$|-script$|^script-")
value: (_
(string_content) @injection.content))
(#set! "injection.language" "bash"))
(#set! "injection.language" "bash"))

; Requires no spacing around "=" in environment settings for proper highlighting.
; Could be improved if Tree-sitter allowed to specify the target node of the injected
; Could be improved if Tree-sitter allowed to specify the target node of the injected
; language, instead of always using the root node.
; See this proposal:
; https://github.com/tree-sitter/tree-sitter/issues/3625
((task_section
(sub_section_2
name: (_) @section_name (#eq? @section_name "environment")
name: (_) @section_name
(#eq? @section_name "environment")
(setting) @injection.content))
(#set! "injection.language" "bash")
(#set! injection.combined)
(#set! injection.include-children))
(#set! injection.include-children))
9 changes: 6 additions & 3 deletions runtime/queries/cylc/textobjects.scm
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(comment) @comment.inside

(comment)+ @comment.around

(_
brackets_open: _
name: _?
name: _?
brackets_close: _
_* @class.inside) @class.around

Expand All @@ -14,7 +15,9 @@
value: _? @function.inside) @function.around

(graph_string_content
((graph_task) @entry.inside))
(graph_task) @entry.inside)

(task_parameter
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
((_) @parameter.inside
.
","? @parameter.around) @parameter.around)

0 comments on commit 33416f7

Please sign in to comment.