-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work together with nvim-cmp #2
Comments
For ['<CR>'] = function()
cmp.mapping.confirm({ select = true })()
require('pairs'):type_enter()
end If this not work, please inform me. Cause I am not familiar with
Integration with completion plugin will be considered later. |
I have this same issue, and your fix does not work. This really makes this otherwise nice plugin unusable for me.
This would support other cases where you don't want the behaviour to trigger. |
@karlc1 you are right. There should be three things to do in the next commit
|
If |
@bellini666 @karlc1 A minial workaround config about pairs completion after function may be
But I do not check if it works. |
Hey @ZhiyuanLck , I could not make that with use({
"ZhiyuanLck/smart-pairs",
config = function()
require("pairs"):setup({
enter = {
enable_mapping = false,
},
})
end,
}), Then on cmp setup: local cmp = require("cmp")
local kind = cmp.lsp.CompletionItemKind
cmp.setup({
mapping = {
["<CR>"] = cmp.mapping(function(fallback)
if not cmp.confirm({ select = false }) then
require("pairs.enter").type()
end
end),
},
})
cmp.event:on("confirm_done", function(event)
local item = event.entry:get_completion_item()
local parensDisabled = item.data and item.data.funcParensDisabled or false
if not parensDisabled and (item.kind == kind.Method or item.kind == kind.Function) then
require("pairs.bracket").type_left("(")
end
end) (note: the With that config, smart-pairs and cmp are working together nicely! |
Glad to see your solution! I'll close this issue and link your comment as a temporary workaround. |
idk if I'm doing something wrong but with the workaround does not work for me. When I want to select the first match from |
@marcelarie under |
Does anyone get errors with this solution in markdown files?
|
I will 👍🏽
Me too. |
@roginfarrer it is a small bug, please creat a new issue in the next time |
I will open a new issue now, I thought it helpful to consolidate concerns with cmp to one place. Thanks! |
Do you mean like this? ["<CR>"] = cmp.mapping(function(fallback)
if not cmp.mapping.confirm({ select = true }) then
require("pairs.enter").type()
end
end), |
@bellini666 — which langserver sends @marcelarie — assuming what you want is typing few chars and hit enter (rather than manually selecting the first item using |
@marcelarie it should be |
idk how I did not see that. thanks @ajitid !! |
Pyright sends it. Don't know if it is something specific or part of the language server spec (thought it was) |
Hi,
First of all, nice plugin!
Using this plugin I can no longer confirm a completion using
nvim-cmp
with<cr>
.Also, it would be nice if this plugin can work together with it by automatically adding
(|)
when completing a function, just like https://github.com/windwp/nvim-autopairs does when you configure cmp to use it.The text was updated successfully, but these errors were encountered: