Skip to content

Conversation

@dtor
Copy link
Collaborator

@dtor dtor commented Jul 26, 2025

Selection hint that is displayed immediately upon entering visual mode ([aa: ask, ae: edit]) gets old pretty quickly. Add a config option to control when the hint is displayed:

selection = {
enabled = true,
hint_display = "delayed",
},

The "hint_display" option recognizes the following values:

  • "immediate" results in the hint being shown immediately after entering visual mode. This is the old behavior.
  • "delayed" causes the hint be displayed only if the cursor has not been moved for vim.o.updatetime milliseconds. This is the new default.
  • "none" suppresses showing the hint completely.

Unfortunately "CursorHold" event is not emitted in visual mode so we have to emulate it using Utils.debounce().

This is a breaking change because selection behavior was controller by "hints" config entry which makes little sense, so the config section and associated commands were renamed to "selection".

Additionally the "hints"/"selection" was mapped to "ah", but the very same key combination was used to select from old Avante chat histories, which overrode the toggle. New selection toggle keymap is "aC".

@dtor dtor force-pushed the selection branch 2 times, most recently from 200a4cd to 055c8b7 Compare July 26, 2025 19:28
@dtor
Copy link
Collaborator Author

dtor commented Jul 26, 2025

@yetone it looks like the errors are coming from luvit-meta which is set in dependencies and which defines uv.new_timer() as returning uv_timer_t and not uv.uv_timer_t as luals does.

Why do we need this package in dependencies?

@yetone
Copy link
Owner

yetone commented Jul 30, 2025

@dtor
Copy link
Collaborator Author

dtor commented Jul 30, 2025

@yetone I see, however they luals and luvit-meta are not supposed to be used together as they conflict. Kickstart used to use libuvt-meta (but not luals 3rd library), but they switched in nvim-lua/kickstart.nvim#1303 and lazydev made similar switch earlier.

We should pick one, but not both.

dtor added a commit to dtor/avante.nvim that referenced this pull request Jul 31, 2025
As discussed in yetone#2536 the
project should either use luv bindings from luals or luvit-meta
library, but not both, as they conflict with each other (especially
with uv.uv_timer_t). Given that other projects such as kickstart.nvim
and lazydev.nvim are switching to use the former, we should do the same
and drop luvit-meta dependency.
dtor added a commit to dtor/avante.nvim that referenced this pull request Jul 31, 2025
As discussed in yetone#2536 the
project should either use luv bindings from luals or luvit-meta
library, but not both, as they conflict with each other (especially
with uv.uv_timer_t). Given that other projects such as kickstart.nvim
and lazydev.nvim are switching to use the former, we should do the same
and drop luvit-meta dependency.

Also adjust code that was using luvit-meta's annotations for timers.
yetone pushed a commit that referenced this pull request Jul 31, 2025
As discussed in #2536 the
project should either use luv bindings from luals or luvit-meta
library, but not both, as they conflict with each other (especially
with uv.uv_timer_t). Given that other projects such as kickstart.nvim
and lazydev.nvim are switching to use the former, we should do the same
and drop luvit-meta dependency.

Also adjust code that was using luvit-meta's annotations for timers.
@yetone
Copy link
Owner

yetone commented Aug 3, 2025

Is this ready to be merged?

@dtor
Copy link
Collaborator Author

dtor commented Aug 4, 2025

It passes the checks but I would like to hear your opinion on the fact that it is a breaking change that will affect users who modified their configs... I do not expect many would disable the ability to select code and invoke avante.

@yetone
Copy link
Owner

yetone commented Aug 12, 2025

‌Will this affect the existing users' inability to display the hint window? I feel that the default configuration's delay is an acceptable delay.

"delayed" causes the hint be displayed only if the cursor has not been moved for vim.o.updatetime milliseconds. This is the new default.

Selection hint that is displayed immediately upon entering visual mode
([<leader>aa: ask, <leader>ae: edit]) gets old pretty quickly. Add a
config option to control when the hint is displayed:

  selection = {
    enabled = true,
    hint_display = "delayed",
  },

The "hint_display" option recognizes the following values:

- "immediate" results in the hint being shown immediately after entering
  visual mode. This is the old behavior.
- "delayed" causes the hint be displayed only if the cursor has not been
  moved for vim.o.updatetime milliseconds. This is the new default.
- "none" suppresses showing the hint completely.

Unfortunately "CursorHold" event is not emitted in visual mode so we
have to emulate it using Utils.debounce().

This is a breaking change because selection behavior was controller by
"hints" config entry which makes little sense, so the config section and
associated commands were renamed to "selection".

Additionally the "hints"/"selection" was mapped to "<leader>ah", but the
very same key combination was used to select from old Avante chat
histories, which overrode the toggle. New selection toggle keymap is
"<leader>aC".
@yetone
Copy link
Owner

yetone commented Aug 16, 2025

LGTM

@yetone yetone merged commit fed6902 into yetone:main Aug 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants