diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-05-12 18:17:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-12 18:17:20 +0200 |
commit | 88d5c943e73cc2f16500c58fb53c71a38f7a0ceb (patch) | |
tree | 7d95efbb17b740e3c60f72dd1534279863c3986f /modules | |
parent | 86ce51ce1d48c52c5ab55b3882d8e9d211164f42 (diff) | |
parent | 837a66722506a578b9ea379b5ea425ed22344354 (diff) |
Merge pull request #8696 from bojidar-bg/fix-path-autocomplete
Fix gdscript autocomplete showing only paths
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gd_editor.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 22 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.h | 2 |
3 files changed, 16 insertions, 10 deletions
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 4667e541dd..5d404e2f7d 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -2395,7 +2395,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base } } break; - case GDParser::COMPLETION_PRELOAD: { + case GDParser::COMPLETION_RESOURCE_PATH: { if (EditorSettings::get_singleton()->get("text_editor/completion/complete_file_paths")) get_directory_contents(EditorFileSystem::get_singleton()->get_filesystem(), options); diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index b02d7f713b..4ae62eb1d0 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -387,15 +387,21 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool _set_error("Expected '(' after 'preload'"); return NULL; } - completion_cursor = StringName(); - completion_type = COMPLETION_PRELOAD; - completion_class = current_class; - completion_function = current_function; - completion_line = tokenizer->get_token_line(); - completion_block = current_block; - completion_found = true; tokenizer->advance(); + if (tokenizer->get_token() == GDTokenizer::TK_CURSOR) { + completion_cursor = StringName(); + completion_node = p_parent; + completion_type = COMPLETION_RESOURCE_PATH; + completion_class = current_class; + completion_function = current_function; + completion_line = tokenizer->get_token_line(); + completion_block = current_block; + completion_argument = 0; + completion_found = true; + tokenizer->advance(); + } + String path; bool found_constant = false; bool valid = false; @@ -467,10 +473,10 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool _set_error("Expected ')' after 'preload' path"); return NULL; } + tokenizer->advance(); ConstantNode *constant = alloc_node<ConstantNode>(); constant->value = res; - tokenizer->advance(); expr = constant; } else if (tokenizer->get_token() == GDTokenizer::TK_PR_YIELD) { diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 4f3ca0dc5f..7e7e19de1b 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -437,7 +437,7 @@ public: COMPLETION_PARENT_FUNCTION, COMPLETION_METHOD, COMPLETION_CALL_ARGUMENTS, - COMPLETION_PRELOAD, + COMPLETION_RESOURCE_PATH, COMPLETION_INDEX, COMPLETION_VIRTUAL_FUNC, COMPLETION_YIELD, |