Fixed error due to bad cursor handling when parsing shader code

Fixed completion error log thrown on "no auto-completion found" for typings with no completion.

(cherry picked from commit 7a74d310aa)
This commit is contained in:
Overblob 2018-07-14 19:59:11 +02:00 committed by Rémi Verschelde
parent 33a93311ec
commit 854fc3cb97
1 changed files with 5 additions and 3 deletions

View File

@ -2550,7 +2550,9 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
TkPos pos = _get_tkpos(); TkPos pos = _get_tkpos();
tk = _get_token(); tk = _get_token();
if (tk.type == TK_PERIOD) { if (tk.type == TK_CURSOR) {
//do nothing
} else if (tk.type == TK_PERIOD) {
StringName identifier; StringName identifier;
if (_get_completable_identifier(p_block, COMPLETION_INDEX, identifier)) { if (_get_completable_identifier(p_block, COMPLETION_INDEX, identifier)) {
@ -4140,8 +4142,8 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct
switch (completion_type) { switch (completion_type) {
case COMPLETION_NONE: { case COMPLETION_NONE: {
//do none //do nothing
return ERR_PARSE_ERROR; return OK;
} break; } break;
case COMPLETION_RENDER_MODE: { case COMPLETION_RENDER_MODE: {
for (const Set<String>::Element *E = p_render_modes.front(); E; E = E->next()) { for (const Set<String>::Element *E = p_render_modes.front(); E; E = E->next()) {