This repository was archived by the owner on May 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(ui): add chat font size multiplier setting #10489
Draft
ghost
wants to merge
4
commits into
main
Choose a base branch
from
feature/chat-font-size-multiplier
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+325
−2
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
aecec67
feat(ui): add chat font size multiplier setting
roomote 007629a
fix: round font size multiplier to avoid floating point precision art…
roomote 3c5e393
fix: include chatFontSizeMultiplier in updateSettings payload
roomote e6e1c5b
fix: move font size telemetry to blur handler, add comprehensive tests
roomote File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||||||||||||||||||||||||||||||
| import { HTMLAttributes, useMemo } from "react" | ||||||||||||||||||||||||||||||||||
| import { HTMLAttributes, useMemo, useState, useCallback, useEffect } from "react" | ||||||||||||||||||||||||||||||||||
| import { useAppTranslation } from "@/i18n/TranslationContext" | ||||||||||||||||||||||||||||||||||
| import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" | ||||||||||||||||||||||||||||||||||
| import { RotateCcw } from "lucide-react" | ||||||||||||||||||||||||||||||||||
| import { telemetryClient } from "@/utils/TelemetryClient" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| import { SetCachedStateField } from "./types" | ||||||||||||||||||||||||||||||||||
|
|
@@ -12,17 +13,27 @@ import { ExtensionStateContextType } from "@/context/ExtensionStateContext" | |||||||||||||||||||||||||||||||||
| interface UISettingsProps extends HTMLAttributes<HTMLDivElement> { | ||||||||||||||||||||||||||||||||||
| reasoningBlockCollapsed: boolean | ||||||||||||||||||||||||||||||||||
| enterBehavior: "send" | "newline" | ||||||||||||||||||||||||||||||||||
| chatFontSizeMultiplier: number | ||||||||||||||||||||||||||||||||||
| setCachedStateField: SetCachedStateField<keyof ExtensionStateContextType> | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| export const UISettings = ({ | ||||||||||||||||||||||||||||||||||
| reasoningBlockCollapsed, | ||||||||||||||||||||||||||||||||||
| enterBehavior, | ||||||||||||||||||||||||||||||||||
| chatFontSizeMultiplier, | ||||||||||||||||||||||||||||||||||
| setCachedStateField, | ||||||||||||||||||||||||||||||||||
| ...props | ||||||||||||||||||||||||||||||||||
| }: UISettingsProps) => { | ||||||||||||||||||||||||||||||||||
| const { t } = useAppTranslation() | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Local state for the input value to allow typing freely | ||||||||||||||||||||||||||||||||||
| const [localMultiplier, setLocalMultiplier] = useState(chatFontSizeMultiplier.toString()) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Sync local state when prop changes (e.g., from commands) | ||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||
| setLocalMultiplier(chatFontSizeMultiplier.toString()) | ||||||||||||||||||||||||||||||||||
| }, [chatFontSizeMultiplier]) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Detect platform for dynamic modifier key display | ||||||||||||||||||||||||||||||||||
| const primaryMod = useMemo(() => { | ||||||||||||||||||||||||||||||||||
| const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0 | ||||||||||||||||||||||||||||||||||
|
|
@@ -48,6 +59,45 @@ export const UISettings = ({ | |||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const handleFontSizeMultiplierChange = useCallback( | ||||||||||||||||||||||||||||||||||
| (value: string) => { | ||||||||||||||||||||||||||||||||||
| setLocalMultiplier(value) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Parse and validate the value | ||||||||||||||||||||||||||||||||||
| const numValue = parseFloat(value) | ||||||||||||||||||||||||||||||||||
| if (!isNaN(numValue)) { | ||||||||||||||||||||||||||||||||||
| // Clamp the value between 0.5 and 2 | ||||||||||||||||||||||||||||||||||
| const clampedValue = Math.max(0.5, Math.min(2, numValue)) | ||||||||||||||||||||||||||||||||||
| setCachedStateField("chatFontSizeMultiplier", clampedValue) | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
| [setCachedStateField], | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const handleFontSizeMultiplierBlur = useCallback(() => { | ||||||||||||||||||||||||||||||||||
| // On blur, ensure the display value matches the clamped value | ||||||||||||||||||||||||||||||||||
| const numValue = parseFloat(localMultiplier) | ||||||||||||||||||||||||||||||||||
| if (isNaN(numValue)) { | ||||||||||||||||||||||||||||||||||
| setLocalMultiplier(chatFontSizeMultiplier.toString()) | ||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||
| const clampedValue = Math.max(0.5, Math.min(2, numValue)) | ||||||||||||||||||||||||||||||||||
| setLocalMultiplier(clampedValue.toString()) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Track telemetry event on blur to capture only the user's final value | ||||||||||||||||||||||||||||||||||
| telemetryClient.capture("ui_settings_chat_font_size_changed", { | ||||||||||||||||||||||||||||||||||
| multiplier: clampedValue, | ||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+83
to
+89
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Fix it with Roo Code or mention @roomote and request a fix. |
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| }, [localMultiplier, chatFontSizeMultiplier]) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const handleResetFontSize = useCallback(() => { | ||||||||||||||||||||||||||||||||||
| setCachedStateField("chatFontSizeMultiplier", 1) | ||||||||||||||||||||||||||||||||||
| setLocalMultiplier("1") | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Track telemetry event | ||||||||||||||||||||||||||||||||||
| telemetryClient.capture("ui_settings_chat_font_size_reset", {}) | ||||||||||||||||||||||||||||||||||
| }, [setCachedStateField]) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||
| <div {...props}> | ||||||||||||||||||||||||||||||||||
| <SectionHeader>{t("settings:sections.ui")}</SectionHeader> | ||||||||||||||||||||||||||||||||||
|
|
@@ -91,6 +141,43 @@ export const UISettings = ({ | |||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </SearchableSetting> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| {/* Chat Font Size Multiplier Setting */} | ||||||||||||||||||||||||||||||||||
| <SearchableSetting | ||||||||||||||||||||||||||||||||||
| settingId="ui-chat-font-size" | ||||||||||||||||||||||||||||||||||
| section="ui" | ||||||||||||||||||||||||||||||||||
| label={t("settings:ui.chatFontSizeMultiplier.label")}> | ||||||||||||||||||||||||||||||||||
| <div className="flex flex-col gap-1"> | ||||||||||||||||||||||||||||||||||
| <label className="font-medium" htmlFor="chat-font-size-input"> | ||||||||||||||||||||||||||||||||||
| {t("settings:ui.chatFontSizeMultiplier.label")} | ||||||||||||||||||||||||||||||||||
| </label> | ||||||||||||||||||||||||||||||||||
| <div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||
| <input | ||||||||||||||||||||||||||||||||||
| id="chat-font-size-input" | ||||||||||||||||||||||||||||||||||
| type="number" | ||||||||||||||||||||||||||||||||||
| min="0.5" | ||||||||||||||||||||||||||||||||||
| max="2" | ||||||||||||||||||||||||||||||||||
| step="0.1" | ||||||||||||||||||||||||||||||||||
| value={localMultiplier} | ||||||||||||||||||||||||||||||||||
| onChange={(e) => handleFontSizeMultiplierChange(e.target.value)} | ||||||||||||||||||||||||||||||||||
| onBlur={handleFontSizeMultiplierBlur} | ||||||||||||||||||||||||||||||||||
| className="w-20 px-2 py-1 bg-vscode-input-background text-vscode-input-foreground border border-vscode-input-border rounded" | ||||||||||||||||||||||||||||||||||
| data-testid="chat-font-size-input" | ||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||
| onClick={handleResetFontSize} | ||||||||||||||||||||||||||||||||||
| className="flex items-center gap-1 px-2 py-1 text-sm bg-vscode-button-secondaryBackground text-vscode-button-secondaryForeground hover:bg-vscode-button-secondaryHoverBackground rounded" | ||||||||||||||||||||||||||||||||||
| title={t("settings:ui.chatFontSizeMultiplier.reset")} | ||||||||||||||||||||||||||||||||||
| data-testid="chat-font-size-reset-button"> | ||||||||||||||||||||||||||||||||||
| <RotateCcw className="w-3 h-3" /> | ||||||||||||||||||||||||||||||||||
| {t("settings:ui.chatFontSizeMultiplier.reset")} | ||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| <div className="text-vscode-descriptionForeground text-sm mt-1"> | ||||||||||||||||||||||||||||||||||
| {t("settings:ui.chatFontSizeMultiplier.description")} | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </SearchableSetting> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </Section> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chatFontSizeMultiplieris destructured fromcachedStatehere but is never included in theupdatedSettingspayload insidehandleSubmit(around line 416, next toenterBehavior). The commands persist correctly viacontextProxy.setValue(), but changes made through the Settings UI will be lost on reload becausehandleSubmitnever sends this field to the extension host. AddchatFontSizeMultiplier: chatFontSizeMultiplier ?? 1,to theupdatedSettingsobject inhandleSubmit.Fix it with Roo Code or mention @roomote and request a fix.