Don't drop argument if type uses generics in signature refactor

This commit is contained in:
Mathias Fussenegger 2023-11-01 08:27:10 +01:00 committed by Mathias Fußenegger
parent a09f8cdd75
commit 7356238ee3

View file

@ -483,7 +483,7 @@ local function change_signature(bufnr, command, code_action_params)
if vim.startswith(line, "---") then
break
elseif expect_param_next and vim.startswith(line, "- ") then
local matches = { line:match("%- ((%d+):) (%w+) (%w+)") }
local matches = { line:match("%- ((%d+):) ([^ ]+) (%w+)") }
if next(matches) then
table.insert(parameters, {
name = matches[4],
@ -491,7 +491,7 @@ local function change_signature(bufnr, command, code_action_params)
type = matches[3],
})
else
matches = { line:match("%- (%w+) (%w+) ?(%w*)") }
matches = { line:match("%- (%w+) ([^ ]+) ?(%w*)") }
if next(matches) then
table.insert(parameters, {
type = matches[1],