aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/snippet.lua
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2024-04-28 12:49:25 +0200
committerGitHub <noreply@github.com>2024-04-28 12:49:25 +0200
commit4625394a767fab311f75ef40f4f15c661156e071 (patch)
treefe97624375a4c5484ab5678d0ab45b8f99cff3b2 /runtime/lua/vim/snippet.lua
parentc3061a40f7012b4cd9afcaa6e8b856e946aed528 (diff)
downloadrneovim-4625394a767fab311f75ef40f4f15c661156e071.tar.gz
rneovim-4625394a767fab311f75ef40f4f15c661156e071.tar.bz2
rneovim-4625394a767fab311f75ef40f4f15c661156e071.zip
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
Diffstat (limited to 'runtime/lua/vim/snippet.lua')
-rw-r--r--runtime/lua/vim/snippet.lua3
1 files changed, 1 insertions, 2 deletions
diff --git a/runtime/lua/vim/snippet.lua b/runtime/lua/vim/snippet.lua
index a1e3360b2d..37416c389f 100644
--- a/runtime/lua/vim/snippet.lua
+++ b/runtime/lua/vim/snippet.lua
@@ -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