Improved go-to definition (Ctrl + Click)

Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
This commit is contained in:
janglee 2020-03-28 13:42:19 +05:30
parent 20edf69f96
commit be7a353c70
6 changed files with 64 additions and 3 deletions

View file

@ -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: {
}
}

View file

@ -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;
}