From 1ebdc33403b5b7eb9132eeb1789b4592fa42cf07 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 4 Feb 2025 02:35:53 +1100 Subject: [PATCH] [8.17] [Vega] Fix highlight for HJSON (#208858) (#209289) # Backport This will backport the following commits from `main` to `8.17`: - [[Vega] Fix highlight for HJSON (#208858)](https://github.com/elastic/kibana/pull/208858) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Marco Vettorello --- packages/shared-ux/code_editor/impl/package.json | 6 ++++-- test/functional/apps/visualize/group6/_vega_chart.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/shared-ux/code_editor/impl/package.json b/packages/shared-ux/code_editor/impl/package.json index e831aa7ace817..e2def46267623 100644 --- a/packages/shared-ux/code_editor/impl/package.json +++ b/packages/shared-ux/code_editor/impl/package.json @@ -3,5 +3,7 @@ "private": true, "version": "1.0.0", "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0", - "sideEffects": false -} + "sideEffects": [ + "./register_languages.ts" + ] +} \ No newline at end of file diff --git a/test/functional/apps/visualize/group6/_vega_chart.ts b/test/functional/apps/visualize/group6/_vega_chart.ts index e833bf233ca9f..1bfc7ab267b68 100644 --- a/test/functional/apps/visualize/group6/_vega_chart.ts +++ b/test/functional/apps/visualize/group6/_vega_chart.ts @@ -53,6 +53,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); describe('vega chart', () => { + it('code-editor correct syntax highlight langs', async () => { + const hasRequiredLanguages = await browser.execute(() => { + const langs: Array<{ id: string }> = + // @ts-ignore + window.MonacoEnvironment?.monaco?.languages?.getLanguages() ?? []; + return langs.some((l) => l?.id === 'hjson') && langs.some((l) => l?.id === 'xjson'); + }); + expect(hasRequiredLanguages).to.be(true); + }); + describe('initial render', () => { it('should have some initial vega spec text', async function () { const vegaSpec = await vegaChart.getSpec();