From ed7ed52151a9eca2a60a418881bd7065529acb66 Mon Sep 17 00:00:00 2001 From: Geequlim Date: Thu, 13 Jun 2019 17:17:20 +0800 Subject: [PATCH] Parse more informations for code completion --- core/script_language.h | 30 ++- editor/code_editor.cpp | 15 +- editor/code_editor.h | 4 +- editor/plugins/script_text_editor.cpp | 4 +- editor/plugins/script_text_editor.h | 6 +- .../pluginscript/pluginscript_language.cpp | 5 +- .../pluginscript/pluginscript_language.h | 2 +- modules/gdscript/gdscript.h | 2 +- modules/gdscript/gdscript_editor.cpp | 219 ++++++++++++------ 9 files changed, 194 insertions(+), 93 deletions(-) diff --git a/core/script_language.h b/core/script_language.h index b0c60b4e904..cb103646ed1 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -200,6 +200,34 @@ public: virtual ~ScriptInstance(); }; +struct ScriptCodeCompletionOption { + enum Kind { + KIND_CLASS, + KIND_FUNCTION, + KIND_SIGNAL, + KIND_VARIABLE, + KIND_MEMBER, + KIND_ENUM, + KIND_CONSTANT, + KIND_NODE_PATH, + KIND_FILE_PATH, + KIND_PLAIN_TEXT, + }; + Kind kind; + String display; + String insert_text; + + ScriptCodeCompletionOption() { + kind = KIND_PLAIN_TEXT; + } + + ScriptCodeCompletionOption(const String &p_text, Kind p_kind) { + display = p_text; + insert_text = p_text; + kind = p_kind; + } +}; + class ScriptCodeCompletionCache { static ScriptCodeCompletionCache *singleton; @@ -250,7 +278,7 @@ public: virtual Error open_in_external_editor(const Ref