C# improvements (#86)
* fix: Fixing csharp docs for interfaces * feat(csharp): adding type params support
This commit is contained in:
@@ -12,7 +12,7 @@ return {
|
|||||||
"delegate_declaration",
|
"delegate_declaration",
|
||||||
"conversion_operator_declaration",
|
"conversion_operator_declaration",
|
||||||
},
|
},
|
||||||
class = { "class_declaration" },
|
class = { "class_declaration", "interface_declaration" },
|
||||||
type = { "field_declaration", "property_declaration", "event_field_declaration", "indexer_declaration" },
|
type = { "field_declaration", "property_declaration", "event_field_declaration", "indexer_declaration" },
|
||||||
},
|
},
|
||||||
data = {
|
data = {
|
||||||
@@ -36,13 +36,49 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
retrieve = "first",
|
retrieve = "first",
|
||||||
node_type = "block",
|
node_type = "type_parameter_list",
|
||||||
subtree = {
|
subtree = {
|
||||||
{
|
{
|
||||||
retrieve = "first",
|
retrieve = "all",
|
||||||
recursive = true,
|
node_type = "type_parameter",
|
||||||
node_type = "return_statement",
|
subtree = {
|
||||||
|
{ position = 1, extract = true, as = i.Tparam },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position = 1,
|
||||||
extract = true,
|
extract = true,
|
||||||
|
as = i.Return
|
||||||
|
},
|
||||||
|
}
|
||||||
|
local nodes = nodes_utils:matching_nodes_from(node, tree)
|
||||||
|
local res = extractors:extract_from_matched(nodes)
|
||||||
|
if res.return_statement[1] == "void" then
|
||||||
|
res.return_statement = nil
|
||||||
|
end
|
||||||
|
res.identifier = res["_"]
|
||||||
|
return res
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
class = {
|
||||||
|
["class_declaration|interface_declaration"] = {
|
||||||
|
["0"] = {
|
||||||
|
extract = function(node)
|
||||||
|
local tree = {
|
||||||
|
{
|
||||||
|
retrieve = "first",
|
||||||
|
node_type = "type_parameter_list",
|
||||||
|
subtree = {
|
||||||
|
{
|
||||||
|
retrieve = "all",
|
||||||
|
node_type = "type_parameter",
|
||||||
|
subtree = {
|
||||||
|
{ position = 1, extract = true, as = i.Tparam },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -55,15 +91,6 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
class = {
|
|
||||||
["class_declaration"] = {
|
|
||||||
["0"] = {
|
|
||||||
extract = function()
|
|
||||||
return {}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
type = {
|
type = {
|
||||||
["field_declaration|property_declaration|event_field_declaration"] = {
|
["field_declaration|property_declaration|event_field_declaration"] = {
|
||||||
["0"] = {
|
["0"] = {
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ return {
|
|||||||
|
|
||||||
{ nil, "/// <summary>", {} },
|
{ nil, "/// <summary>", {} },
|
||||||
{ nil, "/// $1", {} },
|
{ nil, "/// $1", {} },
|
||||||
{ i.Parameter, '/// <param name="%s">$1</param>', { type = { "func", "type" } } },
|
|
||||||
{ i.Return, "/// <returns>$1</returns>", { type = { "func", "type" } } },
|
|
||||||
{ nil, "/// </summary>", {} },
|
{ nil, "/// </summary>", {} },
|
||||||
|
{ i.Parameter, '/// <param name="%s">$1</param>', { type = { "func", "type" } } },
|
||||||
|
{ i.Tparam, '/// <typeparam name="%s">$1</typeparam>', { type = { "func", "class" } } },
|
||||||
|
{ i.Return, "/// <returns>$1</returns>", { type = { "func", "type" } } },
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user