-
Notifications
You must be signed in to change notification settings - Fork 35
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
User-provided completion does not work with lua function #57
Comments
The input buffer makes use of a custom user-completion function (see I have a manual test file that I use to test various completion sources. Can you source this file and confirm that for the options using lua functions you do not see any completion menu when you press |
Will try tonight or tomorrow. Thanks |
@stevearc I tried the file you suggested and it works properly, so definitively there is something wrñg in my implementation |
Ok, I found the problem and I am able to reproduce it. Not sure who is to blame here: neovim, dressing or the "components" library. function _G.custom_complete_func(arglead, cmdline, cursorpos)
return vim.fn.expand("<cword>")
end It seems that, when the popup has the focus, the |
Oh, unfortunately I believe this is a product of how Neovim works. The built-in I'd recommend one of the following:
|
There is also a third option which is what I’m doing 😄.
Since this is triggered by a function that I call using a key bind I just
expand it before calling vim.ui.input and then I pass it as an argument to
a curried version of my expand function.
Works nice for me.
Another option I can think of is mapping backspace to C-u within the
buffer? Don’t know, this works fine for me
On Wed, 31 Aug 2022 at 17:31, Steven Arcangeli ***@***.***> wrote:
Oh, unfortunately I believe this is a product of how Neovim works. The
built-in vim.ui.input happens in command mode, which happens
synchronously and doesn't interact with the rest of your vim state. Since
we're opening floating windows and moving the cursor around, there's just
no way for this implementation to preserve the original <cword>.
I'd recommend one of the following:
1. Pass in vim.fn.expand('<cword>') as the default to vim.ui.input.
That way it's present when you want it, and very easy to delete (with
<C-u>) if you don't.
2. Set your dressing config to detect when you're using this
completion function, and disable dressing in that case (so it will use the
built-in input in command mode). See #29
<#29> for more
information on how to conditionally disable dressing.
—
Reply to this email directly, view it on GitHub
<#57 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARKJWI7NCIKQKKG4JZY6BLV353FXANCNFSM57TQK5WQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
---
https://danielorodriguez.com
|
Tried the mentioned commit (that specific one) and now it does not crash, but no autocomplete happens either. I am trying the same key to trigger the autocomplete that previously was making it crash, so I guess it's the correct one
Originally posted by @danielo515 in #55 (comment)
The text was updated successfully, but these errors were encountered: