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

Hovers using PrimeReact Tooltip #87

Merged

Conversation

gbodeen
Copy link
Contributor

@gbodeen gbodeen commented Feb 28, 2024

What it does

Handles issue 66 by way of recreating the hovers from the Theia memory hover renderer. PrimeReact has a Tooltip component that automatically handles visibility and placement, though in my testing it sometimes gets a little behind the current state if you rapidly switch hovering between many fields.

Variable in the Variables column:
image

Group in the Data column:
image

Address:
image

How to test

Hover over entries in either the address, data, or variable column. It should continue to work even after changing display options.

Review checklist

Reminder for reviewers

@jreineckearm
Copy link
Contributor

Thanks a lot, @gbodeen , adding those tooltips back is really useful!
Do you have plans to align the styling with what the Theia Memory Inspector had? Like aligning the beginnings of values and the coloring.

@gbodeen
Copy link
Contributor Author

gbodeen commented Mar 4, 2024

@jreineckearm , I can take a look through the styles Theia uses. Let me know if there are any divergences from Theia's version that you'd prefer.

@jreineckearm
Copy link
Contributor

Thanks @gbodeen !

I think the styling in the Theia version was good. In general, I think it would be good to be close to what other built-in views have. Thinking here in particular about the green variable value color in the Variables window. Or the green and blue tones used in some variable hovers in the source editor while debugging.

image

image

But I can see that the styling in the Theia version is already pretty much that:
image

@gbodeen gbodeen force-pushed the upstreamable-tooltip-hovers branch from ecf9edd to 0aea797 Compare March 5, 2024 19:40
@gbodeen
Copy link
Contributor Author

gbodeen commented Mar 5, 2024

New styling examples:

Dark
image

Light
image

Solarized Dark
image

I also made a slight change to the Address entries. Now the row matching the visible radix is slightly distinguished.

Tomorrow Night Blue theme, Address is hexadecimal:
image

now the Address is octal:
image

@gbodeen gbodeen force-pushed the upstreamable-tooltip-hovers branch from 0aea797 to 5939ab8 Compare March 5, 2024 20:24
@gbodeen
Copy link
Contributor Author

gbodeen commented Mar 5, 2024

One more small change, the utf8 values are presented in a text color rather than a number color, similar to the Theia memory inspector hovers.
image

@gbodeen gbodeen force-pushed the upstreamable-tooltip-hovers branch 2 times, most recently from f97f147 to 039cc4a Compare March 5, 2024 21:37
@jreineckearm
Copy link
Contributor

Looks good, @gbodeen ! I like the table approach in the tooltip!

Was thinking about the used format name color. As orange could indicate an error or a warning. But would suggest to keep it because it's used in various places in VS Code debug. And we have only a limited set of colors that can be derived from VS Code.

I'll add a suggestion to the tooltip creation for

  • Delaying the hoverover by a second.
  • Disable autoHide. This allows to move the mouse into the tooltip and to copy & paste values from there.

Both are debatable. So, no super-strong opinion on adding them if you prefer to go without.

Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gbodeen! Philip is out this week so he asked me to have a look at the PR. It really looks nice and seems to work very well, so thank you very much for that great contribution!

I do have a few comments but nothing major that should prevent this PR from being merged. I just have the feeling that the tooltips are a bit "aggressive" as they appear immediately, maybe a short delay could help. But this is personal taste and if we feel like this might irritate users we can always create a preference for it afterwards as well.

src/webview/memory-webview-view.tsx Outdated Show resolved Hide resolved
src/webview/components/memory-table.tsx Outdated Show resolved Hide resolved
src/webview/components/memory-table.tsx Show resolved Hide resolved
@gbodeen gbodeen force-pushed the upstreamable-tooltip-hovers branch from 6c16770 to d9e4447 Compare March 7, 2024 19:59
Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gbodeen, thank you very much for the update! I think we are almost there. I do have some minor comments so I'd be interested to get your opinion on that. Otherwise, I think this is in a good state. Great work!

Btw, could you please add a separate commit on top next time so it is more obvious which parts have changed? That would make the re-reviewing process a bit easier, thank you!

src/webview/columns/address-column.tsx Outdated Show resolved Hide resolved
@@ -47,11 +47,11 @@ export class DataColumn implements ColumnContribution {
const isLast = i + 1n >= range.endAddress;
const style: React.CSSProperties | undefined = isLast ? undefined : this.byteGroupStyle;

groups.push(<span className='byte-group' style={style} key={i.toString(16)}>{words}</span>);
groups.push(<span className='byte-group hoverable' data-column='data' style={style} key={i.toString(16)}>{words}</span>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it might make sense to apply additional hover feedback/highlighting on the span? Since we might have several words per group it could really make it more obvious which part we actually show hover information for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a dotted underline like this?
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is very subtle but I like it, thank you!

target=".hoverable"
onBeforeShow={this.handleOnBeforeTooltipShow}
onHide={this.handleOnTooltipHide}
showDelay={1000}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I requested the delay but 1000 feels like too long now, maybe going down a bit might help? What do you think, @jreineckearm?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine going down a little with that. We should only make sure that the user has enough time without the tooltip when moving through the table in a stop and go manner, for example when using the mouse as a kind of means to guide their eye movement (not sure if that made sense).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default hover delay in the VSCode editor is 300ms. I'll use that.

Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good to me now! Thank you very much @gbodeen!

Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much @gbodeen! This looks really good, functionality- and code-wise.

Also thanks @martin-fleck-at and @jreineckearm for your reviews and inputs! Now my job is pretty simple :-)

@planger
Copy link
Contributor

planger commented Mar 12, 2024

I've seen there are some conflicts. Can you please resolve those conflicts and I'm happy to merge, or @colin-grant-work can merge this after rebasing. Thank you!

@gbodeen gbodeen force-pushed the upstreamable-tooltip-hovers branch from 9d386a4 to a01d06e Compare March 12, 2024 14:55
@colin-grant-work colin-grant-work merged commit 3cd4184 into eclipse-cdt-cloud:main Mar 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants