-
-
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
Implement script editor hover hint with description #63908
base: master
Are you sure you want to change the base?
Implement script editor hover hint with description #63908
Conversation
8207caa
to
97c52ea
Compare
97c52ea
to
c47755a
Compare
005a497
to
08c3599
Compare
ad65f6f
to
34ef392
Compare
34ef392
to
39ad7ec
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 (rebased on top of master
851bc64), it works. I think this is a good start, and having this feature will improve the script editor's usability a lot.
simplescreenrecorder-2023-07-17_00.08.40.mp4
There are a few usability issues I noticed:
-
Script descriptions don't seem to appear for user-provided properties and methods, even if you restart the editor.
-
Strings that match a function name (without parentheses after the function name) will display the function popup (see the end of the above video).
-
The hover duration seems pretty low – I frequently accidentally make the popup appear when I don't want to. This is annoying, as the popup also blocks mouse input including scrolling (it scrolls the block if possible, instead of the script).
- In comparison, it takes roughly twice as long for hover tooltips to show up in VS Code.
-
Colors are hard to read on a light editor theme, even after restarting the editor:
simplescreenrecorder-2023-07-17_00.10.28.mp4
These issues need to be addressed somehow before this PR can be merged.
All right, I'll see what I can do. |
Co-authored-by: George L. Albany <[email protected]>
Replaced with symbol_hovered(symbol, symbol_col_line) signal Added annotations to hint lookup Expanded hint lookup Added SymbolHintHelpBit to display hover hints in ScriptTextEditor Removed p_lookup parameter from ScriptTextEditor::_validate_symbol Moved functionality to _hovered_symbol instead Added _show_symbol_hint and _hide_symbol_hint to ScriptTextEditor Added text_editor/hints/hover editor settings Added TextEdit::get_word_line_column_at_pos
39ad7ec
to
37d50ce
Compare
|
Yeah I'm aware, I've gotten busy and haven't had as much time to work on this. |
Supersedes #41502
Closes godotengine/godot-proposals#1393
Right now this is just a rebase and basic conversion of #41502 to master, (including CodeEdit changes) I tried to ensure it has a bare minimum functionality testing it, it does properly display the hints, but some things are as of now missed, and I seem to have not gotten documentation to work properly, it'll stay a draft until I can clean this up a bit.This is no longer a direct conversion of #41502, there are things I missed in implementing this proposal in full, I'm not entirely confident this is even a totally correct implementation, hence why I left the initial convert commit (despite being somewhat bugged) unchanged for now and the big reason its still a draft, (the initial conversion was still fairly bugged too and sort of re-implemented rich text popup functionality in CodeEdit) however this does implement many more improvements, alongside some few bugs. I committed this to get eyes on it and to improve this beyond what I've been able to do from this point.
Improvements
_add_text_to_rt
function from /editor/editor_help.cpp.symbol_hovered(symbol : String, symbol_column_line : Vector2)
signal that ScriptTextEditor relies on for hover hintsget_word_line_column_at_pos(mouse_pos : Vector2) -> Vector2i
to TextEditget_word_at_pos
but retrieves the line and column of the first character of the word, used by thesymbol_hovered
signal to abstract the need for retrieving the mouse position.Known Issues
get_word_at_pos
)$
may be treated as the type they are named after regardless of whether they're actually based on that type (for example if you named aPopup
as PopupMenu, the symbol hint for$PopupMenu
will display a hint forPopupMenu
)