-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Code Editor: Add documentation tooltips #91060
Conversation
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. |
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.
LGTM
d1d7010
to
218d226
Compare
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.
Tested locally, it works as expected.
Note that you can select and drag code that's behind the tooltip. You also can't scroll the scrollbar that is present for long descriptions, but as the above comments say, it may be better to leave it as-is for now.
Regarding the spawn position of the tooltip, it should probably spawn above the hovered line instead of below. It should also be done at a fixed position (corner aligned to the beginning of the hovered word), not taking the mouse cursor's position into account. This way, you can still look at the lines following the hovered line, which is usually more relevant in most situations. Of course, if there isn't enough space to show the tooltip above the hovered line, then it should be shown below as is done currently.
See VS Code for an example:
Also, there could be a keyboard shortcut to show the tooltip the cursor is under, so that you don't have to open the full documentation page if you're just interested in a single method's description. VS Code uses a dual combination for this (Ctrl + K then Ctrl + I) but I'd prefer something less cumbersome.
Are you using single window mode? This bug exists from the start. Scrolling should work in multi-window mode.
I think it's easy to fix, just change the priority in
This is more difficult to do, I wrote above why. I would prefer to leave it for the next iterations.
I'm not sure I understood what you meant, but we could add a button to the tooltip title or make the symbol name a link: |
Done, but I really don't like how it looks. If for short descriptions it looks more or less ok, then for long descriptions it is not convenient. All symbol information as well as brief description (for classes) are located too far from the cursor. Maybe I am too used to tooltips in Kate, but it seems to me that VSC-way is not suitable here. And I don't really understand what problem this solves? Don't overlap the code below? But the tooltip disappears when you start typing and it is impossible to say which context will be more useful for you at the moment, with the same success it could be the code above. |
572df9e
to
e637486
Compare
e637486
to
80d1150
Compare
I think of my own personal bias that the tooltip's background is not distinct at all from the Script editor's, at least by default. That, combined with not much inner padding, makes the tooltip look "noiser" than it should, I feel. |
Thanks! |
This is what I mean: vscode_ctrl_k_ctrl_i.mp4At the end of the video, I press Ctrl + K then Ctrl + I to make the tooltip appear without having to touch the mouse. I've opened a proposal to keep track of this: godotengine/godot-proposals#11365 |
Perhaps in the future it will be possible to add this to the help on scripting, for links on functions. |
Is a side effect of this that ctrl+click on a function call in my own GDscript code always leads to the documenation rather than the code for the function itself like before? I would like to know if there is a way to get the old behaviour as this severely afects my workflow. |
Screenshots