Skip to content

Commit 4b9bcda

Browse files
committed
GDScript: Add autocompletion for @export_tool_button
1 parent a210fe6 commit 4b9bcda

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

modules/gdscript/gdscript_editor.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
#ifdef TOOLS_ENABLED
4949
#include "core/config/project_settings.h"
5050
#include "editor/editor_file_system.h"
51+
#include "editor/editor_node.h"
5152
#include "editor/editor_settings.h"
53+
#include "editor/editor_string_names.h"
5254
#endif
5355

5456
void GDScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
@@ -942,6 +944,19 @@ static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_a
942944
option.insert_text = option.display.quote(p_quote_style);
943945
r_result.insert(option.display, option);
944946
}
947+
} else if (p_annotation->name == SNAME("@export_tool_button")) {
948+
if (p_argument == 1) {
949+
const Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();
950+
if (theme.is_valid()) {
951+
List<StringName> icon_list;
952+
theme->get_icon_list(EditorStringName(EditorIcons), &icon_list);
953+
for (const StringName &E : icon_list) {
954+
ScriptLanguage::CodeCompletionOption option(E, ScriptLanguage::CODE_COMPLETION_KIND_CLASS);
955+
option.insert_text = option.display.quote(p_quote_style);
956+
r_result.insert(option.display, option);
957+
}
958+
}
959+
}
945960
} else if (p_annotation->name == SNAME("@export_custom")) {
946961
switch (p_argument) {
947962
case 0: {

0 commit comments

Comments
 (0)