mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-23 09:18:51 +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,9 +84,12 @@ return {
|
||||||
local entry = event.entry
|
local entry = event.entry
|
||||||
local item = entry:get_completion_item()
|
local item = entry:get_completion_item()
|
||||||
if vim.tbl_contains({ Kind.Function, Kind.Method }, item.kind) then
|
if vim.tbl_contains({ Kind.Function, Kind.Method }, item.kind) then
|
||||||
|
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)
|
local keys = vim.api.nvim_replace_termcodes("()<left>", false, false, true)
|
||||||
vim.api.nvim_feedkeys(keys, "i", true)
|
vim.api.nvim_feedkeys(keys, "i", true)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue