diff --git a/actions-languageservice/src/utils/find-token.ts b/actions-languageservice/src/utils/find-token.ts index 3ca06cc..4a7c8bf 100644 --- a/actions-languageservice/src/utils/find-token.ts +++ b/actions-languageservice/src/utils/find-token.ts @@ -54,9 +54,8 @@ export function findToken(pos: Position, root?: TemplateToken): TokenResult { for (let i = 0; i < mappingToken.count; i++) { const {key, value} = mappingToken.get(i); - const sameLine = onSameLine(pos, key, value); - if (posInToken(pos, key)) { - if (sameLine && key.range!.end[1] + 1 === value.range!.start[1]) { + if (onSameLine(pos, key, value)) { + if (posInToken(pos, key) && key.range!.end[1] + 1 === value.range!.start[1]) { // There's no space between the key and value, there's nothing valid to complete here return { token: null, @@ -65,20 +64,14 @@ export function findToken(pos: Position, root?: TemplateToken): TokenResult { }; } - return { - token: key, - keyToken: null, - parent: mappingToken - }; - } - - // Empty nodes positions won't always match the cursor, so check if we're on the same line - if (sameLine && emptyNode(value)) { - return { - token: value, - keyToken: null, - parent: key - }; + // Empty nodes positions won't always match the cursor, so check if we're on the same line + if (emptyNode(value)) { + return { + token: value, + keyToken: null, + parent: key + }; + } } s.push({