acejump / AceJump

🅰️ single character search, select, and jump
https://plugins.jetbrains.com/plugin/7086-acejump
GNU General Public License v3.0
1.21k stars 91 forks source link

Cycling through tagged results on screen via "Enter" or "Shift+Enter" keys does not work any more #380

Closed Skorpionos closed 2 years ago

Skorpionos commented 3 years ago

Describe the bug Feature "Pressing Enter or Shift+Enter during a search will cycle through tagged results on screen" doesn't work in new version AceJump

To Reproduce

  1. Activate AceJumpMode
  2. Type something that matches several times
  3. Press "Enter"
  4. See error "File is read-only". Action has no results

Screenshot acejump

Desktop (please complete the following information):

breandan commented 3 years ago

~This issue is a duplicate of #356~ edit: scratch that, this appears to be new. Thank you for reporting!

Skorpionos commented 3 years ago

By the way, I see that key "Alt+Enter" which binds in my case for action "Action: EditorStartNewLine" works instead of "Shift+Enter" for previous match. Maybe there is some workaround instead of "Enter" for next match also?...

breandan commented 2 years ago

Okay! After some digging, I can reproduce this issue, but only when IdeaVim is active. If IdeaVim is disabled, tag navigation using Enter/Shift+Enter triggers the callback as expected, however when IdeaVim is active (either in normal mode, or insert mode), this causes the caret move in editor, or produces the message File is read-only. To receive callbacks for these events, we are registering an editorActionHandler in our plugin.xml file as follows:

https://github.com/acejump/AceJump/blob/6858b745e676fff4b8413395317a2943b65de3f6/src/main/resources/META-INF/plugin.xml#L26-L29

When IdeaVim is enabled, this action handler would not appear to work. I wonder if there is a better way to steal editor actions like Enter/Shift+Enter from the IDE when AceJump is active. I remember an older issue (#266) where competing focus occurred in certain IdeaVim modes. @AlexPl292 Should we be doing anything differently here?

chylex commented 2 years ago

IdeaVIM registers a raw key handler that takes priority over everything else, I ran into a similar issue with one of my plugins. You could try copying my approach and see if that works:

https://github.com/chylex/IntelliJ-Keyboard-Master/commit/e0bd7778dfebde88265d4e8bd7c2fb5f2941f268

AlexPl292 commented 2 years ago

IdeaVim had a workaround for AceJump, but it was broken by the last huge refactoring. We are already discussing on how to fix it in a better way. I hope that the fix will be available in the next release.

AlexPl292 commented 2 years ago

A fix will be available with the next release of IdeaVim. It was fixed by introducing a dependency to the AceJump plugin, but actually we're discussing IdeaVim keys handling refactoring.

breandan commented 2 years ago

Much appreciated! Please let us know when your next release is ready for testing and if we need to make any changes to support the integration. We release 3.8.5 when this issue is resolved, alongside the other recent changes.

AlexPl292 commented 2 years ago

We've released a new version 1.9.0 with a workaround that should fix the issues. However, we're working on a new shortcut registering mechanism that should fix the issue properly :)

breandan commented 2 years ago

I have confirmed that AceJump's Enter/Shift+Enter functionality now works again with the latest version of IdeaVim. Thanks for looking into this Alex! We will now release 3.8.5.