Fix empty line hover; fix open non-res:// script

(cherry picked from commit 572979d011)
This commit is contained in:
Francois Belair 2021-10-01 11:26:26 -04:00 committed by Rémi Verschelde
parent 003c282e10
commit 6be31e559d
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 9 additions and 3 deletions

View file

@ -446,7 +446,7 @@ String ExtendGDScriptParser::get_text_for_completion(const lsp::Position &p_curs
return longthing;
}
String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_cursor, const String &p_symbol, bool p_func_requred) const {
String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_cursor, const String &p_symbol, bool p_func_required) const {
String longthing;
int len = lines.size();
for (int i = 0; i < len; i++) {
@ -468,7 +468,7 @@ String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_c
longthing += first_part;
longthing += String::chr(0xFFFF); //not unicode, represents the cursor
if (p_func_requred) {
if (p_func_required) {
longthing += "("; // tell the parser this is a function call
}
longthing += last_part;
@ -487,6 +487,9 @@ String ExtendGDScriptParser::get_text_for_lookup_symbol(const lsp::Position &p_c
String ExtendGDScriptParser::get_identifier_under_position(const lsp::Position &p_position, Vector2i &p_offset) const {
ERR_FAIL_INDEX_V(p_position.line, lines.size(), "");
String line = lines[p_position.line];
if (line.empty()) {
return "";
}
ERR_FAIL_INDEX_V(p_position.character, line.size(), "");
int start_pos = p_position.character;