-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Code Editor: Add documentation tooltips #91060
base: master
Are you sure you want to change the base?
Conversation
dalexeev
commented
Apr 23, 2024
•
edited
Loading
edited
- Depends on Fix connecting a signal with a double click is too difficult #95044.
- Closes Implement script editor description hint on hover a symbol/word godot-proposals#1393.
- Supersedes Implement script editor hover hint with description #63908.
- Supersedes GDScript Symbol Tooltip #80044.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
b94d3fa
to
03b4d79
Compare
03b4d79
to
bec6fd0
Compare
bec6fd0
to
d4f27de
Compare
d4f27de
to
1a1075c
Compare
1a1075c
to
3515e37
Compare
Tested again and it works great now. One major issue is that when moving cursor very slightly the tooltip will disappear, even if you move it over the same symbol. It will open again, but the frequent blinking is bothersome. Also if you hover a symbol and then move the cursor far away, even outside script editor, the tooltip will still appear. godot.windows.editor.dev.x86_64_i5Yg4ovIAM.mp4 |
3515e37
to
3e0c867
Compare
Ready for testing/review.
Along the way I noticed/fixed a few bugs in
Fixed, thanks.
I understand that Visual Studio Code does it better (the tooltip doesn't disappear until the mouse leaves the symbol), but I'd rather leave it as is for now. This is consistent with the behavior in the inspector and signal dock, and it's also the same as in Kate. But most importantly, it's technically hard to do. The tooltip checks if the mouse has left the target. This works for simple controls, but not for I'd suggest leaving non-critical issues for later PRs, as I don't want to further affect unrelated parts of the engine. In my opinion, this is not a very critical issue, I tried to make it so that the tooltip does not interfere with keys, clicks, scrolling and text selection. Another usability issue is that |
Hovering over variable definition does not show a tooltip. It could be useful when using inference, so e.g. you can hover
For some reason I find it more difficult to see tooltips in code editor than in the inspector. Maybe the minimum movement is too small? |
3e0c867
to
7ba0c58
Compare
Looks like it's not implemented in the parser: godot/modules/gdscript/gdscript_parser.h Lines 1294 to 1298 in 19e003b
When I hover over the variable declaration identifier I get This and some other issues with incorrect hints are material for future PRs.
I can't reproduce it on Linux. I encountered this during development, but at some point the bug disappeared. |
@@ -3753,6 +3789,13 @@ CodeEdit::CodeEdit() { | |||
set_gutter_custom_draw(gutter_idx, callable_mp(this, &CodeEdit::_fold_gutter_draw_callback)); | |||
gutter_idx++; | |||
|
|||
/* Symbol tooltip */ | |||
symbol_tooltip_timer = memnew(Timer); | |||
symbol_tooltip_timer->set_wait_time(GLOBAL_GET("gui/timers/tooltip_delay_sec")); |
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.
Would be nice to update it with settings_changed
signal.
@@ -166,6 +188,39 @@ static String _contextualize_class_specifier(const String &p_class_specifier, co | |||
return p_class_specifier.substr(p_edited_class.length() + 1); | |||
} | |||
|
|||
/// EditorHelpBit /// | |||
|
|||
// TODO: this is sometimes used directly as doc->something, other times as EditorHelp::get_doc_data(), which is thread-safe. |
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.
// TODO: this is sometimes used directly as doc->something, other times as EditorHelp::get_doc_data(), which is thread-safe. | |
// TODO: This is sometimes used directly as doc->something, other times as EditorHelp::get_doc_data(), which is thread-safe. |
Looks like the description can't be determined in complex code: I assume this is related to #95821? |
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 base functionality works fine. I agree it can be improved later if needed.
I checked the code of editor and gui in the second commit and also looks ok.