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

GDScript Symbol Tooltip #80044

Closed
Closed
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
f39a362
Implemented the initial V2 of a basic symbol tooltip. Created a new …
jwmcgettigan Jul 25, 2023
81335c9
Fixed _update_body_label()
jwmcgettigan Jul 25, 2023
bf0ef56
Added some additional logic for when a symbol is considered 'hovered'…
jwmcgettigan Jul 25, 2023
9fc8446
Some refactoring + improved hover logic.
jwmcgettigan Jul 27, 2023
ac17aa4
Fixed issue where the tooltip only appeared over the first occurrence…
jwmcgettigan Jul 29, 2023
ab5b542
Separated the SymbolTooltip from the CodeEditor layout. It is now pos…
jwmcgettigan Jul 29, 2023
3bfc609
Enabled hover delay.
jwmcgettigan Jul 29, 2023
9939cde
Fixed some code style failures.
jwmcgettigan Jul 29, 2023
9fb099d
Delay now resets when moving between different symbols + slight optim…
jwmcgettigan Jul 29, 2023
77b839e
Stopped duplicating the body content for scroll testing.
jwmcgettigan Jul 29, 2023
9333587
Merge branch 'master' into editor-symbols-tooltip-2
jwmcgettigan Jul 29, 2023
c740664
Update editor/symbol_tooltip.cpp
jwmcgettigan Jul 30, 2023
1b412f8
Misc spelling/formatting fixes.
jwmcgettigan Jul 31, 2023
2c6f065
Tooltip delay timer now derives wait time from the 'gui/timers/toolti…
jwmcgettigan Jul 31, 2023
25df5f8
SymbolTooltip can now fetch the AST tree root node and the GDScriptPa…
jwmcgettigan Jul 31, 2023
2961f93
Code style fixes + added member_symbol check.
jwmcgettigan Jul 31, 2023
cfd8172
Code style fix...
jwmcgettigan Jul 31, 2023
a15a408
Code style fix...
jwmcgettigan Jul 31, 2023
99a96f2
Merge remote-tracking branch 'origin/editor-symbols-tooltip-2' into e…
jwmcgettigan Jul 31, 2023
f67ebb6
Now retrieve symbol information from DocumentSymbol objects.
jwmcgettigan Aug 2, 2023
0bfe8cd
Enabled GDScript syntax highlighting for tooltip header.
jwmcgettigan Aug 4, 2023
14d82ea
Comment punctuation fixes.
jwmcgettigan Aug 4, 2023
30af6a0
Retrieved DocumentSymbol member should now always be the original.
jwmcgettigan Aug 5, 2023
26b0137
Fixed the formatting of document comments within the tooltip body.
jwmcgettigan Aug 5, 2023
ef19c73
GDScriptParser::DataType::to_string() now returns 'void' instead of '…
jwmcgettigan Aug 5, 2023
0d96a7a
Added a 'reduced_detail' property to DocumentSymbol for a more restri…
jwmcgettigan Aug 5, 2023
b441e3d
Added the parameter types to the DocumentSymbol 'detail' and 'reduced…
jwmcgettigan Aug 5, 2023
6a5e656
The DocumentSymbol 'name' is now populated for enums.
jwmcgettigan Aug 5, 2023
223c52b
The '_init' function will now have a 'void' return type instead of th…
jwmcgettigan Aug 5, 2023
790d563
Added the ability to disable scrollbars on TextEdit nodes.
jwmcgettigan Aug 5, 2023
98f8ecb
Added ENUM values as ENUM_VALUE child members.
jwmcgettigan Aug 6, 2023
27eb768
Fixed if condition.
jwmcgettigan Aug 6, 2023
a7e7ddf
Added a nullptr check.
jwmcgettigan Aug 6, 2023
2060968
Tooltip size now adapts to its contents - including the conditional v…
jwmcgettigan Aug 8, 2023
29e07cf
Partially implemented max width with line wrapping in header.
jwmcgettigan Aug 9, 2023
99b3ced
Misc minor improvements.
jwmcgettigan Aug 13, 2023
6a36bdc
Transitioned from PopupPanel to PanelContainer. Updated sizing calcu…
jwmcgettigan Sep 7, 2023
0cd17f4
A mouse exiting a tooltip now causes it to hide().
jwmcgettigan Sep 8, 2023
ea6bc7d
Removed unneeded code.
jwmcgettigan Sep 8, 2023
b154a41
Cleaned up issues caught by GitHub Actions.
jwmcgettigan Sep 10, 2023
e90ba29
Merge branch 'master' into editor-symbols-tooltip-2
jwmcgettigan Sep 10, 2023
82ab338
Formatting fixes.
jwmcgettigan Sep 10, 2023
4a2d88b
Fixed shadow variables.
jwmcgettigan Sep 10, 2023
73c5b89
Dynamic body width now actually adjusts to fit content.
jwmcgettigan Sep 10, 2023
26e7699
Moved content logic into separate functions.
jwmcgettigan Sep 10, 2023
e317b43
Added tooltip docs for built-in symbols + minor refactoring.
jwmcgettigan Sep 11, 2023
f348418
All parameters are now prefixed with 'p_'.
jwmcgettigan Sep 11, 2023
a4f68bc
Rearranged class methods.
jwmcgettigan Sep 11, 2023
e4b5d58
Update modules/gdscript/language_server/gdscript_extend_parser.cpp
jwmcgettigan Sep 11, 2023
6686fb9
Polished symbol info for built-in 'constant' and 'method' symbols.
jwmcgettigan Sep 11, 2023
3782e33
Polished symbol info for built-in 'enum' symbols.
jwmcgettigan Sep 11, 2023
f7d3155
Formatting adjustments
jwmcgettigan Sep 11, 2023
ea8a9a6
Formatting adjustments 2
jwmcgettigan Sep 11, 2023
517d25d
Removed potential cause of 'heap-use-after-free' error.
jwmcgettigan Sep 12, 2023
9597367
Enabled 'Copy' and 'Select All' context menu items on the tooltip body.
jwmcgettigan Sep 14, 2023
0c32564
Added the ability to compare Position variables and to check if one R…
jwmcgettigan Sep 29, 2023
0bda6e4
Sizeable refactor.
jwmcgettigan Sep 29, 2023
1c665af
Merge branch 'master' into editor-symbols-tooltip-2
jwmcgettigan Sep 30, 2023
41559e0
Post-merge adjustments.
jwmcgettigan Sep 30, 2023
3ddd23b
Updated all instances of DocumentSymbol to use pointers to allow the …
jwmcgettigan Oct 1, 2023
dc3f77a
Merge branch 'master' into editor-symbols-tooltip-2
jwmcgettigan Dec 15, 2023
037b646
Merge branch 'master' into editor-symbols-tooltip-2
jwmcgettigan Feb 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion editor/editor_help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,8 @@ void EditorHelp::_help_callback(const String &p_topic) {
}
}

