Skip to content

Commit

Permalink
Add Buildkite command/commands support to yaml injections (helix-edit…
Browse files Browse the repository at this point in the history
…or#10090)

* Use any-of instead of match in yaml injections

Go back to original intent when this code was first written now that the
tree-sitter version used supports any-of?.

* yaml/injections: Add injection for Buildkite

Buildkite uses `command` (`commands` is an alias) to define the
command(s) to run for the step.
  • Loading branch information
mmlb authored and postsolar committed Apr 4, 2024
1 parent 22d89cf commit 48f7f22
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions runtime/queries/yaml/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,24 @@

; Modified for Helix from https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/yaml/injections.scm

;; Github actions ("run") / Gitlab CI ("scripts")
;; Github actions: run
;; Gitlab CI: scripts, before_script, after_script
;; Buildkite: command, commands
(block_mapping_pair
key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$")
key: (flow_node) @_run (#any-of? @_run "run" "script" "before_script" "after_script" "command" "commands")
value: (flow_node
(plain_scalar
(string_scalar) @injection.content)
(#set! injection.language "bash")))

(block_mapping_pair
key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$")
key: (flow_node) @_run (#any-of? @_run "run" "script" "before_script" "after_script" "command" "commands")
value: (block_node
(block_scalar) @injection.content
(#set! injection.language "bash")))

(block_mapping_pair
key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$")
key: (flow_node) @_run (#any-of? @_run "run" "script" "before_script" "after_script" "command" "commands")
value: (block_node
(block_sequence
(block_sequence_item
Expand All @@ -45,7 +47,7 @@
(#set! injection.language "bash")))))

(block_mapping_pair
key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$")
key: (flow_node) @_run (#any-of? @_run "run" "script" "before_script" "after_script" "command" "commands")
value: (block_node
(block_sequence
(block_sequence_item
Expand Down

0 comments on commit 48f7f22

Please sign in to comment.