fix: add interface type to golang treesitter backend (#180)

This commit is contained in:
Steven Arcangeli 2022-11-08 09:03:38 -08:00
parent 3423358895
commit 480bf14332
4 changed files with 13 additions and 1 deletions

View file

@ -35,6 +35,7 @@ return {
},
go = {
function_declaration = "Function",
interface_type = "Interface",
method_declaration = "Method",
struct_type = "Struct",
},

View file

@ -4,7 +4,7 @@
(type_declaration
(type_spec
name: (type_identifier) @name
type: (struct_type) @type)) @start
type: [(struct_type) (interface_type)] @type)) @start
(method_declaration
name: (field_identifier) @name

View file

@ -30,6 +30,15 @@ describe("treesitter go", function()
end_lnum = 7,
end_col = 23,
},
{
kind = "Interface",
name = "MyInterface",
level = 0,
lnum = 9,
col = 0,
end_lnum = 9,
end_col = 28,
},
})
end)
end)

View file

@ -5,3 +5,5 @@ func fn_1() {}
type st_1 struct{}
func (st_1) Meth_1() {}
type MyInterface interface{}