-
Notifications
You must be signed in to change notification settings - Fork 37.5k
Feature/107183 add ability to right align tree items description #268093
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
base: main
Are you sure you want to change the base?
Feature/107183 add ability to right align tree items description #268093
Conversation
…t-align-TreeItems-description
@microsoft-github-policy-service agree |
…eeItems-description
…eeItems-description
…eeItems-description
alexr00
left a comment
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.
Thank you for the PR! We're about to start our endgame. I'll take a close look at this PR once we branch for release at the end of next week.
| * When `right`, the text with be right-aligned and when `left`, it is left-aligned. | ||
| * Defaults to `Left` | ||
| */ | ||
| alignment?: TreeItemAlignment; |
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 think we want to allow extension authors to set a description (left aligned) and a second description (right aligned) instead of just the one description which we allow extension authors to set the alignment of. Not sure about a good name for this "second description". Maybe detail?
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.
Ah, understood. I'm assuming the styling (apart from the alignment) should mimic that of the description? e.g.: font/size/color/etc.
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.
@alexr00 Hi, can I get clarification on how we want this to function?
In this image, you can see that long text has the potential to hide or clash with the left-aligned text (all the TreeItems in the picture have both description and detail set, the label and description is just hidden when the right-aligned text overlaps).
In terms of styling, I also assume we want a different colouring/etc?
Issue #107183: Add a new right-aligned "description" property to TreeItems
Added the ability for VS Code extensions utilizing the
TreeViewto horizontally align thedescriptionproperty ofTreeItemsto the right. Default value remains left-aligned.How to Test
Clone the vscode-extension-samples project
Open the
tree-view-samplein CodeOpen
src/nodeDependencies.ts#Add a new line right below where the
TreeItem.descriptionis being set(since the repo references a released version of the vscode api you will want to also add an
// @ts-ignoreright about it just for testing)Run the extension as usual
Open any repo utilizing npm (I just created a new folder and ran
> npm i threeClick on the new list clover in the left-hand sidebar that the extension added
Expand the tree and all the package versions will now be aligned to the right
Since
TreeItemactions appear to the right, the description will hide any-time they show as to not clash.