mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(yaml): inject bash for taskfiles (#7804)
This commit is contained in:
parent
e5c8398e44
commit
205faba176
2 changed files with 20 additions and 4 deletions
|
|
@ -2,9 +2,10 @@
|
|||
(#set! injection.language "comment"))
|
||||
|
||||
; Github actions ("run") / Gitlab CI ("scripts")
|
||||
; Taskfile scripts ("cmds", "sh")
|
||||
(block_mapping_pair
|
||||
key: (flow_node) @_run
|
||||
(#any-of? @_run "run" "script" "before_script" "after_script")
|
||||
(#any-of? @_run "run" "script" "before_script" "after_script" "cmds" "sh")
|
||||
value: (flow_node
|
||||
(plain_scalar
|
||||
(string_scalar) @injection.content)
|
||||
|
|
@ -12,7 +13,7 @@
|
|||
|
||||
(block_mapping_pair
|
||||
key: (flow_node) @_run
|
||||
(#any-of? @_run "run" "script" "before_script" "after_script")
|
||||
(#any-of? @_run "run" "script" "before_script" "after_script" "cmds" "sh")
|
||||
value: (block_node
|
||||
(block_scalar) @injection.content
|
||||
(#set! injection.language "bash")
|
||||
|
|
@ -20,7 +21,7 @@
|
|||
|
||||
(block_mapping_pair
|
||||
key: (flow_node) @_run
|
||||
(#any-of? @_run "run" "script" "before_script" "after_script")
|
||||
(#any-of? @_run "run" "script" "before_script" "after_script" "cmds" "sh")
|
||||
value: (block_node
|
||||
(block_sequence
|
||||
(block_sequence_item
|
||||
|
|
@ -31,7 +32,7 @@
|
|||
|
||||
(block_mapping_pair
|
||||
key: (flow_node) @_run
|
||||
(#any-of? @_run "script" "before_script" "after_script")
|
||||
(#any-of? @_run "script" "before_script" "after_script" "cmds" "sh")
|
||||
value: (block_node
|
||||
(block_sequence
|
||||
(block_sequence_item
|
||||
|
|
|
|||
15
tests/query/injections/yaml/bash-on-taskfiles.yml
Normal file
15
tests/query/injections/yaml/bash-on-taskfiles.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# https://taskfile.dev
|
||||
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
GREETING:
|
||||
sh: echo "Hello, World!"
|
||||
# ^ @bash
|
||||
|
||||
tasks:
|
||||
default:
|
||||
cmds:
|
||||
- echo "{{.GREETING}}"
|
||||
# ^ @bash
|
||||
silent: true
|
||||
Loading…
Add table
Add a link
Reference in a new issue