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

Tree : Use of dot decorations on folders (colored according to the priority) #9473

Merged

Conversation

OmarSdt-EC
Copy link
Contributor

@OmarSdt-EC OmarSdt-EC commented May 12, 2021

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 :

  • 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.

How to test

  1. Start the Theia application

  2. Open a project that is under version control

  3. Try to modify some files in it, you should see a dot decorator on the parent folder
    pr1_2

  4. Try to create an error in one of the children files, you should see the color of the dot change (it should be red)
    pr1_1

  5. If you commit and push your changes in your remote repository, you shouldn't see the tail decorators anymore

Review checklist

Reminder for reviewers

@OmarSdt-EC OmarSdt-EC force-pushed the os/fix-scmStateMarkers branch 2 times, most recently from 7657b66 to 01e816d Compare May 12, 2021 19:27
@OmarSdt-EC OmarSdt-EC changed the title Os/fix scm state markers Tree : Use of dot decorations on folders that are colored according to the priority of the modifications May 13, 2021
@OmarSdt-EC OmarSdt-EC changed the title Tree : Use of dot decorations on folders that are colored according to the priority of the modifications Tree : Use of dot decorations on folders (colored according to the priority) May 13, 2021
@colin-grant-work colin-grant-work self-requested a review May 13, 2021 14:00
@vince-fugnitto vince-fugnitto force-pushed the os/fix-scmStateMarkers branch 2 times, most recently from ac3bd7e to ea23664 Compare May 13, 2021 15:15
@vince-fugnitto vince-fugnitto added tree issues related to the tree (ex: tree widget) ui/ux issues related to user interface / user experience labels May 13, 2021
@vince-fugnitto
Copy link
Member

The second commit ea23664 should be dropped before merging.
The commit is used for test purposes to confirm if multiple tailDecorations for a given composite node is present that we do not render multiple generic icons.

packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
@@ -134,6 +134,12 @@ export class ProblemDecorator implements TreeDecorator {
fontData: {
color,
},
tailDecorations: [
{
data: 'allo',
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@OmarSdt-EC OmarSdt-EC force-pushed the os/fix-scmStateMarkers branch 3 times, most recently from 035e10a to 7d25474 Compare May 13, 2021 22:43
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
packages/core/src/browser/tree/tree-widget.tsx Outdated Show resolved Hide resolved
@OmarSdt-EC OmarSdt-EC force-pushed the os/fix-scmStateMarkers branch 2 times, most recently from c0c3f14 to 7ebcb33 Compare May 13, 2021 23:31
@OmarSdt-EC OmarSdt-EC closed this May 20, 2021
@OmarSdt-EC OmarSdt-EC reopened this May 20, 2021
@OmarSdt-EC
Copy link
Contributor Author

@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 ?

Copy link
Member

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

@OmarSdt-EC OmarSdt-EC force-pushed the os/fix-scmStateMarkers branch 3 times, most recently from 0388a2b to 8e9e879 Compare May 25, 2021 15:16
@colin-grant-work colin-grant-work self-requested a review June 15, 2021 16:39
Copy link
Contributor

@colin-grant-work colin-grant-work left a 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
Copy link
Contributor

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. :-)

Copy link
Member

@paul-marechal paul-marechal Jun 17, 2021

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.

Copy link
Contributor Author

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',
Copy link
Contributor

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.

Comment on lines 165 to 166
const { tooltip } = decoration as TreeDecoration.TailDecoration;
const { fontData } = decoration as TreeDecoration.TailDecoration;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const { tooltip } = decoration as TreeDecoration.TailDecoration;
const { fontData } = decoration as TreeDecoration.TailDecoration;
const { tooltip, fontData } = decoration as TreeDecoration.TailDecoration;

@colin-grant-work
Copy link
Contributor

It looks like this PR may also fix #6904.

@OmarSdt-EC OmarSdt-EC force-pushed the os/fix-scmStateMarkers branch 3 times, most recently from 6f445c8 to 6dd275a Compare July 21, 2021 15:30
Copy link
Member

@vince-fugnitto vince-fugnitto left a 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?

@colin-grant-work
Copy link
Contributor

@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.
@paul-marechal paul-marechal merged commit b330ab7 into eclipse-theia:master Aug 26, 2021
@paul-marechal paul-marechal added this to the 1.17.0 milestone Aug 26, 2021
RomanNikitenko pushed a commit that referenced this pull request Sep 16, 2021
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.
RomanNikitenko pushed a commit that referenced this pull request Sep 16, 2021
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tree issues related to the tree (ex: tree widget) ui/ux issues related to user interface / user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[scm] align scm state markers in the explorer with VS Code
4 participants