mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(snippet): do not add extra indent on newlines (#28538)
Reverts parts of https://github.com/neovim/neovim/pull/27674 LSP snippets typically do include tabs or spaces to add extra indentation and don't rely on the client using `autoindent` functionality. For example: public static void main(String[] args) {\n\t${0}\n} Notice the `\t` after `{\n` Adding spaces or tabs independent of that breaks snippets for languages like Haskell where you can have snippets like: ${1:name} :: ${2}\n${1:name} ${3}= ${0:undefined} To generate: name :: name = undefined
This commit is contained in:

committed by
GitHub

parent
c3061a40f7
commit
4625394a76
@@ -459,8 +459,7 @@ function M.expand(input)
|
||||
end
|
||||
-- Add the base indentation.
|
||||
if i > 1 then
|
||||
line = #line ~= 0 and base_indent .. line
|
||||
or (expandtab and (' '):rep(shiftwidth) or '\t'):rep(vim.fn.indent('.') / shiftwidth + 1)
|
||||
line = base_indent .. line
|
||||
end
|
||||
lines[#lines + 1] = line
|
||||
end
|
||||
|
Reference in New Issue
Block a user