From 49fb36c69c780e947bf95d67b0e012a2fcde63e3 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Mon, 29 Jul 2024 10:31:34 -0600 Subject: [PATCH] [ES|QL] remove meta (#189302) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary close https://github.com/elastic/kibana/issues/188481 `META` is still in the grammar so you won't get a syntax error, but no highlighting, validation, or autocomplete support. Screenshot 2024-07-26 at 9 46 09 AM --------- Co-authored-by: Elastic Machine --- .../src/autocomplete/autocomplete.test.ts | 7 --- .../src/definitions/commands.ts | 13 ----- .../esql_validation_meta_tests.json | 40 ---------------- .../src/validation/validation.test.ts | 48 ------------------- .../kbn-monaco/src/esql/lib/esql_theme.ts | 2 +- 5 files changed, 1 insertion(+), 109 deletions(-) diff --git a/packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.test.ts b/packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.test.ts index a19adb2674d6f..d4ad5157d979a 100644 --- a/packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.test.ts +++ b/packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.test.ts @@ -145,13 +145,6 @@ describe('autocomplete', () => { } }); - describe('meta', () => { - testSuggestions('meta ', ['FUNCTIONS']); - for (const fn of ['functions']) { - testSuggestions(`meta ${fn} `, ['|']); - } - }); - describe('where', () => { const allEvalFns = getFunctionSignaturesByReturnType('where', 'any', { scalar: true, diff --git a/packages/kbn-esql-validation-autocomplete/src/definitions/commands.ts b/packages/kbn-esql-validation-autocomplete/src/definitions/commands.ts index 9bbc8a5b903d2..033518ac16c37 100644 --- a/packages/kbn-esql-validation-autocomplete/src/definitions/commands.ts +++ b/packages/kbn-esql-validation-autocomplete/src/definitions/commands.ts @@ -62,19 +62,6 @@ export const commandDefinitions: CommandDefinition[] = [ params: [{ name: 'index', type: 'source', wildcards: true }], }, }, - { - name: 'meta', - description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.metaDoc', { - defaultMessage: 'Returns information about the ES|QL environment', - }), - examples: ['meta functions'], - options: [], - modes: [], - signature: { - multipleParams: false, - params: [{ name: 'functions', type: 'function' }], - }, - }, { name: 'show', description: i18n.translate('kbn-esql-validation-autocomplete.esql.definitions.showDoc', { diff --git a/packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json b/packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json index 0e30da959f82e..d230f9e2facc9 100644 --- a/packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json +++ b/packages/kbn-esql-validation-autocomplete/src/validation/esql_validation_meta_tests.json @@ -2092,46 +2092,6 @@ ], "warning": [] }, - { - "query": "meta", - "error": [ - "SyntaxError: missing 'functions' at ''" - ], - "warning": [] - }, - { - "query": "meta functions", - "error": [], - "warning": [] - }, - { - "query": "meta functions()", - "error": [ - "SyntaxError: token recognition error at: '('", - "SyntaxError: token recognition error at: ')'" - ], - "warning": [] - }, - { - "query": "meta functions blah", - "error": [ - "SyntaxError: token recognition error at: 'b'", - "SyntaxError: token recognition error at: 'l'", - "SyntaxError: token recognition error at: 'a'", - "SyntaxError: token recognition error at: 'h'" - ], - "warning": [] - }, - { - "query": "meta info", - "error": [ - "SyntaxError: token recognition error at: 'i'", - "SyntaxError: token recognition error at: 'n'", - "SyntaxError: token recognition error at: 'fo'", - "SyntaxError: missing 'functions' at ''" - ], - "warning": [] - }, { "query": "show", "error": [ diff --git a/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts b/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts index 73e66a5388939..daeff58923f5c 100644 --- a/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts +++ b/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts @@ -446,40 +446,8 @@ describe('validation logic', () => { }); }); - describe('meta', () => { - testErrorsAndWarnings('meta', ["SyntaxError: missing 'functions' at ''"]); - testErrorsAndWarnings('meta functions', []); - testErrorsAndWarnings('meta functions()', [ - "SyntaxError: token recognition error at: '('", - "SyntaxError: token recognition error at: ')'", - ]); - testErrorsAndWarnings('meta functions blah', [ - "SyntaxError: token recognition error at: 'b'", - "SyntaxError: token recognition error at: 'l'", - "SyntaxError: token recognition error at: 'a'", - "SyntaxError: token recognition error at: 'h'", - ]); - testErrorsAndWarnings('meta info', [ - "SyntaxError: token recognition error at: 'i'", - "SyntaxError: token recognition error at: 'n'", - "SyntaxError: token recognition error at: 'fo'", - "SyntaxError: missing 'functions' at ''", - ]); - }); - describe('show', () => { testErrorsAndWarnings('show', ["SyntaxError: missing 'info' at ''"]); - testErrorsAndWarnings('show functions', [ - "SyntaxError: token recognition error at: 'f'", - "SyntaxError: token recognition error at: 'u'", - "SyntaxError: token recognition error at: 'n'", - "SyntaxError: token recognition error at: 'c'", - "SyntaxError: token recognition error at: 't'", - "SyntaxError: token recognition error at: 'io'", - "SyntaxError: token recognition error at: 'n'", - "SyntaxError: token recognition error at: 's'", - "SyntaxError: missing 'info' at ''", - ]); testErrorsAndWarnings('show info', []); testErrorsAndWarnings('show numberField', [ "SyntaxError: token recognition error at: 'n'", @@ -1551,22 +1519,6 @@ describe('validation logic', () => { }); }); - it('should call fields callbacks also for meta command', async () => { - const callbackMocks = getCallbackMocks(); - await validateQuery( - `meta functions | keep name`, - getAstAndSyntaxErrors, - undefined, - callbackMocks - ); - expect(callbackMocks.getSources).not.toHaveBeenCalled(); - expect(callbackMocks.getPolicies).not.toHaveBeenCalled(); - expect(callbackMocks.getFieldsFor).toHaveBeenCalledTimes(1); - expect(callbackMocks.getFieldsFor).toHaveBeenLastCalledWith({ - query: 'meta functions', - }); - }); - it('should call fields callbacks also for show command', async () => { const callbackMocks = getCallbackMocks(); await validateQuery( diff --git a/packages/kbn-monaco/src/esql/lib/esql_theme.ts b/packages/kbn-monaco/src/esql/lib/esql_theme.ts index 511fcbf9114f4..1e2028d672e1d 100644 --- a/packages/kbn-monaco/src/esql/lib/esql_theme.ts +++ b/packages/kbn-monaco/src/esql/lib/esql_theme.ts @@ -48,7 +48,7 @@ export const buildESQlTheme = (): monaco.editor.IStandaloneThemeData => ({ // source commands ...buildRuleGroup( - ['from', 'row', 'show', 'meta'], + ['from', 'row', 'show'], euiThemeVars.euiColorPrimaryText, true // isBold ),