mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
fix(cmp): dont add autobrackets if prev char is a bracket. Closes #2949
This commit is contained in:
parent
fc5ee49495
commit
c70a78e631
1 changed files with 5 additions and 2 deletions
|
@ -84,8 +84,11 @@ return {
|
|||
local entry = event.entry
|
||||
local item = entry:get_completion_item()
|
||||
if vim.tbl_contains({ Kind.Function, Kind.Method }, item.kind) then
|
||||
local keys = vim.api.nvim_replace_termcodes("()<left>", false, false, true)
|
||||
vim.api.nvim_feedkeys(keys, "i", true)
|
||||
local prev_char = vim.fn.getline("."):sub(vim.fn.col(".") - 1, vim.fn.col("."))
|
||||
if prev_char ~= "(" and prev_char ~= ")" then
|
||||
local keys = vim.api.nvim_replace_termcodes("()<left>", false, false, true)
|
||||
vim.api.nvim_feedkeys(keys, "i", true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue