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

basic doc tooltip #5103

Merged
merged 2 commits into from
Apr 14, 2023
Merged

basic doc tooltip #5103

merged 2 commits into from
Apr 14, 2023

Conversation

nightwing
Copy link
Member

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@nightwing nightwing force-pushed the doc-tooltip branch 2 times, most recently from 4138b52 to cbb8ffe Compare March 30, 2023 14:11
@nightwing nightwing marked this pull request as ready for review March 30, 2023 14:31
@nightwing nightwing force-pushed the doc-tooltip branch 3 times, most recently from e673172 to ce40c42 Compare March 30, 2023 14:44
@codecov
Copy link

codecov bot commented Apr 1, 2023

Codecov Report

Patch coverage: 92.51% and project coverage change: +0.23 🎉

Comparison is base (3c149a9) 86.47% compared to head (79b83c9) 86.70%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5103      +/-   ##
==========================================
+ Coverage   86.47%   86.70%   +0.23%     
==========================================
  Files         555      556       +1     
  Lines       43035    43403     +368     
  Branches     6704     6754      +50     
==========================================
+ Hits        37214    37633     +419     
+ Misses       5821     5770      -51     
Flag Coverage Δ
unittests 86.70% <92.51%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/tooltip.js 86.63% <88.53%> (+15.52%) ⬆️
src/tooltip_test.js 98.96% <98.96%> (ø)

... and 13 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

src/tooltip_test.js Outdated Show resolved Hide resolved
Copy link
Contributor

@InspiredGuy InspiredGuy left a comment

Choose a reason for hiding this comment

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

I have noticed in https://raw.githack.com/ajaxorg/ace/doc-tooltip/kitchen-sink.html that if you hover over something, which produces a doc-tooltip, and then move mouse to hover over gutter icon, the HoverTooltip remains - it stays on top of gutter tooltip and overlaps it. Is this something we want to tackle as part of this PR?
I reproduced it on Typescript mode. Since any keystroke I did removed the doc-tooltip, I took the photo with my phone.
image

@InspiredGuy InspiredGuy mentioned this pull request Apr 4, 2023
@InspiredGuy
Copy link
Contributor

@nightwing if we have multiple instances of HoverTooltip, and try to show multiple tooltips at once for the same range, would current implementation just show one? Would it be better to show one on the top and one on the bottom (if positioning allows)?

Copy link
Contributor

@andredcoliveira andredcoliveira left a comment

Choose a reason for hiding this comment

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

Left a few comments. The ones in the demo file are not really relevant. An additional comment would be similar to what @InspiredGuy mentioned of allowing more than one popup at once if there is room for it.

useAceLinters: {
set: function(val) {
if (val && !window.languageProvider) {
loadLanguageProvider(editor);
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: presuming editor is defined in the window scope, can we change this to:

Suggested change
loadLanguageProvider(editor);
loadLanguageProvider(window.editor);

?

let session = editor.session;
let docPos = e.getDocumentPosition() ;

languageProvider.doHover(session, docPos, function(hover) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar suggestion about using window explicitly:

Suggested change
languageProvider.doHover(session, docPos, function(hover) {
window.languageProvider.doHover(session, docPos, function(hover) {

Comment on lines +90 to +91
if (languageProvider.$descriptionTooltip)
editor.off("mousemove", languageProvider.$descriptionTooltip.onMouseMove);
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I think it's clearer if we always use window when referring to variables in the window scope

Suggested change
if (languageProvider.$descriptionTooltip)
editor.off("mousemove", languageProvider.$descriptionTooltip.onMouseMove);
if (window.languageProvider.$descriptionTooltip)
editor.off("mousemove", window.languageProvider.$descriptionTooltip.onMouseMove);



docTooltip.setDataProvider(function(e, editor) {
var renderer = editor.renderer;
Copy link
Contributor

Choose a reason for hiding this comment

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

renderer seems to be unused

src/tooltip.js Show resolved Hide resolved
@andredcoliveira andredcoliveira merged commit 40e4e35 into master Apr 14, 2023
@andredcoliveira andredcoliveira deleted the doc-tooltip branch April 14, 2023 09:52
@andredcoliveira
Copy link
Contributor

There are 2 tiny bugs I noticed (see gif below), though not critical so I approved & merged anyways:

  • the hover tooltip can collide with a signature tooltip and be partially hidden
  • the behaviour when moving the mouse from the token into the tooltip is not always consistent:
    • sometimes the tooltip is hidden even if the mouse never left the token while moving into the tooltip

small_tooltip_bugs

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.

5 participants