Skip to content

feat(settings): add configurable chat font size (#157)#276

Open
proyectoauraorg wants to merge 4 commits into
Zoo-Code-Org:mainfrom
proyectoauraorg:feat/157-configurable-chat-font-size
Open

feat(settings): add configurable chat font size (#157)#276
proyectoauraorg wants to merge 4 commits into
Zoo-Code-Org:mainfrom
proyectoauraorg:feat/157-configurable-chat-font-size

Conversation

@proyectoauraorg
Copy link
Copy Markdown
Contributor

@proyectoauraorg proyectoauraorg commented May 24, 2026

Summary

The Zoo Code chat font was small on laptops/small screens and could only be enlarged by zooming the entire VS Code UI (which also scales the editor). This adds an independent, configurable chat font size.

Change

  • New optional chatFontSize setting (integer px, bounds 8–32, nullish) in global settings, threaded through ClineProvider state.
  • CSS variable --zoo-chat-font-size defaults to --vscode-font-size; the webview text scale (--text-xs/sm/base/lg) and body font-size derive from it. Appearance is unchanged when unset.
  • A useEffect applies the override to the document root when set and removes it on reset.
  • Surfaced in Settings → UI as a slider + value readout + Use VS Code default reset, following the allowedMaxRequests nullish/reset pattern.

Tests & i18n

  • UISettings.spec.tsx: init default display, configured value, user-edit persistence, reset enable/clear.
  • ExtensionStateContext.spec.tsx: CSS var not set on init (unset), set on edit, cleared on reset.
  • i18n strings added for all 18 locales (find-missing-translations passes).

Closes #157

Summary by CodeRabbit

  • New Features

    • Users can customize chat font size (8–32 px) and reset to VS Code default.
  • Style

    • Added a CSS variable to apply the customizable chat font size across the UI.
  • Localization

    • Added translations for the new setting in 19 languages.
  • Tests

    • Added unit and integration tests covering the chat font size UI, persistence, telemetry, and reset behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e746833-69d7-4903-ad6c-a1515c7db80e

📥 Commits

Reviewing files that changed from the base of the PR and between 03a1df2 and e94e260.

📒 Files selected for processing (29)
  • packages/types/src/global-settings.ts
  • packages/types/src/vscode-extension-host.ts
  • src/core/webview/ClineProvider.ts
  • webview-ui/src/components/common/MarkdownBlock.tsx
  • webview-ui/src/components/settings/SettingsView.tsx
  • webview-ui/src/components/settings/UISettings.tsx
  • webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
  • webview-ui/src/components/settings/__tests__/UISettings.spec.tsx
  • webview-ui/src/context/ExtensionStateContext.tsx
  • webview-ui/src/context/__tests__/ExtensionStateContext.spec.tsx
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/hi/settings.json
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/nl/settings.json
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • webview-ui/src/i18n/locales/ru/settings.json
  • webview-ui/src/i18n/locales/tr/settings.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json
  • webview-ui/src/index.css
✅ Files skipped from review due to trivial changes (10)
  • webview-ui/src/components/common/MarkdownBlock.tsx
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/ru/settings.json
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
🚧 Files skipped from review as they are similar to previous changes (18)
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • webview-ui/src/i18n/locales/hi/settings.json
  • webview-ui/src/context/tests/ExtensionStateContext.spec.tsx
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/components/settings/tests/UISettings.spec.tsx
  • packages/types/src/vscode-extension-host.ts
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/components/settings/SettingsView.tsx
  • webview-ui/src/i18n/locales/nl/settings.json
  • webview-ui/src/index.css
  • src/core/webview/ClineProvider.ts
  • webview-ui/src/components/settings/tests/SettingsView.spec.tsx
  • webview-ui/src/context/ExtensionStateContext.tsx
  • webview-ui/src/components/settings/UISettings.tsx
  • webview-ui/src/i18n/locales/tr/settings.json

📝 Walkthrough

Walkthrough

Adds a nullable chatFontSize (8–32 px) setting: schema and ExtensionState contract, provider wiring to include the value in webview state, settings UI slider + reset, context-driven CSS variable sync, Markdown font usage update, tests, and translations across locales.

Changes

Chat Font Size Setting Feature

Layer / File(s) Summary
Type schema and state contracts
packages/types/src/global-settings.ts, packages/types/src/vscode-extension-host.ts
chatFontSize field (integer 8–32, nullable) added to globalSettingsSchema and included in ExtensionState's picked GlobalSettings properties.
Extension state and provider wiring
src/core/webview/ClineProvider.ts
ClineProvider now reads chatFontSize from persisted state and includes it in payloads returned by getStateToPostToWebview() and getState().
Settings UI component and controls
webview-ui/src/components/settings/SettingsView.tsx, webview-ui/src/components/settings/UISettings.tsx
SettingsView includes cached chatFontSize and sends it in updateSettings (serializes unset as null); UISettings exports CHAT_FONT_SIZE_MIN/MAX/DEFAULT, renders a slider and reset button, and wires change/reset handlers.
Settings UI tests
webview-ui/src/components/settings/__tests__/UISettings.spec.tsx, webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
Tests validate slider rendering, keyboard interaction persistence via setCachedStateField, telemetry events for change/reset, and updateSettings payloads containing chatFontSize / null.
Context state management and CSS synchronization
webview-ui/src/context/ExtensionStateContext.tsx, webview-ui/src/context/__tests__/ExtensionStateContext.spec.tsx
Context exposes chatFontSize and setChatFontSize; a useEffect maps numeric value to --zoo-chat-font-size (sets <value>px) or removes the variable to fall back to VS Code defaults. Tests verify CSS variable updates on set/reset.
CSS baseline and Markdown font usage
webview-ui/src/index.css, webview-ui/src/components/common/MarkdownBlock.tsx
Adds --zoo-chat-font-size (defaulting to --vscode-font-size) on html and updates MarkdownBlock to prefer this variable for rendered chat font-size.
Internationalization translations
webview-ui/src/i18n/locales/*/settings.json
Adds ui.chatFontSize translation keys (label, description, reset) across locale files used by the webview UI.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Zoo-Code-Org/Zoo-Code#32: Also modifies ClineProvider state payload generation to include additional ExtensionState fields.

Suggested reviewers

  • edelauna
  • hannesrudolph
  • navedmerchant

Poem

🐰 A tiny rabbit nudges the slider light,
"From eight to thirty-two, make chat words right.
CSS hops in—a variable takes place,
Pixels align and messages find space.
Hooray—readable chat, snug and bright."

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically summarizes the main change: adding a configurable chat font size feature to the settings.
Description check ✅ Passed The description includes most required sections: summary, change details, tests, i18n coverage, and closes issue #157. However, it lacks explicit test procedure steps and pre-submission checklist completion.
Linked Issues check ✅ Passed The PR successfully addresses issue #157 requirements: adds independent chat font size setting (integer px, 8-32 bounds), surfaces it in UI settings with slider and reset, includes comprehensive tests and i18n for all 18 locales.
Out of Scope Changes check ✅ Passed All changes are within scope: chat font size setting, state management, UI components, CSS variables, tests, and i18n strings directly support the linked issue objective without unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/types/src/global-settings.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

packages/types/src/vscode-extension-host.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

src/core/webview/ClineProvider.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

  • 8 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@edelauna edelauna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be modeled as a scale relative to VS Code’s current font size instead of an absolute pixel value? If the default is meant to inherit VS Code, using a multiplier/percent would preserve the user’s existing VS Code font baseline across machines while still allowing chat-specific enlargement.

Also could you include some screen recordings of how this looks on max size.

Comment thread webview-ui/src/index.css Outdated
Comment thread webview-ui/src/index.css Outdated
Comment thread webview-ui/src/components/settings/__tests__/UISettings.spec.tsx
@proyectoauraorg
Copy link
Copy Markdown
Contributor Author

@edelauna addressed all three in 03a1df2a9:

  • MarkdownBlock now reads --zoo-chat-font-size (with VS Code fallback) — chat messages actually respond to the setting now.
  • Scoped to chat: reverted the global @theme --text-* and body overrides, so the setting no longer resizes settings/other webview UI.
  • SettingsView-level test added covering the save boundary (size on save, null on reset).

All green locally (SettingsView/UISettings/ExtensionStateContext specs + tsc + eslint). One note: I verified behavior via the unit tests but not visually — if you'd like a screenshot of the chat at a couple of sizes, I can capture one. Ready for another look — thanks! 🦘

The Zoo Code chat font could not be sized independently of VS Code's UI
zoom. Adds an optional chatFontSize setting (px, 8-32) surfaced as a slider
with a 'Use VS Code default' reset in the UI settings section.

When unset the appearance is unchanged: the --zoo-chat-font-size CSS var
defaults to --vscode-font-size, and the webview text scale derives from it.
When set, the value is applied to the document root and persisted via the
generic updateSettings path (nullish + null-on-reset, matching
allowedMaxRequests). Includes init-vs-user-edit webview tests and full i18n
for all 18 locales.

Closes Zoo-Code-Org#157
@proyectoauraorg proyectoauraorg force-pushed the feat/157-configurable-chat-font-size branch from 03a1df2 to a046159 Compare May 26, 2026 05:59
Copy link
Copy Markdown
Contributor

@edelauna edelauna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - going to try and test this either tonight or tomorrow. Had some additional questions.

Comment on lines +58 to +64
const handleChatFontSizeChange = (value: number) => {
setCachedStateField("chatFontSize", value)
}

const handleChatFontSizeReset = () => {
setCachedStateField("chatFontSize", undefined)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other two handlers in this file both emit a telemetry event — should these do the same? Something like ui_settings_chat_font_size_changed (with value) and ui_settings_chat_font_size_reset would keep the feature visible in analytics.

const slider = within(content).getByTestId("chat-font-size-slider")

// Pick a size, then Save — the boundary should forward it to the host.
fireEvent.change(slider, { target: { value: "18" } })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does fireEvent.change on the Radix <Slider> root element actually reach onValueChange? The matching UISettings.spec.tsx test drives the slider via fireEvent.keyDown(slider, { key: "ArrowRight" }) on the [role="slider"] thumb — if this change event is silently ignored, the assertion below might be passing because chatFontSize was already 18 in the initial mock state rather than because the interaction worked.

…rg#157)

The chat font size change/reset handlers now emit telemetry like the other
UI settings handlers in this file (ui_settings_chat_font_size_changed with
the value, and ui_settings_chat_font_size_reset). Covered by UISettings spec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Adjust the font size in Zoo Code extension

2 participants