feat(rust) Complete alternative type in rust
This commit is contained in:
@@ -8,8 +8,30 @@ return {
|
|||||||
func = {
|
func = {
|
||||||
["function_item"] = {
|
["function_item"] = {
|
||||||
["0"] = {
|
["0"] = {
|
||||||
extract = function()
|
extract = function(node)
|
||||||
return {}
|
local tree = {
|
||||||
|
{
|
||||||
|
retrieve = "first",
|
||||||
|
node_type = "parameters",
|
||||||
|
subtree = {
|
||||||
|
{
|
||||||
|
retrieve = "all",
|
||||||
|
node_type = "parameter",
|
||||||
|
subtree = {
|
||||||
|
{ retrieve = "first", node_type = "identifier", extract = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
retrieve = "all",
|
||||||
|
node_type = "type_identifier",
|
||||||
|
extract = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
local nodes = neogen.utilities.nodes:matching_nodes_from(node, tree)
|
||||||
|
local res = neogen.utilities.extractors:extract_from_matched(nodes)
|
||||||
|
return res
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -52,7 +74,7 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
template = {
|
template = {
|
||||||
annotation_convention = "rustdoc",
|
annotation_convention = "alternative",
|
||||||
rustdoc = {
|
rustdoc = {
|
||||||
{ nil, "! $1", { no_results = true, type = { "file" } } },
|
{ nil, "! $1", { no_results = true, type = { "file" } } },
|
||||||
{ nil, "", { no_results = true, type = { "file" } } },
|
{ nil, "", { no_results = true, type = { "file" } } },
|
||||||
@@ -68,8 +90,10 @@ return {
|
|||||||
{ nil, "/ $1", { no_results = true, type = { "func", "class" } } },
|
{ nil, "/ $1", { no_results = true, type = { "func", "class" } } },
|
||||||
|
|
||||||
{ nil, "/ $1", { type = { "func", "class" } } },
|
{ nil, "/ $1", { type = { "func", "class" } } },
|
||||||
{ nil, "/", { type = { "class" } } },
|
{ nil, "/", { type = { "class", "func" } } },
|
||||||
{ "field_identifier", "/ * %s: $1", { type = { "class" } } },
|
{ "field_identifier", "/ * %s: $1", { type = { "class" } } },
|
||||||
|
{ "type_identifier", "/ * %s: $1", { type = { "func" } } },
|
||||||
|
{ "identifier", "/ * %s: $1", { type = { "func" } } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user