fix(v0.2.2): use real Theme instance for cursor colors, not EditorTheme#3
Merged
Conversation
The editor factory registered via ctx.ui.setEditorComponent receives an
EditorTheme ({ borderColor, selectList }) — NOT the full Theme instance.
v0.2.0 assumed that param had getFgAnsi/getColorMode and called
theme.getFgAnsi("accent") at render time, crashing pi on startup with
"theme.getFgAnsi is not a function" on the first render tick.
Resolve the live Theme from ctx.ui.theme (readonly getter on
ExtensionUIContext that always returns the current theme, so theme
switches are reflected) and pass it into CursorEditor via a new
deps.getTheme accessor. The EditorTheme factory arg is still forwarded
to super() for border/autocomplete styling.
Tests updated to supply getTheme; 122 pass, typecheck clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Pi crashed on startup with
theme.getFgAnsi is not a functionon the first render tick.The editor factory registered via
ctx.ui.setEditorComponentreceives anEditorTheme({ borderColor, selectList }) — not the fullThemeinstance. v0.2.0 assumed that param exposedgetFgAnsi/getColorModeand invokedtheme.getFgAnsi("accent")inresolveFocusedColor→transformFocused→composeRender→CursorEditor.render→TUI.doRendertimer. Boom.Fix
Resolve the live
Themefromctx.ui.theme(thereadonly themegetter onExtensionUIContextthat always returns the current theme, so theme switches are reflected) and pass it intoCursorEditorvia a newdeps.getThemeaccessor. TheEditorThemefactory arg is still forwarded tosuper()for border/autocomplete styling.lib/editor.ts: drop the boguscursorTheme = theme as Theme; readthis.deps.getTheme()inapplyCursorModeandrender.extensions/cursor.ts: passgetTheme: () => ctx.ui.theme.tests/editor.test.ts: supplygetThemein all harnesses.Verification
pnpm typecheck✅pnpm test:run✅ 122 pass, 0 fail~/.pi/agent/npm/node_modules/@getpipher/cursorpatched locally so pi starts now (before this releases).Release
Bumps to
0.2.2. Merge → tagv0.2.2→ CI publishes to npm under the getpipherNPM_TOKEN.