elixir exunit, label test+describe

This commit is contained in:
Emmanuel Touzery 2023-02-07 17:38:50 +01:00
parent 391e68350d
commit f2b04c7c2c
3 changed files with 9 additions and 5 deletions

View file

@ -82,6 +82,10 @@ M.elixir = {
local protocol = (utils.get_at_path(match, "protocol") or {}).node
local protocol_name = vim.treesitter.query.get_node_text(protocol, bufnr) or "<parse error>"
item.name = string.format("%s > %s", item.name, protocol_name)
elseif name == "test" then
item.name = string.format("test %s", item.name)
elseif name == "describe" then
item.name = string.format("describe %s", item.name)
end
elseif item.kind == "Constant" then
item.name = string.format("@%s", item.name)

View file

@ -58,14 +58,14 @@
(#set! "kind" "Function")
) @start
; describe("Unit test")
; exunit unit test
(call
target: (identifier) @identifier (#any-of? @identifier "describe" "test")
(arguments [(string (quoted_content) @name)])
(#set! "kind" "Function")
) @type
; describe("Unit test")
; exunit test setup
(do_block
(call
target: (identifier) @identifier @name (#eq? @identifier "setup")) @type

View file

@ -186,7 +186,7 @@ describe("treesitter elixir", function()
children = {
{
kind = "Function",
name = "String.capitalize/1",
name = "describe String.capitalize/1",
level = 1,
lnum = 46,
col = 2,
@ -204,7 +204,7 @@ describe("treesitter elixir", function()
},
{
kind = "Function",
name = "first grapheme is in uppercase",
name = "test first grapheme is in uppercase",
level = 2,
lnum = 51,
col = 4,
@ -213,7 +213,7 @@ describe("treesitter elixir", function()
},
{
kind = "Function",
name = "converts remaining graphemes to lowercase",
name = "test converts remaining graphemes to lowercase",
level = 2,
lnum = 55,
col = 4,