summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorjanglee <merupatel123@gmail.com>2020-03-28 13:42:19 +0530
committerjanglee <merupatel123@gmail.com>2020-05-05 10:46:12 +0530
commitbe7a353c70812e349861a7f5314d72425ae707cb (patch)
tree6875b6e7d2172b48b0eab242ffd1b94374c8f804 /modules/gdscript
parent20edf69f96160fcf7c0ea2449f4daf50f572ce99 (diff)
Improved go-to definition (Ctrl + Click)
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_editor.cpp12
-rw-r--r--modules/gdscript/gdscript_parser.cpp12
2 files changed, 23 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 98e09159ec..c9c4782d35 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -1425,6 +1425,7 @@ static bool _guess_identifier_type_from_base(GDScriptCompletionContext &p_contex
// Variable used in the same expression
return false;
}
+
if (_guess_expression_type(p_context, m.expression, r_type)) {
return true;
}
@@ -3485,6 +3486,17 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
return OK;
}
} break;
+ case GDScriptParser::COMPLETION_TYPE_HINT: {
+
+ GDScriptParser::DataType base_type = context._class->base_type;
+ base_type.has_type = true;
+ base_type.kind = GDScriptParser::DataType::CLASS;
+ base_type.class_type = const_cast<GDScriptParser::ClassNode *>(context._class);
+
+ if (_lookup_symbol_from_base(base_type, p_symbol, false, r_result) == OK) {
+ return OK;
+ }
+ } break;
default: {
}
}
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 7fcb2cc423..69eee1ea32 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -8497,7 +8497,13 @@ Error GDScriptParser::_parse(const String &p_base_path) {
_set_error("Parse error: " + tokenizer->get_token_error());
}
- if (error_set && !for_completion) {
+ bool for_completion_error_set = false;
+ if (error_set && for_completion) {
+ for_completion_error_set = true;
+ error_set = false;
+ }
+
+ if (error_set) {
return ERR_PARSE_ERROR;
}
@@ -8527,6 +8533,10 @@ Error GDScriptParser::_parse(const String &p_base_path) {
// Resolve the function blocks
_check_class_blocks_types(main_class);
+ if (for_completion_error_set) {
+ error_set = true;
+ }
+
if (error_set) {
return ERR_PARSE_ERROR;
}