static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control *p_owner_node, const String &p_class = "") {
// TODO: Should probably move this to a shared utility file/class so it can be accessed by both 'editor_help.cpp' and 'symbol_tooltip.cpp'
void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control *p_owner_node, const String &p_class) {
DocTools *doc = EditorHelp::get_doc_data();
String base_path;

Expand Down
2 changes: 2 additions & 0 deletions editor/editor_help.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,6 @@ class EditorHelpBit : public MarginContainer {
EditorHelpBit();
};

void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control *p_owner_node, const String &p_class = "");

#endif // EDITOR_HELP_H
8 changes: 8 additions & 0 deletions editor/plugins/script_text_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data

void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
Ref<InputEventMouseButton> mb = ev;
Ref<InputEventMouseMotion> mm = ev;
Ref<InputEventKey> k = ev;
Point2 local_pos;
bool create_menu = false;
Expand All @@ -1875,6 +1876,10 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
if (mb.is_valid() && mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
local_pos = mb->get_global_position() - tx->get_global_position();
create_menu = true;
} else if (mm.is_valid()) {
if (script->is_valid() && (script->has_source_code() || script->get_path().is_resource_file())) {
symbol_tooltip->update_symbol_tooltip(mm->get_position(), script);
}
} else if (k.is_valid() && k->is_action("ui_menu", true)) {
tx->adjust_viewport_to_caret(0);
local_pos = tx->get_caret_draw_pos(0);
Expand Down Expand Up @@ -2330,6 +2335,9 @@ ScriptTextEditor::ScriptTextEditor() {
connection_info_dialog = memnew(ConnectionInfoDialog);

SET_DRAG_FORWARDING_GCD(code_editor->get_text_editor(), ScriptTextEditor);

symbol_tooltip = memnew(SymbolTooltip(code_editor));
add_child(symbol_tooltip);
}

ScriptTextEditor::~ScriptTextEditor() {
Expand Down
3 changes: 3 additions & 0 deletions editor/plugins/script_text_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "script_editor_plugin.h"

#include "editor/code_editor.h"
#include "editor/symbol_tooltip.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
Expand Down Expand Up @@ -156,6 +157,8 @@ class ScriptTextEditor : public ScriptEditorBase {

void _enable_code_editor();

SymbolTooltip *symbol_tooltip = nullptr;

protected:
void _update_breakpoint_list();
void _breakpoint_item_pressed(int p_idx);
Expand Down
Loading