feat(snippets): re-number tabstops for invalid snippets

This commit is contained in:
Folke Lemaitre
2024-05-28 16:12:35 +02:00
parent 025ba33dc3
commit cf4374867d

View File

@ -23,8 +23,10 @@ end
-- This function replaces nested placeholders in a snippet with LSP placeholders.
function M.snippet_fix(snippet)
local nn = 0
return M.snippet_replace(snippet, function(placeholder)
return "${" .. placeholder.n .. ":" .. M.snippet_preview(placeholder.text) .. "}"
nn = nn + 1
return "${" .. nn .. ":" .. M.snippet_preview(placeholder.text) .. "}"
end)
end