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

Allow TreeItem.label to support MarkdownString #115365

Open
TylerLeonhardt opened this issue Jan 29, 2021 · 12 comments
Open

Allow TreeItem.label to support MarkdownString #115365

TylerLeonhardt opened this issue Jan 29, 2021 · 12 comments
Assignees
Labels
api-proposal feature-request Request for new features or functionality tree-views Extension tree view issues
Milestone

Comments

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Jan 29, 2021

Looking at the API for TreeItemLabel it seems a bit limited. I'm trying to avoid moving to a webview view and what I need is some way to have certain nodes in a tree view be crossed out. It'd be nice if TreeItem.label could be extended to support MarkdownString.

Proposal:

export class TreeItem {
		/**
		 * A human-readable string describing this item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
		 */
		label?: string | TreeItemLabel | MarkdownString;
}
@alexr00
Copy link
Member

alexr00 commented Feb 1, 2021

I am not adverse to to this proposal. @TylerLeonhardt would you be interested in bringing the proposal to the API sync?

@connor4312
Copy link
Member

I wonder if we should support MarkdownString (with a subset of functionality) instead of introducing new semantics for text styles.

@TylerLeonhardt TylerLeonhardt added this to the February 2021 milestone Feb 2, 2021
@TylerLeonhardt
Copy link
Member Author

TylerLeonhardt commented Feb 2, 2021

Interesting... So every TreeItem can only be rendered on 1 line, however, multiple lines is technically supported in the hover:
image

In theory, the full extent of MarkdownString could be supported in the hover, but I think there's a lot of MarkdownString that doesn't make sense for the label:

  • Headings
  • Table
  • Code block
  • Quote block
  • Lists
  • Images
  • Links? (since that would interfere with click event handler)

Which leaves:

  • Strikethrough
  • Bold
  • Italics
  • Inline code

I wonder if that would cause confusion.

@TylerLeonhardt TylerLeonhardt added the tree-widget Tree widget issues label Feb 2, 2021
@TylerLeonhardt TylerLeonhardt self-assigned this Feb 2, 2021
@alexr00 alexr00 added the tree-views Extension tree view issues label Feb 3, 2021
@lukaschneider
Copy link

Hey,
I am currently working on an extension which enables a user to open packet traces in vscode. While prototyping I came across this issue.

Having an option to use a monospaced font would improve readability a lot in my case.

Before:
before

After:
after

@TylerLeonhardt TylerLeonhardt modified the milestones: February 2021, Backlog Feb 9, 2021
@TylerLeonhardt TylerLeonhardt changed the title Allow TreeItemLabel to support Strikethrough/Bold/Italics Allow TreeItemLabel to support MarkdownString Feb 9, 2021
@TylerLeonhardt TylerLeonhardt changed the title Allow TreeItemLabel to support MarkdownString Allow TreeItem.label to support MarkdownString Feb 9, 2021
@TylerLeonhardt
Copy link
Member Author

Updated issue to move to MarkdownString per API Sync feedback.

@TylerLeonhardt TylerLeonhardt removed their assignment Jun 10, 2021
@P403n1x87
Copy link

It would be nice if colours were supported too, but I believe this not something that could be achieved with a MarkdownString? Would it make sense to have a way to bypass escaping when setting the label value and allow nested span objects?

@mkloar
Copy link

mkloar commented Jul 23, 2021

It would be nice if colours were supported too, but I believe this not something that could be achieved with a MarkdownString? Would it make sense to have a way to bypass escaping when setting the label value and allow nested span objects?

Yeah, I would be great if vscode API will support colours.

@joaomoreno joaomoreno removed the tree-widget Tree widget issues label Nov 5, 2021
@alexr00 alexr00 added the feature-request Request for new features or functionality label Nov 10, 2021
@generateui
Copy link

Interesting... So every TreeItem can only be rendered on 1 line, however, multiple lines is technically supported in the hover: image

In theory, the full extent of MarkdownString could be supported in the hover, but I think there's a lot of MarkdownString that doesn't make sense for the label:

* Headings

* Table

* Code block

* Quote block

* Lists

* Images

* Links? (since that would interfere with click event handler)

Which leaves:

* Strikethrough

* Bold

* Italics

* Inline code

I wonder if that would cause confusion.

It would make snese to me when vscode has a differentiator: MarkdownBlockString and MarkdownInlineString. After all, close to all apis/asts/parsers I have seen make this distinction.

@jedwards1211
Copy link
Contributor

I'm working on a semantic search and replace extension and I still can't replicate the appearance of the builtin find/replace results with the existing TreeView API.

@dustinlacewell
Copy link

Please prioritize this as it's quite limiting to the UX of TreeView based extensions. Thanks.

@whitequark
Copy link

I would also like to use this capability in a debugger extension that cannot utilize the debugger API (it's not a debugger for software). Colors would be extremely useful.

@EhabY
Copy link
Contributor

EhabY commented Feb 8, 2024

When implementing this please take into account coloring the label (or parts thereof), possibly using ThemeColor. Currently the only way to color a label is to use a FileDecorationProvider but that is global and applies the color to the full label - We want something that is for a single TreeItem only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-proposal feature-request Request for new features or functionality tree-views Extension tree view issues
Projects
None yet
Development

No branches or pull requests