-
Notifications
You must be signed in to change notification settings - Fork 48
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
Handle completion of % and # completion correctly. #83
base: main
Are you sure you want to change the base?
Conversation
My solution may not be ideal. I would be happy to re-write it given some pointers. I'm new to lua and vim plugins. |
any plans on merging this? this problem is been a pain for a while @hrsh7th |
please :( |
I'll try and rebase my current solution and push it up. |
da5fdaf
to
8cb39fd
Compare
I am installing from this PR using the commit hash, but it would be nice to have this merged. |
In visual mode, completion doesn't keep track of typed chars, so generates wierdy items. |
The current behavior if you try to complete :e %:p:h or something similar replaces only the h with the path, which isn't the desired behavior, because then nvim tries to open the wrong filename. Detect this case and produce edits that will replace the entire `%` chain with modifiers.
Ignore fixed_input and use arglead directly in the case of a magic file match. This unbreaks `%:.:h:h`, while still handling fixed_input correctly in the non magic_file case.
589b31f
to
7e31674
Compare
I tried this "fix" and it's not working well for me, it replaces the space before the if is_magic_file then
item.insertText = item.label
item.label = arglead .. ' → ' .. item.label
end All the complicated range stuff can be dropped. Still, this is just a workaround, not an actual fix. Expansion of file wildcards is still broken, as are many other usecases where the The root cause of why this can't be fixed properly here is that Personally, I gave up and went back to nvim's builtin cmdline completion. nvim-cmp + cmp-cmdline didn't provide enough added value for me to sink additional hours into submitting a PR to neovim and then running a patched version until it makes it into a release and that release makes it to Debian. If someone else wants to pursue fixing this proper, feel free to get in touch for guidance. |
It's a dumpster fire. Not salvageable. See hrsh7th/cmp-cmdline#83 (comment) and hrsh7th/cmp-cmdline#110 (comment)
The current behavior if you try to complete :e %:p:h or something similar replaces only the h with the path, which isn't the desired behavior, because then nvim tries to open the wrong filename. Detect this case and produce edits that will replace the entire
%
chain with modifiers.