Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions queries/yaml/aerial.scm
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,19 @@
value: (block_node
(block_sequence) @symbol)
(#set! "kind" "Enum")) @start

; "array element" with a "name:" key
; ansible play/task names, etc
; github workflow/actions jobs/steps, etc
(block_sequence_item
(block_node
(block_mapping
(block_mapping_pair
key: (flow_node
(plain_scalar
(string_scalar) @_key))
value: (flow_node
(plain_scalar
(string_scalar) @name)))))
(#eq? @_key "name")
(#set! "kind" "Module")) @symbol
83 changes: 83 additions & 0 deletions tests/symbols/yaml_test2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[
{
"children": [
{
"children": [
{
"children": [
{
"col": 6,
"end_col": 40,
"end_lnum": 15,
"kind": "Module",
"level": 3,
"lnum": 10,
"name": "Prepare",
"selection_range": {
"col": 14,
"end_col": 21,
"end_lnum": 10,
"lnum": 10
}
},
{
"col": 6,
"end_col": 0,
"end_lnum": 19,
"kind": "Module",
"level": 3,
"lnum": 17,
"name": "Run Luacheck",
"selection_range": {
"col": 14,
"end_col": 26,
"end_lnum": 17,
"lnum": 17
}
}
],
"col": 4,
"end_col": 0,
"end_lnum": 19,
"kind": "Enum",
"level": 2,
"lnum": 7,
"name": "steps",
"selection_range": {
"col": 4,
"end_col": 9,
"end_lnum": 7,
"lnum": 7
}
}
],
"col": 2,
"end_col": 0,
"end_lnum": 19,
"kind": "Class",
"level": 1,
"lnum": 4,
"name": "luacheck",
"selection_range": {
"col": 2,
"end_col": 10,
"end_lnum": 4,
"lnum": 4
}
}
],
"col": 0,
"end_col": 0,
"end_lnum": 19,
"kind": "Class",
"level": 0,
"lnum": 3,
"name": "jobs",
"selection_range": {
"col": 0,
"end_col": 4,
"end_lnum": 3,
"lnum": 3
}
}
]
18 changes: 18 additions & 0 deletions tests/treesitter/yaml_test2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run tests

jobs:
luacheck:
name: Luacheck
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Prepare
run: |
sudo apt-get update
sudo add-apt-repository universe
sudo apt install luarocks -y
sudo luarocks install luacheck

- name: Run Luacheck
run: luacheck lua tests