Open RaafatTurki opened 2 years ago
First, some background on why things are the way they are:
There's a bit of conflict between the two sources of configuration for vim.ui.input
. The first source is the callsite, which can pass in a completion
argument to define what kind of completion to use (see [:help vim.ui.select()](https://neovim.io/doc/user/lua.html#vim.ui.input())). The second is the end user, who might want to have specific types of completion for specific types of dialogs. Additionally, the callsite has to limit itself to what's available in the bare Neovim API, whereas the user might want to use something else (e.g. LSP completion). Complicating the issue, there is no good way to tell what the purpose of the vim.ui.input
dialog is. [vim.ui.select()](https://neovim.io/doc/user/lua.html#vim.ui.select()) has the kind
option for exactly this situation, but there is no such affordance for input.
I think a logical next step would be to make the existing completion
option work with the autocomplete plugins. I believe that could be done with not too much effort, and would be a clear win.
To enable context-aware user-specified completion methods, that will be more difficult. I think the first step would be to make a PR to Neovim that adds kind
to the vim.ui.input
API, and to set unique values in the relevant locations (e.g. LSP rename). The next step would be to add config options to dressing that can both configure the autocompletion plugins, and also set a "default" completion method if none is specified by the callsite. I think that would then unlock the functionality you're asking for.
In case you set the completion in call site, is it expected to work? Or will it fail? I'm asking because I just opened an issue in neovim (https://github.com/neovim/neovim/issues/19907) and now I am thinking if this is actually a bug in dressing.nvim
@danielo515 setting the completion from the callsite is expected to work. There was a bug when the completion method was a custom lua function, but it should be fixed in 96b09a0e3c7c457140303c796bd84f13cfd9dbc0
Thanks for your confirmation @stevearc. I'll keep the issue in neovim repo open then
@danielo515 Oh no, I just pushed up that fix. I think that the report was a bug in dressing and not neovim. Try again on the latest master and see if it still repros.
Oh, ok, sorry for the confusion. In any case, they already closed the neovim issue with a comment that, for my personal taste is a bit harsh. I will try the latest commit and report back, thank you
On Tue, Aug 23, 2022 at 9:24 PM Steven Arcangeli @.***> wrote:
@danielo515 https://github.com/danielo515 Oh no, I just pushed up that fix. I think that the report was a bug in dressing and not neovim. Try again on the latest master and see if it still repros.
— Reply to this email directly, view it on GitHub https://github.com/stevearc/dressing.nvim/issues/55#issuecomment-1224683873, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWIF4WMZNQ4GAEGYNP3V2UQOVANCNFSM57CCUMOQ . You are receiving this because you were mentioned.Message ID: @.***>
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
@danielo515 I'm moving your discussion to #57, as this is now quite different from the original posted issue discussing the enabling of autocompletion engines in the input buffer.
are there any updates on getting completion in DressingInput? by manually adding things to DressingInput
in the cmp config, I managed to get a popup menu upon, but not the ability to select things in it 🥴
I just pushed up commit. If you have both nvim-cmp
and cmp_omni
installed you should have autocompletion now
wow, this is indeed pretty cool.
With this I got a cmdline replacement for :
, including completion of commands
-- : via dressing
cmp.setup.filetype("DressingInput", {
sources = cmp.config.sources { {name = "omni"} },
})
keymap("n", ":", function ()
vim.ui.input({ completion = "command"}, function (input)
if not(input) then return end
cmd(input)
end)
end, {desc = ": cmdline replacement"})
unfortunate, that it seems you cannot get multiple completions (e.g., commands and option)? 🤔
Unfortunately, the built-in input()
method (and thus vim.ui.input
) do not support multiple types of completion. If you want to hack it yourself, you could set the omnifunc in the input buffer to a custom function that completes commands and options.
I managed to use some weird tricks to allow completion on the input, but with a custom function. Do you have a better approach?
{ completion = "command"},
i want to have path completion. is it possible to have?
See :help command-complete
. You can get path completion by doing completion = "dir"
or completion = "file"
Hi, I'm a bit confused as to how one would re-enable completion engines such as
cmp
andmini
as both are currently explicitly disabled with no option to prevent that.Additionally and ideally there would be a hook of some sort that users can setup their completion engines within per
vim.ui.input
call. That way for example whenvim.ui.input
is used to do an LSP rename, one could enablecmp
with sources that make sense in that context (buffer
,spell
,rg
.. etc) which aid in the operation of LSP renaming.It really sounds like I'm asking for some hooks per
vim.ui.input
call here but I didn't want to be vague in order to eliminate any chance of having an XY problem here.I might be missing something obvious here, wdyt?