mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
fix(snippet): modify base indentation when there's actually whitespace (#29670)
(cherry picked from commit 5fe4ce6678
)
This commit is contained in:

committed by
Christian Clason

parent
24fa65a500
commit
e13f03af85
@@ -453,7 +453,7 @@ function M.expand(input)
|
||||
local snippet_lines = text_to_lines(snippet_text)
|
||||
-- Get the base indentation based on the current line and the last line of the snippet.
|
||||
if #snippet_lines > 0 then
|
||||
base_indent = base_indent .. (snippet_lines[#snippet_lines]:match('(^%s*)%S') or '') --- @type string
|
||||
base_indent = base_indent .. (snippet_lines[#snippet_lines]:match('(^%s+)%S') or '') --- @type string
|
||||
end
|
||||
|
||||
local shiftwidth = vim.fn.shiftwidth()
|
||||
|
Reference in New Issue
Block a user