-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
basic doc tooltip #5103
Conversation
4138b52
to
cbb8ffe
Compare
e673172
to
ce40c42
Compare
Codecov ReportPatch coverage:
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
Flags with carried forward coverage won't be shown. Click here to find out more.
... 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. |
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 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.
@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)? |
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.
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); |
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.
nitpick: presuming editor
is defined in the window
scope, can we change this to:
loadLanguageProvider(editor); | |
loadLanguageProvider(window.editor); |
?
let session = editor.session; | ||
let docPos = e.getDocumentPosition() ; | ||
|
||
languageProvider.doHover(session, docPos, function(hover) { |
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.
Similar suggestion about using window
explicitly:
languageProvider.doHover(session, docPos, function(hover) { | |
window.languageProvider.doHover(session, docPos, function(hover) { |
if (languageProvider.$descriptionTooltip) | ||
editor.off("mousemove", languageProvider.$descriptionTooltip.onMouseMove); |
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.
Personally I think it's clearer if we always use window
when referring to variables in the window
scope
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; |
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.
renderer
seems to be unused
There are 2 tiny bugs I noticed (see gif below), though not critical so I approved & merged anyways:
|
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.