From 2d3841bf617e64addb080d1bc617f9cbdb0d50ee Mon Sep 17 00:00:00 2001 From: Frank Noirot Date: Tue, 12 Nov 2024 20:01:47 -0500 Subject: [PATCH] Bug fix: fix autocompletion regression (#4476) * Add final error-less expectation to autocomplete test * Fix failing test * tweak to leave function in place --------- Co-authored-by: Kurt Hutten Irev-Dev --- e2e/playwright/editor-tests.spec.ts | 3 +++ src/editor/manager.ts | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/e2e/playwright/editor-tests.spec.ts b/e2e/playwright/editor-tests.spec.ts index 05beac687..5713e74aa 100644 --- a/e2e/playwright/editor-tests.spec.ts +++ b/e2e/playwright/editor-tests.spec.ts @@ -694,6 +694,9 @@ test.describe('Editor tests', () => { .toHaveText(`sketch001 = startSketchOn('XZ') |> startProfileAt([3.14, 12], %) |> xLine(5, %) // lin`) + + // expect there to be no KCL errors + await expect(page.locator('.cm-lint-marker-error')).toHaveCount(0) }) test('with tab to accept the completion', async ({ page }) => { diff --git a/src/editor/manager.ts b/src/editor/manager.ts index 6bedf03d2..d0f6e02bd 100644 --- a/src/editor/manager.ts +++ b/src/editor/manager.ts @@ -72,9 +72,10 @@ export default class EditorManager { // we cannot use <>.constructor.name since it will get destroyed // when packaging the application. const isTreeHighlightPlugin = - e.value.hasOwnProperty('tree') && - e.value.hasOwnProperty('decoratedTo') && - e.value.hasOwnProperty('decorations') + e?.value && + e.value?.hasOwnProperty('tree') && + e.value?.hasOwnProperty('decoratedTo') && + e.value?.hasOwnProperty('decorations') if (isTreeHighlightPlugin) { let originalUpdate = e.value.update