elixir: skip apidocs

This commit is contained in:
Emmanuel Touzery 2023-02-20 19:25:25 +01:00
parent faadebfd77
commit 94486d6f1d
3 changed files with 80 additions and 73 deletions

View file

@ -47,7 +47,7 @@
(unary_operator
operator: "@"
operand: (call target: (identifier) @name (#not-any-of? @name "module_attribute" "callback" "spec")) @type
operand: (call target: (identifier) @name (#not-any-of? @name "module_attribute" "callback" "spec" "doc" "moduledoc")) @type
(#set! "kind" "Constant")
) @start

View file

@ -9,31 +9,22 @@ describe("treesitter elixir", function()
level = 0,
lnum = 1,
col = 0,
end_lnum = 19,
end_lnum = 22,
end_col = 3,
children = {
{
kind = "Field",
name = ":value",
level = 1,
lnum = 2,
lnum = 5,
col = 2,
end_lnum = 2,
end_lnum = 5,
end_col = 26,
},
{
kind = "Function",
name = "public_function",
level = 1,
lnum = 4,
col = 2,
end_lnum = 5,
end_col = 5,
},
{
kind = "Function",
name = "private_function",
level = 1,
lnum = 7,
col = 2,
end_lnum = 8,
@ -41,38 +32,47 @@ describe("treesitter elixir", function()
},
{
kind = "Function",
name = "public_guard",
name = "private_function",
level = 1,
lnum = 10,
col = 2,
end_lnum = 10,
end_lnum = 11,
end_col = 5,
},
{
kind = "Function",
name = "public_guard",
level = 1,
lnum = 13,
col = 2,
end_lnum = 13,
end_col = 42,
},
{
kind = "Function",
name = "private_guard",
level = 1,
lnum = 12,
lnum = 15,
col = 2,
end_lnum = 12,
end_lnum = 15,
end_col = 43,
},
{
kind = "Function",
name = "public_macro",
level = 1,
lnum = 14,
lnum = 17,
col = 2,
end_lnum = 15,
end_lnum = 18,
end_col = 5,
},
{
kind = "Function",
name = "private_macro",
level = 1,
lnum = 17,
lnum = 20,
col = 2,
end_lnum = 18,
end_lnum = 21,
end_col = 5,
},
},
@ -81,18 +81,18 @@ describe("treesitter elixir", function()
kind = "Interface",
name = "Example.Behaviour",
level = 0,
lnum = 21,
lnum = 24,
col = 0,
end_lnum = 23,
end_lnum = 26,
end_col = 3,
children = {
{
kind = "Function",
name = "example_function",
level = 1,
lnum = 22,
lnum = 25,
col = 2,
end_lnum = 22,
end_lnum = 25,
end_col = 46,
},
},
@ -101,18 +101,18 @@ describe("treesitter elixir", function()
kind = "Struct",
name = "Example.Struct",
level = 0,
lnum = 25,
lnum = 28,
col = 0,
end_lnum = 28,
end_lnum = 31,
end_col = 3,
children = {
{
kind = "Constant",
name = "@constant",
level = 1,
lnum = 26,
lnum = 29,
col = 2,
end_lnum = 26,
end_lnum = 29,
end_col = 13,
},
},
@ -121,36 +121,7 @@ describe("treesitter elixir", function()
kind = "Interface",
name = "Example.Protocol",
level = 0,
lnum = 30,
col = 0,
end_lnum = 33,
end_col = 3,
children = {
{
kind = "TypeParameter",
name = "public_function_head",
level = 1,
lnum = 31,
col = 2,
end_lnum = 31,
end_col = 50,
},
{
kind = "Function",
name = "public_function_head",
level = 1,
lnum = 32,
col = 2,
end_lnum = 32,
end_col = 39,
},
},
},
{
kind = "Class",
name = "Map > Example.Protocol",
level = 0,
lnum = 35,
lnum = 33,
col = 0,
end_lnum = 40,
end_col = 3,
@ -159,18 +130,47 @@ describe("treesitter elixir", function()
kind = "TypeParameter",
name = "public_function_head",
level = 1,
lnum = 36,
lnum = 38,
col = 2,
end_lnum = 36,
end_lnum = 38,
end_col = 50,
},
{
kind = "Function",
name = "public_function_head",
level = 1,
lnum = 39,
col = 2,
end_lnum = 39,
end_col = 39,
},
},
},
{
kind = "Class",
name = "Map > Example.Protocol",
level = 0,
lnum = 42,
col = 0,
end_lnum = 47,
end_col = 3,
children = {
{
kind = "TypeParameter",
name = "public_function_head",
level = 1,
lnum = 43,
col = 2,
end_lnum = 43,
end_col = 56,
},
{
kind = "Function",
name = "public_function_head",
level = 1,
lnum = 37,
lnum = 44,
col = 2,
end_lnum = 39,
end_lnum = 46,
end_col = 5,
},
},
@ -179,45 +179,45 @@ describe("treesitter elixir", function()
kind = "Module",
name = "StringTest",
level = 0,
lnum = 43,
lnum = 50,
col = 0,
end_lnum = 59,
end_lnum = 66,
end_col = 3,
children = {
{
kind = "Function",
name = "describe String.capitalize/1",
level = 1,
lnum = 46,
lnum = 53,
col = 2,
end_lnum = 58,
end_lnum = 65,
end_col = 5,
children = {
{
kind = "Function",
name = "setup",
level = 2,
lnum = 47,
lnum = 54,
col = 4,
end_lnum = 49,
end_lnum = 56,
end_col = 7,
},
{
kind = "Function",
name = "test first grapheme is in uppercase",
level = 2,
lnum = 51,
lnum = 58,
col = 4,
end_lnum = 53,
end_lnum = 60,
end_col = 7,
},
{
kind = "Function",
name = "test converts remaining graphemes to lowercase",
level = 2,
lnum = 55,
lnum = 62,
col = 4,
end_lnum = 57,
end_lnum = 64,
end_col = 7,
},
},

View file

@ -1,4 +1,7 @@
defmodule Example.Module do
@moduledoc """
Module documentation
"""
@module_attribute :value
def public_function() do
@ -28,6 +31,10 @@ defmodule Example.Struct do
end
defprotocol Example.Protocol do
@doc """
function documentation
"""
@doc since: "1.3.0"
@spec public_function_head(t, atom()) :: boolean
def public_function_head(target, opt)
end