From 269123d8d80622ea880a0fc4476004055a61b919 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Fri, 26 Jul 2024 09:40:15 -0600 Subject: [PATCH 1/2] remove meta --- .../src/autocomplete/autocomplete.test.ts | 7 ---- .../src/definitions/commands.ts | 13 ------ .../esql_validation_meta_tests.json | 40 ------------------- .../src/validation/validation.test.ts | 37 ----------------- .../kbn-monaco/src/esql/lib/esql_theme.ts | 5 +-- 5 files changed, 1 insertion(+), 101 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 eceb0d87fe075..ccf929af065f9 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..e7eb8de6238f9 100644 --- a/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts +++ b/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts @@ -446,27 +446,6 @@ 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', [ @@ -1551,22 +1530,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..b733c1a59fd4d 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 ), @@ -90,9 +90,6 @@ export const buildESQlTheme = (): monaco.editor.IStandaloneThemeData => ({ true // isBold ), - // functions - ...buildRuleGroup(['functions'], euiThemeVars.euiColorPrimaryText), - // operators ...buildRuleGroup( [ From 61f664f14328de7230df75777fe53b5fb90c05c1 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Fri, 26 Jul 2024 09:45:25 -0600 Subject: [PATCH 2/2] Restore formatting for functions --- .../src/validation/validation.test.ts | 11 ----------- packages/kbn-monaco/src/esql/lib/esql_theme.ts | 3 +++ 2 files changed, 3 insertions(+), 11 deletions(-) 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 e7eb8de6238f9..daeff58923f5c 100644 --- a/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts +++ b/packages/kbn-esql-validation-autocomplete/src/validation/validation.test.ts @@ -448,17 +448,6 @@ describe('validation logic', () => { 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'", diff --git a/packages/kbn-monaco/src/esql/lib/esql_theme.ts b/packages/kbn-monaco/src/esql/lib/esql_theme.ts index b733c1a59fd4d..1e2028d672e1d 100644 --- a/packages/kbn-monaco/src/esql/lib/esql_theme.ts +++ b/packages/kbn-monaco/src/esql/lib/esql_theme.ts @@ -90,6 +90,9 @@ export const buildESQlTheme = (): monaco.editor.IStandaloneThemeData => ({ true // isBold ), + // functions + ...buildRuleGroup(['functions'], euiThemeVars.euiColorPrimaryText), + // operators ...buildRuleGroup( [