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

[markers] enable single-click and keyboard arrow selection to navigate markers #5646

Merged
merged 1 commit into from
Jul 9, 2019

Conversation

vince-fugnitto
Copy link
Member

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]

@vince-fugnitto vince-fugnitto added enhancement issues that are enhancements to current functionality - nice to haves markers issues related to problem markers problems issues related to the problems widget labels Jul 4, 2019
@vince-fugnitto vince-fugnitto self-assigned this Jul 4, 2019
@lmcbout
Copy link
Contributor

lmcbout commented Jul 4, 2019

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 ?

Copy link

@fangnx fangnx left a 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.

@vince-fugnitto
Copy link
Member Author

@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 problems-widget keeps focus)

@lmcbout
Copy link
Contributor

lmcbout commented Jul 5, 2019

While testing, if the file is not expanded in the problem view, you don't expand it and open the first item. When the file is expanded in the problem view, then it navigates well.
Can we expand the file to navigate to the next problem item ?

ProblemNavigation

@vince-fugnitto
Copy link
Member Author

vince-fugnitto commented Jul 5, 2019

While testing, if the file is not expanded in the problem view, you don't expand it and open the first item. When the file is expanded in the problem view, then it navigates well.
Can we expand the file to navigate to the next problem item ?

@lmcbout

Files nodes are expanded using Enter, is this not sufficient?
The same is true for other trees (ex: explorer, search-in-workspace)

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.

Copy link
Contributor

@lmcbout lmcbout left a 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

@vince-fugnitto
Copy link
Member Author

@lmcbout thank you! I'll wait for others to give a review as well.
@akosyakov if you ever get the chance, can you review too?

@@ -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];
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

@akosyakov
Copy link
Member

You should implement it explicitly by overriding handleClickEvent.

@vince-fugnitto
Copy link
Member Author

You should implement it explicitly by overriding handleClickEvent.

Will this work when using the keyboard to select tree nodes and navigating?

@akosyakov
Copy link
Member

@vince-fugnitto No, when you should override other widget methods which are responsible for keyboard navigation. You cannot rely on generic selection event.

@vince-fugnitto vince-fugnitto force-pushed the vf/GH-5003 branch 2 times, most recently from d76c038 to 905c907 Compare July 5, 2019 15:01
@vince-fugnitto
Copy link
Member Author

@akosyakov I overwrote the handleClickEvent, handleDown and handleUp methods to implement the feature, is this the correct way forward?

@akosyakov
Copy link
Member

@vince-fugnitto yes, that's what i meant

@vince-fugnitto
Copy link
Member Author

@vince-fugnitto yes, that's what i meant

Thank you for the feedback and your help implementing it better!
@lmcbout do you mind re-testing to see if functionally it's still correct?

Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine

@vince-fugnitto
Copy link
Member Author

@akosyakov are you fine with me merging the PR?

Copy link
Member

@akosyakov akosyakov left a 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]>
@vince-fugnitto vince-fugnitto merged commit 4f58723 into master Jul 9, 2019
@vince-fugnitto vince-fugnitto deleted the vf/GH-5003 branch July 9, 2019 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement issues that are enhancements to current functionality - nice to haves markers issues related to problem markers problems issues related to the problems widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[problems] use single click to navigate to problem in editor
4 participants