Skip to content

Commit 9ba7ded

Browse files
committed
fix: make interface edge case its own capture group
1 parent 80b9b0c commit 9ba7ded

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/auto-fix-return/lib.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ M.wrap_golang_return = function()
5656
;; (ERROR)))) ; [16, 11] - [16, 12]
5757
;; We need to handle this case specifically so we anchor it to the ancestor node for interface
5858
(
59-
(ERROR)? @error_end (#has-parent? @error_end interface_type)
59+
(ERROR)? @error_interface_end (#has-parent? @error_interface_end interface_type)
6060
)
6161
)
6262
;; This is a weird edgecase in regards to handling multi returns, an in progress multireturn on a top level function is
@@ -103,7 +103,7 @@ M.wrap_golang_return = function()
103103
elseif capture_name == "result" and final_end_row ~= 0 then
104104
final_end_col = end_col
105105
final_end_row = end_row
106-
elseif capture_name == "error_end" then
106+
elseif capture_name == "error_end" or capture_name == "error_interface_end" then
107107
final_end_col = end_col
108108
final_end_row = end_row
109109
end

0 commit comments

Comments
 (0)