diff options
author | ray90514 <ray90514@hotmail.com> | 2021-04-11 22:30:16 +0800 |
---|---|---|
committer | ray90514 <ray90514@hotmail.com> | 2021-04-11 22:41:04 +0800 |
commit | 1f9524bf57febbd5ea3b54f4b88fd7d54541ca50 (patch) | |
tree | fa31c14f92d065096c7545c78d625ed2b4adff33 /modules | |
parent | 35066f39ff111ee0e9d4aba534bb08fc2d686156 (diff) |
Fix Constants at function scope are not defined as constants for autocompletion
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index ae3b16a9d7..136c9f2afb 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) { |