-
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
Tree : Use of dot decorations on folders (colored according to the priority) #9473
Tree : Use of dot decorations on folders (colored according to the priority) #9473
Conversation
7657b66
to
01e816d
Compare
ac3bd7e
to
ea23664
Compare
The second commit ea23664 should be dropped before merging. |
@@ -134,6 +134,12 @@ export class ProblemDecorator implements TreeDecorator { | |||
fontData: { | |||
color, | |||
}, | |||
tailDecorations: [ | |||
{ | |||
data: 'allo', |
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.
Is this data
field meaningful?
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.
Please remove this extraneous data
that I assume was for testing purposes.
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.
Sorry Colin for not answering your question, I completely forgot. Indeed, it was for testing purposes
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.
Me and Vince planned to remove it before merging, we used it only to check if the icon would have the color of the highest priority. Problem markers shouldn't be in my PR since Vince had a commit about them. It should be dropped before merging mine.
035e10a
to
7d25474
Compare
c0c3f14
to
7ebcb33
Compare
@colin-grant-work Hi, I think that all the changes are done and that I addressed all the comments. Can you do a re-review ? |
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.
Thinking about the feature a bit further I'm wondering if we should override renderTailDecorations
solely in the navigator-widget
so we do not potentially break other trees, or introduce an unwanted behavior. I think the behavior of displaying a generic tail decoration for composite nodes (folders) can be exclusive to the navigator.
Reasoning:
- the navigator will still properly display the generic decoration for composite nodes.
- other trees are left untouched, which means no unwanted default behavior will be present.
- downstream extensions can still provide composite
tailDecorations
to other trees if they choose to do so.
0388a2b
to
8e9e879
Compare
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 appears to be working well for me. Just a couple of very minor comments on the code.
// eslint-disable-next-line no-null/no-null | ||
return null; | ||
protected decorateIcon(node: TreeNode, icon: React.ReactNode): React.ReactNode { | ||
// icon can be null or undefined |
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 don't think this comment is necessary - the !icon
check makes it clear you're checking for all falsey values, and no one who isn't checking this diff will know that the code used to assume only null
was a possibility. :-)
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 surprised and I asked Omar to add that comment... ReactNode
is a weird type, but I assume you are right: just need to Go To Type Definition
and we can see that it includes null.
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 will remove the comment thanks !
@@ -134,6 +134,12 @@ export class ProblemDecorator implements TreeDecorator { | |||
fontData: { | |||
color, | |||
}, | |||
tailDecorations: [ | |||
{ | |||
data: 'allo', |
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.
Please remove this extraneous data
that I assume was for testing purposes.
const { tooltip } = decoration as TreeDecoration.TailDecoration; | ||
const { fontData } = decoration as TreeDecoration.TailDecoration; |
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.
const { tooltip } = decoration as TreeDecoration.TailDecoration; | |
const { fontData } = decoration as TreeDecoration.TailDecoration; | |
const { tooltip, fontData } = decoration as TreeDecoration.TailDecoration; |
It looks like this PR may also fix #6904. |
6f445c8
to
6dd275a
Compare
6dd275a
to
e15e0d0
Compare
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.
The changes work well for me 👍
@colin-grant-work did you have any additional feedback?
Sorry for the delay. Looks good to me! |
The following commit updates the rendering of tail decorations for composite tree nodes (nodes that contain children nodes like folders). The following updates the rendering of tail decorations for composite tree nodes (nodes that contain children nodes like folders). The updates include : - rendering a generic icon decoration (dot) for composite nodes with children with decoration data. - updates to the rendering logic to only render the decoration data with the highest priority so no duplicate generic icons are present.
e15e0d0
to
b9d18a8
Compare
The following commit updates the rendering of tail decorations for composite tree nodes (nodes that contain children nodes like folders). The following updates the rendering of tail decorations for composite tree nodes (nodes that contain children nodes like folders). The updates include : - rendering a generic icon decoration (dot) for composite nodes with children with decoration data. - updates to the rendering logic to only render the decoration data with the highest priority so no duplicate generic icons are present.
The following commit updates the rendering of tail decorations for composite tree nodes (nodes that contain children nodes like folders). The following updates the rendering of tail decorations for composite tree nodes (nodes that contain children nodes like folders). The updates include : - rendering a generic icon decoration (dot) for composite nodes with children with decoration data. - updates to the rendering logic to only render the decoration data with the highest priority so no duplicate generic icons are present.
What it does
Fixes #6904
The following commit updates the rendering of tail decorations for
composite tree nodes (nodes that contain children nodes like folders).
The following updates the rendering of tail decorations for composite
tree nodes (nodes that contain children nodes like folders). The
updates include :
How to test
Start the Theia application
Open a project that is under version control
Try to modify some files in it, you should see a dot decorator on the parent folder
Try to create an error in one of the children files, you should see the color of the dot change (it should be red)
If you commit and push your changes in your remote repository, you shouldn't see the tail decorators anymore
Review checklist
Reminder for reviewers