Skip to content

Commit 3b963ab

Browse files
committed
Merge pull request godotengine#105081 from dalexeev/gds-add-export-tool-button-autocompletion
GDScript: Add autocompletion for `@export_tool_button`
2 parents 3cc71ef + 4b9bcda commit 3b963ab

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
Vector<String> GDScriptLanguage::get_comment_delimiters() const {
@@ -945,6 +947,19 @@ static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_a
945947
option.insert_text = option.display.quote(p_quote_style);
946948
r_result.insert(option.display, option);
947949
}
950+
} else if (p_annotation->name == SNAME("@export_tool_button")) {
951+
if (p_argument == 1) {
952+
const Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();
953+
if (theme.is_valid()) {
954+
List<StringName> icon_list;
955+
theme->get_icon_list(EditorStringName(EditorIcons), &icon_list);
956+
for (const StringName &E : icon_list) {
957+
ScriptLanguage::CodeCompletionOption option(E, ScriptLanguage::CODE_COMPLETION_KIND_CLASS);
958+
option.insert_text = option.display.quote(p_quote_style);
959+
r_result.insert(option.display, option);
960+
}
961+
}
962+
}
948963
} else if (p_annotation->name == SNAME("@export_custom")) {
949964
switch (p_argument) {
950965
case 0: {

0 commit comments

Comments
 (0)