-
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
Fixed #5670: implemented "collapse all" in the Outline widget #5687
Conversation
fangnx
commented
Jul 10, 2019
- Added a "collapse all" toolbar item to the Outline widget.
Yes, I know it is work in progress... I wish we could generalize it a bit. Do we need to add all this boilerplate code for each tree view we want to collapse? Perhaps we have to add a subclass for |
2a45799
to
8a49ae7
Compare
Glad to see that the suggestion to create a custom I noticed an odd behavior when the outline-widget-tree is collapsed. Steps to Reproduce:
Solutions For the following use case, I believe there are two approaches we can do to fix it:
|
After some investigation, it seems when a symbol is selected in the editor, the selection in outline tree is not properly updated. |
b84a8e6
to
7b1cf84
Compare
@vince-fugnitto The issue with selected symbols in monaco editors has been solved. Now the collapsing action does not perform any selection, so there is no need for selecting node after it is done, which means the editor would not "move" with the collapse-all action. |
7b1cf84
to
332d3f9
Compare
@fangnx I think someone else should also try reviewing, I helped through the development process and just want to know anyone else's feedback on the approach taken. |
@fangnx, are you planning to generalize the |
I consider the PR as done. I think generalizing the |
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.
LGTM
Refactoring the boilerplate code in the other extensions would be nice, but it should be a separate PR as @fangnx said. For now this change does what it is meant to do :)
We may fill an issue regarding the refactoring, in case we don't work on it right away.
@kittaakos are you OK with this approach?
@fangnx please rebase against |
@vince-fugnitto @marechal-p please finish the review, code-wise it looks good to me |
I think as an improvement we can make the icons I think the following use case can be handled better:
Expected: the editor stays fixed, |
Yes, I think that can be a good improvement (useful & aligned with VS Code behaviour). Should it be a different PR? ;) |
I think it can be done separately, but is a bug that two nodes are highlighted simultaneously? |
this.selectNode(node); | ||
} | ||
} | ||
this.selectOnExpansion(node); |
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.
Would onExpansion
make more sense?
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 is naming convention for events or notification usually to start on
. I prefer to give names to clarify intention. We could name handleExpansion
but it does not explain what method does. I would usually then introduce 2 template methods:
- generic tempalte method
handleExpansion
, so one can override it - and
selectOnExpansion
which is called by default fromhandleExpansion
selectOnExpansion
then can be renamed to something else to clarify intention even better, i.e. selectIfAncestorOfSelected
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.
Just updated ;)
a5a226d
to
79353ea
Compare
…idget - Added a "collapse all" toolbar item to the Outline widget. - Created `OutlineViewTreeModel` class in order to override the default `collapseAll` function and `onExpansionChanged` event handler in the default tree model. Signed-off-by: fangnx <naxin.fang@ericsson.com>
@marechal-p please help with landing if you are fine with changes |
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.
LGTM, merging.