feat(queries): add basic yaml support

This commit is contained in:
Gleb Buzin 2022-06-04 21:00:49 +03:00
parent ece90c4820
commit c29e53a1b8
No known key found for this signature in database
GPG key ID: 6398BE5B25E5BDE2
4 changed files with 105 additions and 0 deletions

View file

@ -122,4 +122,8 @@ return {
vim = {
function_definition = "Function",
},
yaml = {
block_mapping = "Class",
block_sequence = "Enum",
},
}

7
queries/yaml/aerial.scm Normal file
View file

@ -0,0 +1,7 @@
(block_mapping_pair
key: (flow_node) @name
value: (block_node (block_mapping) @type)) @start
(block_mapping_pair
key: (flow_node) @name
value: (block_node (block_sequence) @type)) @start

View file

@ -0,0 +1,77 @@
local util = require("tests.test_util")
describe("treesitter yaml", function()
it("parses all symbols correctly", function()
util.test_file_symbols("treesitter", "./tests/treesitter/yaml_test.yml", {
{
kind = "Class",
name = "services",
level = 0,
lnum = 3,
col = 0,
end_lnum = 10,
end_col = 24,
children = {
{
kind = "Class",
name = "proxy",
level = 1,
lnum = 4,
col = 2,
end_lnum = 7,
end_col = 15,
children = {
{
kind = "Enum",
name = "ports",
level = 2,
lnum = 6,
col = 4,
end_lnum = 7,
end_col = 15,
},
},
},
{
kind = "Class",
name = "db",
level = 1,
lnum = 9,
col = 2,
end_lnum = 10,
end_col = 24,
},
},
},
{
kind = "Class",
name = "volumes",
level = 0,
lnum = 12,
col = 0,
end_lnum = 14,
end_col = 18,
children = {
{
kind = "Class",
name = "media-volume",
level = 1,
lnum = 13,
col = 2,
end_lnum = 14,
end_col = 18,
},
},
},
{
kind = "Class",
name = "networks",
level = 0,
lnum = 16,
col = 0,
end_lnum = 18,
end_col = 0,
},
})
end)
end)

View file

@ -0,0 +1,17 @@
version: "4.7"
services:
proxy:
image: "traefik:v2.5.3"
ports:
- "80:80"
db:
image: "postgres:14"
volumes:
media-volume:
external: true
networks:
traefik-public: null