summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gdscript/gd_editor.cpp21
-rw-r--r--modules/gdscript/gd_parser.cpp14
-rw-r--r--scene/gui/text_edit.cpp9
-rw-r--r--tools/editor/code_editor.cpp1
4 files changed, 37 insertions, 8 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();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 4ea44a6ead..c2f6442076 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4230,7 +4230,6 @@ void TextEdit::_update_completion_candidates() {
String l = text[cursor.line];
int cofs = CLAMP(cursor.column,0,l.length());
-
String s;
//look for keywords first
@@ -4279,14 +4278,14 @@ void TextEdit::_update_completion_candidates() {
while(cofs>0 && l[cofs-1]>32 && _is_completable(l[cofs-1])) {
s=String::chr(l[cofs-1])+s;
- if (l[cofs-1]=='\'' || l[cofs-1]=='"')
+ if (l[cofs-1]=='\'' || l[cofs-1]=='"' || l[cofs-1]=='$')
break;
cofs--;
}
}
- if (cursor.column > 0 && l[cursor.column - 1] == '(' && !pre_keyword && !completion_strings[0].begins_with("\"")) {
+ if (cursor.column > 0 && l[cursor.column - 1] == '(' && !pre_keyword && !completion_strings[0].begins_with("\"")) {
cancel = true;
}
@@ -4308,8 +4307,9 @@ void TextEdit::_update_completion_candidates() {
_cancel_completion();
return;
}
+
if (s.is_subsequence_ofi(completion_strings[i])) {
- // don't remove duplicates if no input is provided
+ // don't remove duplicates if no input is provided
if (s != "" && completion_options.find(completion_strings[i]) != -1) {
continue;
}
@@ -4345,6 +4345,7 @@ void TextEdit::_update_completion_candidates() {
if (completion_options.size()==0) {
//no options to complete, cancel
_cancel_completion();
+
return;
}
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index 284d589ba7..9c7626d79e 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -1305,6 +1305,7 @@ CodeTextEditor::CodeTextEditor() {
cs.push_back(".");
cs.push_back(",");
cs.push_back("(");
+ cs.push_back("$");
text_editor->set_completion(true,cs);
idle->connect("timeout", this,"_text_changed_idle_timeout");