fix(editor): cache rainbow bracket tokenization and improve the rainbow bracket related issues happens when editing#2012
Conversation
…ow bracket related issues happens when editing
Greptile SummaryThis PR rewrites the rainbow brackets plugin to use a block-based LRU cache (2048-char blocks, 192-entry max) that avoids re-tokenizing unchanged text on every keystroke, and makes rainbow bracket colors theme-aware by deriving them from the active theme config. A new All remaining findings are P2 style suggestions: a redundant Confidence Score: 5/5Safe to merge — all findings are non-blocking P2 style suggestions with no correctness or data-integrity issues The block cache logic is correct, LRU eviction via Map insertion order is well-implemented, theme color derivation is sound, and the editorTheme listener properly re-applies colors on theme change. No P0/P1 issues were found. src/cm/rainbowBrackets.ts deserves a future pass to consider restoring RAF debouncing for large-paste scenarios, but this is not a blocker Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant S as appSettings
participant EM as editorManager
participant F as makeRainbowBracketExtension
participant RB as rainbowBrackets()
participant RC as rainbowCompartment
U->>S: change editorTheme
S->>EM: emit update:editorTheme
EM->>EM: editor.setTheme(newThemeId)
Note over EM: themeCompartment reconfigured
EM->>F: applyOptions(["rainbowBrackets"])
F->>F: getThemeConfig(themeId)
F->>RB: getRainbowBracketColors(config)
RB-->>F: theme-appropriate colors[]
F->>RB: rainbowBrackets({ colors })
RB-->>RC: [ViewPlugin, baseTheme]
RC->>EM: reconfigure compartment with new colors
Reviews (1): Last reviewed commit: "fix(editor): cache rainbow bracket token..." | Re-trigger Greptile |
No description provided.