summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-05-04 08:20:03 +0200
committerGitHub <noreply@github.com>2021-05-04 08:20:03 +0200
commit302b6ef576221ab74a20cdf48c29bf2c724664ce (patch)
treedb1c10704f06bb329e7bb20bd979fe2d685c407d
parentf47c285f678345f5fde6937deb8bd740589beb83 (diff)
parent1f9524bf57febbd5ea3b54f4b88fd7d54541ca50 (diff)
Merge pull request #47798 from ray90514/bug#47620
Fix constants at function scope are not defined as constants for completion
-rw-r--r--modules/gdscript/gdscript_editor.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index f70020d165..099abd35a7 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -738,7 +738,12 @@ static void _list_available_types(bool p_inherit_only, GDScriptParser::Completio
static void _find_identifiers_in_suite(const GDScriptParser::SuiteNode *p_suite, Map<String, ScriptCodeCompletionOption> &r_result) {
for (int i = 0; i < p_suite->locals.size(); i++) {
- ScriptCodeCompletionOption option(p_suite->locals[i].name, ScriptCodeCompletionOption::KIND_VARIABLE);
+ ScriptCodeCompletionOption option;
+ if (p_suite->locals[i].type == GDScriptParser::SuiteNode::Local::CONSTANT) {
+ option = ScriptCodeCompletionOption(p_suite->locals[i].name, ScriptCodeCompletionOption::KIND_CONSTANT);
+ } else {
+ option = ScriptCodeCompletionOption(p_suite->locals[i].name, ScriptCodeCompletionOption::KIND_VARIABLE);
+ }
r_result.insert(option.display, option);
}
if (p_suite->parent_block) {