summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-08 03:01:52 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-08 03:01:52 -0300
commit8963ca3d17ff6e1340cb5c2eb88a6485ec422a64 (patch)
tree9154c469e1f0a33dc34ae0f4ed49b36b49cfdbf9 /modules
parent8b912d11152410302f45eaa117c19b7016d781f5 (diff)
Fix code completion for new getnode syntax
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gd_editor.cpp21
-rw-r--r--modules/gdscript/gd_parser.cpp14
2 files changed, 31 insertions, 4 deletions
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index fbd81a61bf..ebb753d129 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -2155,6 +2155,27 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
case GDParser::COMPLETION_PARENT_FUNCTION: {
} break;
+ case GDParser::COMPLETION_GET_NODE: {
+
+ if (p_owner) {
+ List<String> opts;
+ p_owner->get_argument_options("get_node",0,&opts);
+
+ for (List<String>::Element *E=opts.front();E;E=E->next()) {
+
+ String opt = E->get().strip_edges();
+ if (opt.begins_with("\"") && opt.ends_with("\"")) {
+ String idopt=opt.substr(1,opt.length()-2);
+ if (idopt.replace("/","_").is_valid_identifier()) {
+ options.insert(idopt);
+ } else {
+ options.insert(opt);
+ }
+ }
+ }
+
+ }
+ } break;
case GDParser::COMPLETION_METHOD:
isfunction=true;
case GDParser::COMPLETION_INDEX: {
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 029e227cdd..ede6e63806 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -290,8 +290,10 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
} break;
case GDTokenizer::TK_CONSTANT: {
- if (!need_identifier)
+ if (!need_identifier) {
+ done=true;
break;
+ }
if (tokenizer->get_token_constant().get_type()!=Variant::STRING) {
_set_error("Expected string constant or identifier after '$' or '/'.");
@@ -300,12 +302,14 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
path+=String(tokenizer->get_token_constant());
tokenizer->advance();
+ need_identifier=false;
} break;
case GDTokenizer::TK_IDENTIFIER: {
-
- if (!need_identifier)
+ if (!need_identifier) {
+ done=true;
break;
+ }
path+=String(tokenizer->get_token_identifier());
tokenizer->advance();
@@ -314,8 +318,10 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
} break;
case GDTokenizer::TK_OP_DIV: {
- if (need_identifier)
+ if (need_identifier) {
+ done=true;
break;
+ }
path+="/";
tokenizer->advance();