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

Cycle between highlighted words #30

Open
lutz-leonhardt opened this issue Aug 1, 2022 · 5 comments
Open

Cycle between highlighted words #30

lutz-leonhardt opened this issue Aug 1, 2022 · 5 comments
Labels

Comments

@lutz-leonhardt
Copy link

The current version does not cycle between highlighted words with F3. IMO this was the case in earlier versions.
It would be nice to make this possible again.

@lutz-leonhardt
Copy link
Author

Is there another way to cycle between the highlights?

@huoguangjin
Copy link
Owner

huoguangjin commented Oct 3, 2022

cycle between highlighted words with F3, I guess what you mean is Find Next / Move to Next Occurrence, right?

@lutzleonhardt
Copy link

yes, exactly

@huoguangjin
Copy link
Owner

In usual, when some find actions (like Ctrl+F Find... and Ctrl+Shift+F7 Highlight Usages in File) perform, HighlightHandlerBase#setupFindModel will be called. At this time, A FindModel will set in FindManager, seeFindManager#setFindNextModel.
Find Next / Move to Next Occurrence triggers SearchAgainAction, and tells FindManager#findNextUsageInEditor to find the next usage. In this process, all highlighters managed by HighlightManager will be compared with the current caret location to find out the nearest one.

But highlighters created by MultiHighlight don't save in HighlightManager in v3.0.0, so Find Next / Move to Next Occurrence doesn't work.

See also:
com.intellij.codeInsight.highlighting.HighlightHandlerBase#setupFindModel
com.intellij.find.FindManager#setFindNextModel
com.intellij.ide.actions.SearchAgainAction
com.intellij.find.FindManager#findNextUsageInEditor
com.intellij.codeInsight.highlighting.HighlightManagerImpl#getHighlighters

@huoguangjin huoguangjin pinned this issue Oct 16, 2022
@huoguangjin
Copy link
Owner

There are 2 ways to solve:

  1. Add highlighters created by MultiHighlight to HighlightManager, so that FindManager could find them.
  2. Add a new find next action for MultiHighlight.

See also:
com.intellij.codeInsight.highlighting.HighlightManager#addOccurrenceHighlight
com.intellij.find.impl.FindManagerImpl#findNextUsageInFile

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

3 participants