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

Thoughts on auto-complete behavior #822

Closed
dylrich opened this issue Oct 10, 2021 · 12 comments
Closed

Thoughts on auto-complete behavior #822

dylrich opened this issue Oct 10, 2021 · 12 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@dylrich
Copy link
Contributor

dylrich commented Oct 10, 2021

Hi! I'm testing out the new auto-complete idle timeout behavior and have some feedback on auto-complete in general that I didn't really notice until it started happening automatically, with VSCode's behavior just as a reference for comparison:

  1. It's somewhat annoying to have auto-complete trigger when you haven't typed anything in a new line yet. If you set your idle timeout to 0, then simply enter insert mode, you will get suggestions immediately. Some folks may like this behavior, but I kinda find it distracting if it happens before I have started typing. For reference, in VScode it doesn't appear that auto-completion happens unless you have typed something other than a newline. I really like instant auto-complete, but only if I have started writing something.
  2. I think it could be a good idea to allow canceling the completion popup without exiting insert mode. If I hit Escape in VSCode, it will cancel the popup, but I can still type obviously because of the lack of modes. Escape makes sense to me to cancel the popup, but also exiting insert mode at the same time feels a bit much. I'm not sure what the desired vision is, but I think it'd be nice to either have escape prioritize closing the popup first before exiting insert mode, or to have a different keybind to close the popup available
  3. Unsure if this is a bug, but consider this scenario: I start typing e.g. lo while programming in Go and I get some document-specific completions as expected. I follow by typing out log. as if to type log.Println or something of that nature and get completions as appropriate, all good up to this point. Finally, I decide I want to do something else and backspace a few times back to just lo. From here the completion suggestions don't change, it's stuck on thinking I want to do log.<SomeFunc>. I tested this in VSCode and their completion will go back to document-specific suggestions in that case, as you'd expect. Let me know if this makes sense or if a video would be preferable
  4. I have no idea how to trigger it, but occasionally I get a bug where cycling through the auto-complete options continually adds each option to my current line. I'd expect it to remove old suggestions as I cycle through them. This may have to do with clicking back to the terminal with a mouse? I'm really not sure how to trigger it, but it does happen to me occasionally
@dylrich dylrich added the C-enhancement Category: Improvements label Oct 10, 2021
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Oct 10, 2021
@Omnikar
Copy link
Contributor

Omnikar commented Oct 11, 2021

I definitely think I would like if autocomplete suggestions only appeared after I started typing.

@archseer
Copy link
Member

archseer commented Oct 14, 2021

Thanks for a detailed report! I've numbered your feedback so I can respond to it in points:

  1. I think Improve completion trigger #838 will address this
  2. This is already possible with ctrl-c. I think esc should still exit insert mode because it was very error prone in the past if you wanted to exit insert mode but a popup just happened to trigger at the wrong time.
  3. Yeah I think if we erase past the initial trigger point it should close the completion, that way it'll retrigger with the new position (lo)
  4. I've seen both this and extra text accidentally being removed. I think this is because we have a few hacks so that typing filters the completion, but we need to undo it before applying the LSP completion. The bookkeeping probably gets confused.

@archseer
Copy link
Member

Addressed number 3 in 2c0468f

@pickfire
Copy link
Contributor

This is already possible with ctrl-c. I think esc should still exit insert mode because it was very error prone in the past if you wanted to exit insert mode but a popup just happened to trigger at the wrong time.

I believe this is not discoverable. At least ctrl-c is not intuitive enough for people coming from vim and kakoune, might be hard to find.

@archseer
Copy link
Member

It's equivalent in vim but we can always document it in the documentation.

@archseer
Copy link
Member

Possibly fixed number 4 in 3edca78

@archseer
Copy link
Member

This is all solved now :)

@dylrich
Copy link
Contributor Author

dylrich commented Oct 29, 2021

Thank you so much! And congrats on 5.0 -- so many improvements! Onward and upward.

@rcastill
Copy link

rcastill commented Jul 1, 2022

Hi,

Sorry I'm commenting on a closed issue. But here you mention exactly what I was looking for:

2. This is already possible with ctrl-c. I think esc should still exit insert mode because it was very error prone in the past if you wanted to exit insert mode but a popup just happened to trigger at the wrong time.

Is there a way to make ctrl-c exit pop-up and insert mode just as ESC does?

I keep making mistakes. In my case, coming from vim, I basically never use ESC. I always use ctrl+c.

I understand this is a design decision. But is there anyway I can customize the behaviour?

Thanks!

@sudormrfbin
Copy link
Member

@rcastill it's not customisable as of now, and it would require either re-bindable keymap support for popups (there's a similar open issue for pickers) or scripting/plugin support. Or if it's tripping you up too much you could build from source after changing the keys in the source code itself.

@rcastill
Copy link

rcastill commented Jul 1, 2022

Yep. I just did that and it worked. I hope it doesn't break anything.

Thanks @sudormrfbin

@pablopunk
Copy link

I'm running into the same issue @rcastill pointed here:

Is there a way to make ctrl-c exit pop-up and insert mode just as ESC does?
I keep making mistakes. In my case, coming from vim, I basically never use ESC. I always use ctrl+c.

Any workaround for this without building from source? cc @sudormrfbin

TIA 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

8 participants