-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix set selection on right click selected node #7147
Conversation
Hey @amiramw, thank you for the contribution. I have checked the behavior with your changes, and it does not seem correct. I did the followings:
I want to keep both nodes as the selected ones ( |
BTW, the comment you have just deleted, tells the expected behavior:
|
Thanks @kittaakos, now I better understand the flow. Please see my latest change. |
I debugged into your changes, and I cannot really understand, why calling I did the same as before except I have selected other files. When the two files are selected, and I hold down the |
@kittaakos the issue I'm trying to solve is when focus change before right clicking a selected node. For example if you select the editor tab and then right click the same file in the tree then selection stays the one from the editor. I think it shouldn't happen with multi select when there are more than one node selected. Each selected on top of the first one take global selection in that case. So everything is synced anyway. |
The first thing that looks odd is that you ignore the if (this.props.globalSelection) {
this.updateGlobalSelection();
} The other thing is, why do not we activate the widget before rendering the context menu? (CC: @akosyakov) Can we have a protected onAfterAttach(msg: Message): void {
// all the listeners we have now, plus the new one to activate the widget, and automtaically update the global selection if required before rendering the context menu.
this.addEventListener(this.node, 'contextmenu', () => this.doFocus());
}
FYI, I have tried this approach, and it works too. |
So a use case is that the navigator is not focused, but another widget, like editor, and then someone triggers context menu? |
About |
That was my understanding.
Can you suggest another approach maybe? I did some quick testing locally, and the |
We actually don't set tree selection as global selection, but active widget. So we should only ensure that the navigator is focused before rendering a context menu, your suggestion to focus before sounds good. I think we could replace here
doFocus force triggers rendering.
|
I meant with the proposed fix: https://github.com/eclipse-theia/theia/pull/7147/files#diff-415d8ea8ab3a316c90a0ca5e605de20eR1108
Good idea, @amiramw, could you please try if the suggestion from @akosyakov fixes your use case? |
Fixes eclipse-theia#7146 Signed-off-by: Amiram Wingarten <[email protected]>
It seems to work! I updated the PR. |
Can someone help with why travis is failing? |
@amiramw I've restarted the build. The failure is not related to your changes. Preferences integration tests are failing because of some flakiness in our implementation. I'm looking into it. |
@kittaakos Could you finish the review please? |
👍
I have verified it; it works as expected. |
Fixes #7146
Signed-off-by: Amiram Wingarten [email protected]
What it does
Perform selection on right click also if the node was already selected so that the global selection service is updated and the menu content is displayed with the correct context.
How to test
Scenario 1:
Scenario 2
Review checklist
Reminder for reviewers