-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add rich tooltips for plugin trees and VSX extensions #10108
Add rich tooltips for plugin trees and VSX extensions #10108
Conversation
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.
@thegecko given the fact we don't have an example where the new tooltip renderer is actually used in the codebase (meaning it is hard to test especially regressions), can we not add a example in the api-samples
?
Depends on the effort involved... Is |
It's an extension that is part of our repo and included in the examples (browser and electron) but not published: The idea is to at least have one example in the repo for test purposes, and given nothing at the moment uses the new tooltip renderer it is hard to test, add features to, and verify for any possible regressions. |
cc59a3c
to
5d43e3d
Compare
5d43e3d
to
ae8192a
Compare
Still working on an api-example, please bear with me. I believe all other comments/requests have been resolved. |
Signed-off-by: robmor01 <[email protected]>
88f61fd
to
2fed721
Compare
@vince-fugnitto I spent some time trying to devise an I found it far easier to simply implement the vsx-extension tooltips you suggested (see updated PR description). Would this suffice as a usage example? |
bump @vince-fugnitto |
Sorry @thegecko I didn’t get a chance to review the pull-request yet, I’ll likely do so on Tuesday when I’m back at work. I think implementing it for vsx was a great idea 👍 |
No problem! |
.vscode/launch.json
Outdated
}, | ||
{ | ||
"name": "Launch Browser Backend & Frontend", | ||
"configurations": [ | ||
"Launch Browser Backend", | ||
"Attach to Plugin Host", | ||
"Launch Browser Frontend" | ||
] |
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.
@thegecko should the changes be added to a separate commit, I believe they are overall unrelated to the pull-request.
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.
Removed
} | ||
|
||
get tooltip(): string { | ||
const details = this.getData('readme') || this.description; |
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.
@thegecko I believe it might be too much information to use the readme
, it will lead to the following issue:
- search
gitlens
- use the tooltip on the first result
vsx-tooltip.mp4
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.
Readme removed
@vince-fugnitto Comments addressed |
} | ||
|
||
protected doRender(): React.ReactNode { | ||
return <ReactTooltip id={this.tooltipId} className='theia-tooltip' html={true} delayShow={1000} />; |
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.
Could we use some type of TooltipProps
where clients can more easily configure how they want their tooltips to behave, and possibly support other react-tooltip
options? For example if they want to update delayShow
.
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 looked at the props and didn't find much we'd want to expose. I'd also suggest the popup delay is kept consistent across the product
} | ||
|
||
protected doRender(): React.ReactNode { | ||
return <ReactTooltip id={this.tooltipId} className='theia-tooltip' html={true} delayShow={1000} />; |
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.
The delay in the vsx-registry felt a bit long, any reason you chose 1 second?
return <ReactTooltip id={this.tooltipId} className='theia-tooltip' html={true} delayShow={1000} />; | |
return <ReactTooltip id={this.tooltipId} className='theia-tooltip' html={true} delayShow={500} />; |
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 timed the vscode popup
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 agree with Vince here. It seems like the delay is indeed a bit long (depending on which OS you're using). See this setting in the vscode codebase which controlls the delay of the tooltip popup.
I'd be in favor of adding a similar setting to the preferences in here.
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.
Heh, I'm on a mac hence the longer delay experienced!
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.
The changes look good to me 👍
I'll give others the opportunity to review as a well!
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.
Code looks good to me as well! I have one minor comment and also would like to see the hover delay preference added. Afterwards this is good to go 👍
What is wanted here? @vince-fugnitto suggested making it quicker, alternatively it could be editable. Is that globally or on a per popup basis? |
Ack, I'll do that |
Version and preference suggestions implemented. |
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.
Great, LGTM!
Signed-off-by: robmor01 [email protected]
What it does
The plugin-ext support for tree views coming from VSCode plugins doesn't support rendering markdown in tooltips.
This PR introduces functionality to render a rich tooltip when a plugin supplies markdown for that purpose.
It checks that the string passed is markdown before rendering, so shouldn't interfere with normal titles and doesn't instantiate the tooltip renderer until required.
Additionally, this new tooltip functionality has been used to add a tooltip to the VSX extensions panel.
This PR introduces a new direct dependency to react-tooltip (MIT), so let's see what the new
License check
GitHub CI flow says.The tooltip has been made available to the entire application and can render html. As this has to be set programmatically, it shouldn't pose a security risk.
Tooltip follows the theming of Theia (see below)
Note: There is a minor addition to the
launch.json
file for a compound configuration toLaunch Browser Backend & Frontend
How to test
Open the VSX extensions panel and observe the tooltips.
To test tooltips on plugin trees, use theia with a plugin which offers known markdown tooltips, e.g. the SVD peripheral viewer of cortex-debug
Screenies
Tooltip support for the VSX-extensions:
Plugin tree tooltip (Dark):
Plugin tree tooltip (Light):
Review checklist
Reminder for reviewers