diff --git a/src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/completion/validate.test.ts b/src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/completion/validate.test.ts index fcc4f25dac4ae..65b5d28c1783d 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/completion/validate.test.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/completion/validate.test.ts @@ -169,13 +169,6 @@ describe('COMPLETION Validation', () => { }); describe('a custom targetField is provided', () => { - it('targetField is not available before COMPLETION', () => { - completionExpectErrors( - `FROM index | KEEP customField | COMPLETION customField = "prompt" WITH inferenceId`, - ['Unknown column [customField]'] - ); - }); - it('targetField is available after COMPLETION', () => { completionExpectErrors( `FROM index | COMPLETION keywordField = "prompt" WITH inferenceId | KEEP keywordField`, diff --git a/src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/completion/validate.ts b/src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/completion/validate.ts index 757edc72d8281..b1914866a2c5f 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/completion/validate.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/commands_registry/commands/completion/validate.ts @@ -43,8 +43,6 @@ export const validate = ( }); } - messages.push(...validateCommandArguments(command, ast, context, callbacks)); - const targetName = targetField?.name || 'completion'; // Sets the target field so the column is recognized after the command is applied @@ -56,5 +54,7 @@ export const validate = ( }, ]); + messages.push(...validateCommandArguments(command, ast, context, callbacks)); + return messages; };