mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 17:58:51 +02:00
fix(snippets): fix snippets with multiple placeholders for the same tabstop
This commit is contained in:
parent
eb0da3c92f
commit
1b86d7b2ad
1 changed files with 3 additions and 3 deletions
|
@ -28,10 +28,10 @@ end
|
|||
|
||||
-- This function replaces nested placeholders in a snippet with LSP placeholders.
|
||||
function M.snippet_fix(snippet)
|
||||
local nn = 0
|
||||
local texts = {} ---@type table<number, string>
|
||||
return M.snippet_replace(snippet, function(placeholder)
|
||||
nn = nn + 1
|
||||
return "${" .. nn .. ":" .. M.snippet_preview(placeholder.text) .. "}"
|
||||
texts[placeholder.n] = texts[placeholder.n] or M.snippet_preview(placeholder.text)
|
||||
return "${" .. placeholder.n .. ":" .. texts[placeholder.n] .. "}"
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue