From 356aef6e3207b32328b4c35c0e22220313591d2d Mon Sep 17 00:00:00 2001 From: Nick Peihl Date: Mon, 28 Nov 2022 14:30:37 -0500 Subject: [PATCH] [PresentationUtil] Fix Canvas expression autocomplete (#146425) Fixes #146243 ## Summary Fixes Canvas expression autocomplete https://github.com/elastic/kibana/pull/143739 upgraded the monaco-editor dependency which uses a callback to the `onLanguage` method to initialize the expressions. The PR moved the `monaco.languages.register` command inside this callback and which was never triggered. Moving the `monaco.languages.register` command outside the callback appears to fix the issue. (cherry picked from commit 19413b7daae983b95dbb9f5c7b39cb8f3578ebfa) --- .../public/components/expression_input/language.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/presentation_util/public/components/expression_input/language.ts b/src/plugins/presentation_util/public/components/expression_input/language.ts index 8f50ae97fa83d..2246e9bb271ce 100644 --- a/src/plugins/presentation_util/public/components/expression_input/language.ts +++ b/src/plugins/presentation_util/public/components/expression_input/language.ts @@ -116,7 +116,7 @@ export function registerExpressionsLanguage(functions: ExpressionFunction[]) { expressionsLanguage.keywords = functions.map((fn) => fn.name); expressionsLanguage.deprecated = functions.filter((fn) => fn.deprecated).map((fn) => fn.name); monaco.languages.onLanguage(EXPRESSIONS_LANGUAGE_ID, () => { - monaco.languages.register({ id: EXPRESSIONS_LANGUAGE_ID }); monaco.languages.setMonarchTokensProvider(EXPRESSIONS_LANGUAGE_ID, expressionsLanguage); }); + monaco.languages.register({ id: EXPRESSIONS_LANGUAGE_ID }); }