From 9c424d9a5137d1e22c97412b164fd3ea8aeb25e6 Mon Sep 17 00:00:00 2001 From: kotaindah55 Date: Fri, 18 Apr 2025 15:36:49 +0200 Subject: [PATCH] refactor: token index cache no longer needed --- src/editor-mode/decorator/builder.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/editor-mode/decorator/builder.ts b/src/editor-mode/decorator/builder.ts index f6610a8..9b8c6a7 100644 --- a/src/editor-mode/decorator/builder.ts +++ b/src/editor-mode/decorator/builder.ts @@ -11,7 +11,7 @@ import { ActivityRecord } from "src/editor-mode/cm-extensions"; import { LineBreak, HiddenWidget, ColorButton } from "src/editor-mode/decorator/widgets"; import { REVEALED_SPOILER_DECO } from "src/editor-mode/decorator/decorations"; import { getTagRange, iterTokenGroup, provideTokenPartsRanges } from "src/editor-mode/utils/token-utils" -import { TextCursor } from "../utils/doc-utils"; +import { TextCursor } from "src/editor-mode/utils/doc-utils"; interface RangeSetUpdate { add?: readonly Range[]; @@ -200,10 +200,6 @@ export class DecorationBuilder { private readonly _lineBreakReplacer: _LineBreakReplacer; private readonly _selectionObserver: SelectionObserver; private readonly _settings: PluginSettings; - private readonly _indexCaches = { - inlineToken: { number: 0 }, // 0-based - blockToken: { number: 0 } // 0-based - } public readonly holder: _DecorationHolder; @@ -322,7 +318,6 @@ export class DecorationBuilder { iterTokenGroup({ tokens: this._parser.inlineTokens, ranges: visibleRanges, - indexCache: this._indexCaches.inlineToken, callback: token => { if (token.status != TokenStatus.ACTIVE) return; if (token.type == Format.HIGHLIGHT) hlTokens.push(token); @@ -354,7 +349,6 @@ export class DecorationBuilder { iterTokenGroup({ tokens: this._parser.blockTokens, ranges: visibleRanges, - indexCache: this._indexCaches.blockToken, callback: token => { if (token.status != TokenStatus.ACTIVE) return;