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

Indentation of tree view item label changes when adding icon #28974

Closed
letmaik opened this issue Jun 18, 2017 · 30 comments
Closed

Indentation of tree view item label changes when adding icon #28974

letmaik opened this issue Jun 18, 2017 · 30 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug tree-views Extension tree view issues verified Verification succeeded
Milestone

Comments

@letmaik
Copy link
Member

letmaik commented Jun 18, 2017

  • VSCode Version: 1.13.1
  • OS Version: Win 10

Steps to Reproduce:

  1. Create custom tree view extension with icons and observe padding of label.
  2. It is impossible to have icons and re-create the layout of the built-in explorer.

In the first picture, in the "Git Context" custom tree view (this is an experiment from myself, not released on the market yet), it looks like the .gitignore entry belongs to the folder above, but in fact it doesn't.
image

Without icons, the layout is correct:
image

EDIT: I just noticed that the "minimal" icon theme of vs code has folder icons and then adjusts the padding accordingly:

image

@ramya-rao-a ramya-rao-a added file-explorer Explorer widget issues tree-views Extension tree view issues and removed file-explorer Explorer widget issues labels Jun 19, 2017
@bpasero bpasero assigned sandy081 and unassigned bpasero Jun 19, 2017
@sandy081 sandy081 added the bug Issue identified by VS Code Team member as probable bug label Jun 19, 2017
@sandy081 sandy081 added this to the June 2017 milestone Jun 19, 2017
@sandy081 sandy081 modified the milestones: July 2017, June 2017 Jun 28, 2017
@sandy081 sandy081 modified the milestones: August 2017, July 2017 Jul 27, 2017
@sandy081 sandy081 modified the milestones: September 2017, August 2017 Aug 30, 2017
@sandy081
Copy link
Member

@letmaik Looks to me that .gitignore entry is properly aligned. I think the confusion is because the folder test does not has icon where as its sibling .gitignore has.

@sandy081 sandy081 added info-needed Issue requires more information from poster and removed bug Issue identified by VS Code Team member as probable bug labels Sep 25, 2017
@sandy081 sandy081 removed this from the September 2017 milestone Sep 25, 2017
@letmaik
Copy link
Member Author

letmaik commented Sep 25, 2017

No, the alignment is definitely incorrect, please check the screenshots again. The folders in the first screenshot in the explorer have no icons and yet the alignment is correct, contrary to what you see in the custom views. The alignment has to be on the level of the text/labels, not icons.

@sandy081
Copy link
Member

@letmaik It is similar to how folders/files are shown. Do you also think the alignment there is not correct?

@letmaik
Copy link
Member Author

letmaik commented Sep 26, 2017

To make it more visual I added some rulers below. Note the spacing between the vertical lines in the explorer vs the custom view.

Correct:
27264263-9ad1802c-5472-11e7-8329-5c56701d572e

Wrong (.gitignore doesn't align with test and fixture.ts is indented too much):
27264255-740381fc-5472-11e7-8e01-7e3cca9db5d3

Wrong (same problem):
27264347-54cd23a4-5474-11e7-8fb6-b5723765f847

@sandy081
Copy link
Member

Ah you are right, Got it. Thanks for the rulers they helped. I misunderstood with the files/folders explorer view.

@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Sep 26, 2017
@sandy081 sandy081 added this to the Backlog milestone Sep 26, 2017
@sandy081 sandy081 modified the milestones: Backlog, January 2018 Jan 15, 2018
@sandy081
Copy link
Member

sandy081 commented Feb 9, 2018

@letmaik Thanks for the feedback.

First of all I was bit confused here as I thought you wanted the custom views to be aligned with file explorer based on this comment and description.

I agree that extension authors should not be concerned about the theme information. Irrespective of icons/themes, tree nodes has to be aligned by their labels. I see this is the issue you raised if I am not wrong.

I think the crux of the problem here is that trees can have some nodes with icons and some without. If you see in your tree, test node has no icon and it's sibling node .editorconfig has an icon. To align these two either, I have to push .editorconfig node to left which will make it as a sibling to its parent or push test node to right, then its alignment w.r.to its parent looks broken.

Right fix here is to align all nodes by label and introduce a place holder icon for nodes missing icons.

With place holder icons, your git tree will be as follows

image

I would recommend to provide icons to avoid these missing icons. You can also provide the resourceUri if your node is file/folder from which the icon can be derived.

Let me know if it looks good for you, any feedback or suggestions are appreciated.

@sandy081
Copy link
Member

FYI.. Current placeholder icon is temporary.. will change it if I get a better icon.

@letmaik
Copy link
Member Author

letmaik commented Feb 12, 2018

I just looked at it and tried different combinations of missing icons, looks good I think! I like that it automatically aligns like Seti if you only have leaf icons. And then as soon as you have a non-leaf icon it switches to icons everywhere including placeholders where necessary. Right?
I think this is good, especially from an extension developers perspective as they now see what they have to do to make it look right (fill in placeholder icons if they use non-leaf icons).

@sandy081
Copy link
Member

You are right.. twisties and icons are aligned if none of the container(non-leaf) nodes have icons. Very much appreciated with your feedback here to make tree views look much better.

I will close this once I get a better place holder icon.

@sandy081
Copy link
Member

@chryw Can you please suggest/provide an icon that can be used as place holders for container nodes those do not have a icon. For eg: Icon with dotted lines in the following picture

image

@chryw
Copy link
Contributor

chryw commented Feb 27, 2018

@sandy081 what is that node (if not a folder)?

@sandy081
Copy link
Member

@chryw That node can be any as this view is contributed by extensions. Only semantics it has is, it is a node with children.

@chryw
Copy link
Contributor

chryw commented Feb 27, 2018

@sandy081 I'm trying to figure out the motivation of adding an "anything" icon here. Is it just for reserving the indentation? Or the icon does need to be informative, like saying what type this node is like other nodes?

@sandy081
Copy link
Member

@chryw Yes, It is just for indentation and does not need to convey any information.

@chryw
Copy link
Contributor

chryw commented Feb 27, 2018

@sandy081 Is it possible to default to folder icon if the node has children? I can't think of a good icon that means "anything" and not confusing. Or maybe leave that space blank if no icon is specified?

@sandy081
Copy link
Member

Leaving an empty place for the container node makes tree look a bit weird. For now, I am drawing the above icon as placeholder. May be I will continue to have this icon and let extension authors provide proper icon if they do not want place holder icons.

@sandy081 sandy081 added on-testplan and removed bug Issue identified by VS Code Team member as probable bug labels Feb 27, 2018
@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug and removed on-testplan labels Mar 1, 2018
@sandy081 sandy081 modified the milestones: February 2018, March 2018 Mar 1, 2018
@sandy081 sandy081 reopened this Mar 1, 2018
@sandy081
Copy link
Member

sandy081 commented Mar 1, 2018

I have to revert and reopen this because extension authors are not liking this placeholder approach to fix the tree alignment issue. I will revisit this with a different approach in next milestone.

Ref: #43531, #44619

@sandy081
Copy link
Member

Updated current implementation slightly to improve the experience (align the nodes per level).

Custom alignment for a node is done only when

  • the node is a leaf and has an icon and
  • Its parent does not has an icon and
  • there is no sibling with children and icon

image

Otherwise, extension is responsible for the alignment by providing icons. There will not be any placeholder icons.

@roblourens roblourens added the verified Verification succeeded label Mar 30, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug tree-views Extension tree view issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants