Vscode: Allow custom tree hovers to be markdown

Created on 22 Jun 2020  路  16Comments  路  Source: microsoft/vscode

Currently, the tooltip for custom tree items can only be a string. We should also allow markdown.

api api-finalization explorer-custom feature-request

Most helpful comment

@mattacosta I pushed a fix that should be available in insiders tomorrow.

All 16 comments

So I was only able to get my tooltips containing markdown to work by implementing a do-nothing resolveTreeItem() method. Is that supposed to happen? My tree does not need to resolve any data.

Not supposed to happen. I will take a look.

However, if you tree is going to have many items it is better to set the markdown tooltip in resolveTreeItem so that you aren't creating all that markdown in advance.

@mattacosta I pushed a fix that should be available in insiders tomorrow.

More feedback: Not sure if anything can even be done about this, but I'm now noticing that it is significantly easier for the cursor to get into the new hovers compared to the native tooltips, thereby preventing them from going away. This makes it more difficult and/or frustrating to select the tree items that it covers.

I think this is mostly because they are larger, but it would help if the hovers had one of their corners at your mouse, instead of starting where the tree html element starts.

@Tyriar would it be possible to do this?

@alexr00 use IHoverOptions.hideOnHover to make the hover go away when you hover over it, this is ignored if you provide actions though.

@Tyriar would it be possible to have the corner of the hover at the mouse instead of in line with the html element it's attached to?

@alexr00 hideOnHover isn't a good enough solution? Is the hiding of tree items too disruptive? Can you show a gif of the issue as I'm not sure how to show it on the tree atm.

@Tyriar There are things to click and select in the hover, so hideOnHover doesn't sound like something I want to use.
recording (10)

If it's at the mouse position though you would need to move the mouse to the right in order to hover it. Is this what you mean?

image

cc @misolori

Yep, that's exactly what I mean! That way the behavior is more consistent with the default tooltip and it doesn't obscure all of the tree above it.

Anything blocking this from moving to Stable?

Yes, I need to get the hover working properly on resources (files and the like) when they are in the tree. Once that's good, we can move it to stable shortly after.

  • swap argument order
  • use ProviderResult
Was this page helpful?
0 / 5 - 0 ratings