From 6991d6433fcaa68a76e45d254015c53c1d9de3d3 Mon Sep 17 00:00:00 2001 From: rivea0 <58330360+rivea0@users.noreply.github.com> Date: Wed, 2 Jul 2025 17:28:28 +0300 Subject: [PATCH] fix: clear decorations only when they are present, otherwise show Notice --- src/main.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index ca7a53b..437f87a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -51,7 +51,11 @@ export default class MatchSyntaxPlugin extends Plugin { const cm6Editor: EditorView = editor.cm; const plugin = cm6Editor.plugin(highlightViewPlugin); if (plugin) { - plugin.clearDeco(); + if (plugin.decorations === Decoration.none) { + new Notice('No decorations found!'); + } else { + plugin.clearDeco(); + } } } }); @@ -106,7 +110,6 @@ class HighlighterPlugin implements PluginValue { constructor(view: EditorView) { this.decorations = Decoration.none; } - makeDeco(ranges: IRange[]) { const deco = []; const highlightDeco = Decoration.mark({