-
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
[markers] enable single-click and keyboard arrow selection to navigate markers #5646
Conversation
Question: while testing, I noticed the selected file opens, but the visible position of the line is not selected, could it be possible to highlight or select the line where the marker is pointing to, not just opening the file ? |
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.
Single-clicking works smoothly. As Jacques suggested, it would be better to set the focus to the specific line of the problem, but I guess that can be a different PR.
6036fa2
to
575edb2
Compare
@fangnx @lmcbout thanks guys, I updated the code, it should work a lot better now :) When a marker node is selected in the tree (through single-click or with the keyboard arrows) the corresponding marker in the editor should be revealed and highlighted without the cursor (so that the |
Files nodes are expanded using Enter, is this not sufficient? I actually prefer it this way, it means I can easily navigate to the file I want, press Enter and get the errors I care about. If I were to expand at each selection it'd take me much longer. |
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.
Explanation about the "enter" key is fine, also for performance
Code looks OK
Testing: LGTM
Thanks @vince-fugnitto
@lmcbout thank you! I'll wait for others to give a review as well. |
@@ -44,6 +44,12 @@ export class ProblemWidget extends TreeWidget { | |||
this.addClass('theia-marker-container'); | |||
|
|||
this.addClipboardListener(this.node, 'copy', e => this.handleCopy(e)); | |||
this.toDispose.push(this.model.onSelectionChanged(selection => { | |||
const node = selection[0]; |
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.
this event is fired even if someone programmatically select a node, you don't want to focus in this case
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 was following other designs from other tree-widgets which used the same event but I'll try using the suggestion you made.
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.
Could you point me to this code?
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.
Sure, there's a few other widgets that did it similarly to my initial implementation:
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 will bite there if someone trigers programmatic selection. I am not sure that a user then wants to have some editors pop up.
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 will bite there if someone trigers programmatic selection. I am not sure that a user then wants to have some editors pop up.
Should we file issues to track and fix them?
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.
Let's wait for someone to open. It is probably very rare case.
You should implement it explicitly by overriding |
Will this work when using the keyboard to select tree nodes and navigating? |
@vince-fugnitto No, when you should override other widget methods which are responsible for keyboard navigation. You cannot rely on generic selection event. |
d76c038
to
905c907
Compare
@akosyakov I overwrote the |
@vince-fugnitto yes, that's what i meant |
905c907
to
1c25288
Compare
Thank you for the feedback and your help implementing it better! |
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.
Works fine
@akosyakov are you fine with me merging the PR? |
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've only reviewed the code.
…markers Fixes #5003 - the current implementation of the `problems-widget` requires double-clicking nodes in order to navigate to the problems. This is an annoying behavior and inconsistent with vscode where if you single-click a marker the corresponding editor is revealed. The feature works both with single clicking markers, as well as selecting them with the keyboard arrow keys. Signed-off-by: Vincent Fugnitto <[email protected]>
1c25288
to
d36a918
Compare
Fixes #5003
problems-widget
requires double-clickingnodes in order to navigate to the problems. This is an annoying behavior and
inconsistent with vscode where if you single-click a marker the corresponding
editor is revealed. The feature works both with single clicking markers, as well
as selecting them with the keyboard arrow keys.
Signed-off-by: Vincent Fugnitto [email protected]