feat(java): add support for constructors

This commit is contained in:
Dimitris Gianneler 2022-12-30 15:22:30 +02:00
parent 7e2fef6ec5
commit 8b8129e730
No known key found for this signature in database
GPG key ID: C0B9922200D12EB4
3 changed files with 18 additions and 3 deletions

View file

@ -8,6 +8,11 @@
(#set! "kind" "Method")
) @type
(constructor_declaration
name: (identifier) @name
(#set! "kind" "Constructor")
) @type
(class_declaration
name: (identifier) @name
(#set! "kind" "Class")

View file

@ -29,7 +29,7 @@ describe("treesitter java", function()
level = 0,
lnum = 5,
col = 0,
end_lnum = 9,
end_lnum = 10,
end_col = 1,
children = {
{
@ -59,15 +59,24 @@ describe("treesitter java", function()
end_lnum = 8,
end_col = 24,
},
{
kind = "Constructor",
name = "Cl_1",
level = 1,
lnum = 9,
col = 2,
end_lnum = 9,
end_col = 12,
},
},
},
{
kind = "Enum",
name = "En_1",
level = 0,
lnum = 11,
lnum = 12,
col = 0,
end_lnum = 11,
end_lnum = 12,
end_col = 13,
},
})

View file

@ -6,6 +6,7 @@ class Cl_1 {
void meth_2() { }
private int field_1;
public Object field_2;
Cl_1() { }
}
enum En_1 { }