From df4390d66650d64bd439d2bd1f40c3753d420568 Mon Sep 17 00:00:00 2001 From: Oleksandr Smirnov Date: Tue, 18 Mar 2025 22:50:55 +0200 Subject: [PATCH] docs(ts): add an explanation --- lua/gopher/_utils/ts/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/gopher/_utils/ts/init.lua b/lua/gopher/_utils/ts/init.lua index 36b6b4a..02c0d6a 100644 --- a/lua/gopher/_utils/ts/init.lua +++ b/lua/gopher/_utils/ts/init.lua @@ -67,7 +67,10 @@ function ts.get_struct_under_cursor(bufnr) error "No nodes found under cursor" end - local parent_node = get_parrent_node("type_spec", node) + --- should be both type_spec and type_declaration + --- because in cases like `type ( T struct{}, U strict{} )` + --- i will be choosing always last struct in the list + local parent_node = get_parrent_node({ "type_spec", "type_declaration" }, node) if not parent_node then error "No struct found under cursor" end