Skip to content
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

[BUG] Interaction between autocomplete option and ctags-search #5260

Open
mzanibelli opened this issue Dec 5, 2024 · 3 comments
Open

[BUG] Interaction between autocomplete option and ctags-search #5260

mzanibelli opened this issue Dec 5, 2024 · 3 comments
Labels

Comments

@mzanibelli
Copy link

mzanibelli commented Dec 5, 2024

Version of Kakoune

v2024.05.18

Reproducer

Given the following Go file with multiple symbols having the same name (should work in any language):

package main

func Foo() {}

type Foo struct{}
  • Run kak -n
  • Run :source <rc>/autoload/tools/menu.kak
  • Run :source <rc>/autoload/tools/ctags.kak
  • Run :ctags-generate

Now, given tags were successfully generated, run :ctags-search Foo.

Outcome

If set-option global autocomplete insert is set, the prompt stays empty. Press <Tab> twice to see the autocomplete list appear.
If default options are set, the autocomplete list appears correctly.

Expectations

Even when set-option global autocomplete insert, the autocomplete list should appear without needing to press <Tab> even once.
Rephrasing this to be less confusing: I think the bug occurs when autocomplete does not contain prompt.

Additional information

Reproduced on MacOS + Kitty.

@mzanibelli mzanibelli added the bug label Dec 5, 2024
@Screwtapello
Copy link
Contributor

Looking at the code, :ctags-generate uses the menu module, which is built on the :prompt command, which only shows its completion menu by default if prompt is in the autocomplete option.

That behaviour makes sense to me, but I guess you expected that prompt should only control the autocomplete menu for Kakoune commands, not for other things that prompt for input in the same way?

@mzanibelli
Copy link
Author

mzanibelli commented Dec 5, 2024

It makes sense indeed and I wouldn't want to introduce deep inconsistent changes for this minor inconvenience but leaving an empty prompt is really weird.
Since this particular prompt is highly unlikely to ever receive user-entered input, we could try to set the -init switch to the value of the first available entry just to hint the user that there might be more and they can press <Tab> for more?
Why do I need to press <Tab> twice to see the prompt BTW? This is still unclear to me.
That said, if we go the long way to introduce a new switch to the :prompt command to override the global autocomplete option, that might be the best approach from a user-experience point-of-view.

Edit: looking at the code I understand that ctags.kak never calls :prompt directly so any customization for this particular scenario is not as easy as I imagined it.

@mzanibelli
Copy link
Author

mzanibelli commented Dec 5, 2024

I guess from a functional stand there is a slight difference between auto-completing (I want the freedom to type stuff and might need some more choices displayed to me) and selecting (I want to chose between complex options that I might not be able to guess nor type). menu.kak kind of merges both for convenience but it shows its limits here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants