helix icon indicating copy to clipboard operation
helix copied to clipboard

edition.preview-completion-insert = false produces unexpected autocompletions

Open jharrilim opened this issue 1 year ago • 4 comments

Summary

With this setting set to false in my config:

[editor]
preview-completion-insert = false

I expect that completions should not appear unless I use enter to select them. In actuality, I still need to use ctrl+c to cancel. Pressing Escape or navigation with the left or right arrow still inputs the highlighted text into the editor.

I still get autocompletions happening if I press . Only ctrl+c seems to cancel it properly.

Reproduction Steps

  1. Set the preview-completion-insert = false option in the config
  2. Open a file that you have an LSP available for with completions
  3. Trigger the completion menu
  4. Hover over an item in the menu
  5. Click esc/left-arrow/right-arrow

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

Platform

MacOS

Terminal Emulator

kitty - version 0.25.2

Installation Method

brew

Helix Version

helix 23.10 (f6021dd0)

jharrilim avatar Feb 29 '24 00:02 jharrilim

this is intentional all this does is prevent the preview when you select a completion. We still auto accept all completions when typing any character when one is selected

pascalkuthe avatar Feb 29 '24 00:02 pascalkuthe

I see. I suppose my expectations for why I felt it was a bug is because with the inserted preview gone, the cursor now remains at the initial spot:

image

And so if I were to press backspace, I'd expect it to delete the character before that, but it instead inserts the suggestion first and deletes a character off of it:

image

Perhaps it's not the goal of preview-completion-insert in particular, but it would be nice if only Enter/Return triggered the completion. That would be more in-line with how VSCode, IntelliJ IDEs, nvim-cmp, Lapce, Zed, etc. behaves as well.

jharrilim avatar Feb 29 '24 01:02 jharrilim

Sorry I missed this when checking for duplicates. If it is going to stay the default, could an additional setting be added to control this?

pentadecathlon avatar May 27 '24 22:05 pentadecathlon

I would agree with OP here. @pascalkuthe even if the current behaviour is intentional, would you agree with removing the completion when Backspace/Delete/Esc are pressed?

pashadia avatar Jun 06 '24 21:06 pashadia