diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-10-01 21:25:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-01 21:25:54 +0200 |
commit | 53051246657c38f02ade022b810e251919b15122 (patch) | |
tree | 4372802d257ada09dd472c742d292afde8a5b50b /modules/gdscript/language_server/gdscript_extend_parser.cpp | |
parent | 871910feaff2c692695a4c01115fc4c653ed41c9 (diff) | |
parent | 572979d0110ac9086bef721e5bcc0bc891b90cf1 (diff) | |
download | redot-engine-53051246657c38f02ade022b810e251919b15122.tar.gz |
Merge pull request #53308 from Razoric480/fix-lsp-issues
Diffstat (limited to 'modules/gdscript/language_server/gdscript_extend_parser.cpp')
-rw-r--r-- | modules/gdscript/language_server/gdscript_extend_parser.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp index d106b3b541..730e554476 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.cpp +++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp @@ -491,7 +491,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++) { @@ -513,7 +513,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; @@ -532,6 +532,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.is_empty()) { + return ""; + } ERR_FAIL_INDEX_V(p_position.character, line.size(), ""); int start_pos = p_position.character; |