-
Notifications
You must be signed in to change notification settings - Fork 194
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
Find/Replace overlay: add a search- and replace- history #1990
Find/Replace overlay: add a search- and replace- history #1990
Conversation
@jukzi Can you please review this feature and tell me what you think of it? :) |
next week |
@jukzi yes, no rush :) |
Test Results 1 815 files + 605 1 815 suites +605 1h 33m 1s ⏱️ + 30m 48s For more details on these failures, see this check. Results for commit b6e473d. ± Comparison against base commit be68f2f. ♻️ This comment has been updated with latest results. |
Instead of the menu (or additionally to it), could we have ctrl+space for the list of proposals, filled with the history? |
@iloveeclipse I think that could be a good idea! I was also thinking about allowing moving up/down the history using the arrow keys like vscode does. Ctrl+Space fits the "content assist" idiom and is also a very good idea! |
Thank you for this. The screenshot already look promising, 🚀
That's also an interesting proposal. But in order to make users aware of it, it should for example be mentioned in the empty-block background text (similar to the screenshot of VS code in #1907). What also came into my mind when I read Andrey's proposal: The history could automatically drop-down as soon as the text-block gets the focus. Additionally the already typed text could then be used as 'filter' for the history and remove not matching items. |
Not necessarily, Eclipse has a concept of "light bulb" field decoration if there is something that provides extra functionality. |
@HannesWell @iloveeclipse @jukzi before coming up with many new features, I would like to understand the problem at hand a little bit better. I never use the search history myself (even in the Dialog) and I couldn't come up with a workflow where the search history could be "really" useful. Can you please tell me a bit about how the search history is really used?
I never use the search history, for me, this would just be (very) annoying. |
example: i search a method in a .java file, but i am too lazy to type each letter of the method name. Therefore i copy paste a Stacktrace line "p.C.method ()" from VisualVm . Since the pasted line contains more then only the method name i have to delete the classname prefix "p.C" and the " ()" suffix within the search dialog. As soon as i have done that i will find a method and all its calls in the active editor. Now i continue with editing, searching other things and so on. Later i want to search the same method again - but still i don't know its name. I used to find its name in the search history. Now i only find it in the copy/paste history from windows but there it still contains prefix and suffix. |
|
@iloveeclipse @jukzi thank you very much for your user-stories! That helps me a lot understanding your concerns for the usability of the history. It is now possible to navigate through the history using the arrow keys (arrow up/arrow down) I will move on to address @jukzi s concerns. |
074a7fd
to
3b71076
Compare
@jukzi what do you think of this version? |
it looks good!
|
error loged:
|
3b71076
to
0b1b622
Compare
Thank you for the report, I fixed the error here: 0b1b622 Can you please tell me what exactly you do to send eclipse to the background? I could not reproduce that. Changing the status text is out of scope for this issue. I don't really think it's worth changing (and it is the "old" behavior), but if you think it is, we can create an Issue for it. |
i am on WIndows. i have multiple programs open. I have replace line closed. I click on down-> history opens. I click on down again .> another program comes in front (feels like closing to the dropdown sends eclipse to background). |
@jukzi yes, I can reproduce this! Thanks! |
b7caa6b
to
d1f08a9
Compare
now eclispe does not move to background anymore but again drop down can not be closed by second click. |
|
d1f08a9
to
7032d6c
Compare
@jukzi I have addressed all your concerns. |
4b6bd53
to
7c21528
Compare
@jukzi @HeikoKlare I believe that we should discuss the "unused fields" later and prioritize getting feedback on the search history. I have created this issue for the unused fields #2060 and I have reverted the changes that made them unused. I have also fixed the unit tests (at least locally) and removed a file which I forgot to remove while merging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, the code changes look good and sound. When testing, the UI also looks good and works quite well. I have rather nitpicky comments, but at least one issue (exception) that needs to be addressed:
- Clicking "down" key when the history is empty results in an exception:
java.lang.ArithmeticException: / by zero
at org.eclipse.ui.internal.findandreplace.overlay.HistoryTextWrapper.navigateInHistory(HistoryTextWrapper.java:119)
at org.eclipse.ui.internal.findandreplace.overlay.HistoryTextWrapper.lambda$1(HistoryTextWrapper.java:75)
...kbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java
Outdated
Show resolved
Hide resolved
...kbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java
Outdated
Show resolved
Hide resolved
...kbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java
Outdated
Show resolved
Hide resolved
...kbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/HistoryTextWrapper.java
Outdated
Show resolved
Hide resolved
...kbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/HistoryTextWrapper.java
Outdated
Show resolved
Hide resolved
c8049b4
to
c7042b7
Compare
I have fixed the divide by zero and the coloring of the separators now works correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing my concerns! Regarding the code, I only have a minor comment left. For the images, we also need to have a PR with the svg to the platform.images repo.
I have two finding with respect to the UI / layout:
- The text boxes are not properly centered (vertically) anymore. They are off to the top.
- On MacOS, the drop down menu is misplaced (off to the top):
private TableColumn column; | ||
|
||
public SearchHistoryMenu(Shell parent, HistoryStore history, | ||
HistoryItemSelectedListener menuItemSelectionListener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be sufficient to use a general Consumer<String>
instead of introducing a new (functional) interface here. If not, the listener should at least be declared as a functional interface, so that a lambda instead of an anonymous class can be passed as an argument to this constructor.
}); | ||
|
||
Point barPosition = textBar.toDisplay(0, 0); | ||
menu.setPosition(barPosition.x, barPosition.y + dropDown.getWidth(), textBar.getSize().x + dropDown.getWidth()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have investigated the MacOS placement issue and found the reason here:
This calculation does not work on MacOS, because the drop down's width returns a default value rather than the actual width. I am not sure whether that implementation is correct/expected, but since the implementation has always been like this, it cannot be changed anyway. Since the bounds contain the correct values, we can adapt the code as follows:
Rectangle dropDownBounds = dropDown.getBounds();
menu.setPosition(barPosition.x, barPosition.y + dropDownBounds.height,
textBar.getSize().x + dropDownBounds.width);
9ff464d
to
02faa47
Compare
@Wittmaxi I have pushed my proposed changed onto your branch: https://github.com/eclipse-platform/eclipse.platform.ui/compare/c7042b7e8f9f3aec27f4d038fa10befb832d8214..9ff464d8c7f049d28d2fd8e12ff026051b2420f1 Maybe you can have a look whether that is fine for you, because I would like to merge this PR soon, so that we finally have that feature available and more easily find potential problems in productive use. If the changes are not okay, just let me know and I will revert them. |
@HeikoKlare the changes look sound, especially the use of Consumer is much better than a custom object. I can't comment on the mac changes. If they work, that's fine. thank you :) |
Add a search history for the Find/Replace overlay, displayed as a dropdown below the find/replace inputs. fixes eclipse-platform#1907
02faa47
to
b6e473d
Compare
Can you please share the icon sources in the images repo, @Wittmaxi? It's not urgent, we should just not forget about that. I have created a tracking issue for that: eclipse-platform/eclipse.platform.images#83 And I just saw that the "scrolling hints" you added to the search and replace bar hints were removed in some of the recent commits. What that intended or by accident, so that we should apply that change in a follow-up?
|
@HeikoKlare That's not intended and should be re-added. Thanks for the catch :) I can add an issue for that, I am not at the computer currently |
I have just created a quick follow-up PR: #2091 |
Thank you for the adding the history to the new overlays. In general this works like charm. The only thing that made me wonder when using this is that I have to press the |
Thank you for the feedback, @HannesWell! Great to hear that, in general, the functionality works as expected. I fully agree with your expectation regarding behavior of pressing the up/down keys. I am not sure whether this was ever intended. The only potential reason I found is the behavior of VS code, which moves "downwards" in the history by pressing the "up" button. In this case, I think we should deviate from the VS code behavior because (1) we also have a drop-down menu with an inverse order making the behavior inconsistent and (2) Eclipse users are used to the navigation direction because of the existing find/replace dialog. I have created a PR to invert the navigation direction: #2136 |
Adds a history feature for the find and replace bar of the overlay.
The history is displayed using a menu filled with entries from the
HistoryStore.
fixes #1907