Skip to content
1 change: 1 addition & 0 deletions evals/packages/types/src/roo-code-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const rooCodeDefaults: RooCodeSettings = {

pinnedApiConfigs: {},

markdownBlockLineHeight: 1.25,
autoApprovalEnabled: true,
alwaysAllowReadOnly: true,
alwaysAllowReadOnlyOutsideWorkspace: false,
Expand Down
2 changes: 2 additions & 0 deletions evals/packages/types/src/roo-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ export const globalSettingsSchema = z.object({
customInstructions: z.string().optional(),
taskHistory: z.array(historyItemSchema).optional(),

markdownBlockLineHeight: z.number().optional(),
autoApprovalEnabled: z.boolean().optional(),
alwaysAllowReadOnly: z.boolean().optional(),
alwaysAllowReadOnlyOutsideWorkspace: z.boolean().optional(),
Expand Down Expand Up @@ -810,6 +811,7 @@ const globalSettingsRecord: GlobalSettingsRecord = {
customInstructions: undefined,
taskHistory: undefined,

markdownBlockLineHeight: undefined,
autoApprovalEnabled: undefined,
alwaysAllowReadOnly: undefined,
alwaysAllowReadOnlyOutsideWorkspace: undefined,
Expand Down
3 changes: 3 additions & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
maxReadFileLine,
terminalCompressProgressBar,
historyPreviewCollapsed,
markdownBlockLineHeight,
} = await this.getState()

const telemetryKey = process.env.POSTHOG_API_KEY
Expand Down Expand Up @@ -1356,6 +1357,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
terminalCompressProgressBar: terminalCompressProgressBar ?? true,
hasSystemPromptOverride,
historyPreviewCollapsed: historyPreviewCollapsed ?? false,
markdownBlockLineHeight: markdownBlockLineHeight ?? 1.25,
}
}

Expand Down Expand Up @@ -1446,6 +1448,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
showRooIgnoredFiles: stateValues.showRooIgnoredFiles ?? true,
maxReadFileLine: stateValues.maxReadFileLine ?? 500,
historyPreviewCollapsed: stateValues.historyPreviewCollapsed ?? false,
markdownBlockLineHeight: stateValues.markdownBlockLineHeight ?? 1.25,
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/core/webview/webviewMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,10 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We
await updateGlobalState("maxReadFileLine", message.value)
await provider.postStateToWebview()
break
case "markdownBlockLineHeight":
await updateGlobalState("markdownBlockLineHeight", message.value ?? 1.25)
await provider.postStateToWebview()
break
case "setHistoryPreviewCollapsed": // Add the new case handler
await updateGlobalState("historyPreviewCollapsed", message.bool ?? false)
// No need to call postStateToWebview here as the UI already updated optimistically
Expand Down
1 change: 1 addition & 0 deletions src/exports/roo-code.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type GlobalSettings = {
workspace?: string | undefined
}[]
| undefined
markdownBlockLineHeight?: number | undefined
autoApprovalEnabled?: boolean | undefined
alwaysAllowReadOnly?: boolean | undefined
alwaysAllowReadOnlyOutsideWorkspace?: boolean | undefined
Expand Down
1 change: 1 addition & 0 deletions src/exports/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type GlobalSettings = {
workspace?: string | undefined
}[]
| undefined
markdownBlockLineHeight?: number | undefined
autoApprovalEnabled?: boolean | undefined
alwaysAllowReadOnly?: boolean | undefined
alwaysAllowReadOnlyOutsideWorkspace?: boolean | undefined
Expand Down
2 changes: 2 additions & 0 deletions src/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ export const globalSettingsSchema = z.object({
customInstructions: z.string().optional(),
taskHistory: z.array(historyItemSchema).optional(),

markdownBlockLineHeight: z.number().optional(),
autoApprovalEnabled: z.boolean().optional(),
alwaysAllowReadOnly: z.boolean().optional(),
alwaysAllowReadOnlyOutsideWorkspace: z.boolean().optional(),
Expand Down Expand Up @@ -815,6 +816,7 @@ const globalSettingsRecord: GlobalSettingsRecord = {
customInstructions: undefined,
taskHistory: undefined,

markdownBlockLineHeight: undefined,
autoApprovalEnabled: undefined,
alwaysAllowReadOnly: undefined,
alwaysAllowReadOnlyOutsideWorkspace: undefined,
Expand Down
2 changes: 2 additions & 0 deletions src/shared/ExtensionMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface ExtensionMessage {
| "commandExecutionStatus"
| "vsCodeSetting"
| "condenseTaskContextResponse"
| "markdownBlockLineHeight"
text?: string
action?:
| "chatButtonClicked"
Expand Down Expand Up @@ -170,6 +171,7 @@ export type ExtensionState = Pick<
| "customModePrompts"
| "customSupportPrompts"
| "enhancementApiConfigId"
| "markdownBlockLineHeight"
> & {
version: string
clineMessages: ClineMessage[]
Expand Down
1 change: 1 addition & 0 deletions src/shared/WebviewMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export interface WebviewMessage {
| "toggleApiConfigPin"
| "setHistoryPreviewCollapsed"
| "condenseTaskContextRequest"
| "markdownBlockLineHeight"
text?: string
disabled?: boolean
askResponse?: ClineAskResponse
Expand Down
8 changes: 4 additions & 4 deletions webview-ui/src/components/common/MarkdownBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const remarkUrlToLink = () => {
}
}

const StyledMarkdown = styled.div`
const StyledMarkdown = styled.div<{ lineheight: number | string }>`
code:not(pre > code) {
font-family: var(--vscode-editor-font-family, monospace);
filter: saturation(110%) brightness(95%);
Expand Down Expand Up @@ -95,7 +95,7 @@ const StyledMarkdown = styled.div`
li,
ol,
ul {
line-height: 1.25;
line-height: ${(props) => props.lineheight};
}

ol,
Expand All @@ -122,7 +122,7 @@ const StyledMarkdown = styled.div`
`

const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => {
const { theme } = useExtensionState()
const { theme, markdownBlockLineHeight } = useExtensionState()
const [reactContent, setMarkdown] = useRemark({
remarkPlugins: [
remarkUrlToLink,
Expand Down Expand Up @@ -229,7 +229,7 @@ const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => {

return (
<div style={{}}>
<StyledMarkdown>{reactContent}</StyledMarkdown>
<StyledMarkdown lineheight={markdownBlockLineHeight || 1.25}>{reactContent}</StyledMarkdown>
</div>
)
})
Expand Down
14 changes: 14 additions & 0 deletions webview-ui/src/components/settings/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
Globe,
Info,
LucideIcon,
Brush,
} from "lucide-react"

import { ExperimentId } from "@roo/shared/experiments"
Expand All @@ -49,6 +50,7 @@ import {

import { Tab, TabContent, TabHeader, TabList, TabTrigger } from "../common/Tab"
import { SetCachedStateField, SetExperimentEnabled } from "./types"
import { UISettings } from "./UISettings"
import { SectionHeader } from "./SectionHeader"
import ApiConfigManager from "./ApiConfigManager"
import ApiOptions from "./ApiOptions"
Expand Down Expand Up @@ -77,6 +79,7 @@ export interface SettingsViewRef {

const sectionNames = [
"providers",
"uiSettings",
"autoApprove",
"browser",
"checkpoints",
Expand Down Expand Up @@ -160,6 +163,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
remoteBrowserEnabled,
maxReadFileLine,
terminalCompressProgressBar,
markdownBlockLineHeight,
} = cachedState

const apiConfiguration = useMemo(() => cachedState.apiConfiguration ?? {}, [cachedState.apiConfiguration])
Expand Down Expand Up @@ -284,6 +288,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
vscode.postMessage({ type: "alwaysAllowSubtasks", bool: alwaysAllowSubtasks })
vscode.postMessage({ type: "upsertApiConfiguration", text: currentApiConfigName, apiConfiguration })
vscode.postMessage({ type: "telemetrySetting", text: telemetrySetting })
vscode.postMessage({ type: "markdownBlockLineHeight", value: markdownBlockLineHeight })
setChangeDetected(false)
}
}
Expand Down Expand Up @@ -354,6 +359,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
const sections: { id: SectionName; icon: LucideIcon }[] = useMemo(
() => [
{ id: "providers", icon: Webhook },
{ id: "uiSettings", icon: Brush },
{ id: "autoApprove", icon: CheckCheck },
{ id: "browser", icon: SquareMousePointer },
{ id: "checkpoints", icon: GitBranch },
Expand Down Expand Up @@ -547,6 +553,14 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
</div>
)}

{/* UISettings Section */}
{activeTab === "uiSettings" && (
<UISettings
markdownBlockLineHeight={cachedState.markdownBlockLineHeight ?? 1.25}
setCachedStateField={setCachedStateField}
/>
)}

{/* Auto-Approve Section */}
{activeTab === "autoApprove" && (
<AutoApproveSettings
Expand Down
51 changes: 51 additions & 0 deletions webview-ui/src/components/settings/UISettings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { HTMLAttributes } from "react"
import { useAppTranslation } from "@/i18n/TranslationContext"
import { Database } from "lucide-react"

import { cn } from "@/lib/utils"
import { Slider } from "@/components/ui"

import { SetCachedStateField } from "./types"
import { SectionHeader } from "./SectionHeader"
import { Section } from "./Section"

type UISettingsProps = HTMLAttributes<HTMLDivElement> & {
markdownBlockLineHeight: number
setCachedStateField: SetCachedStateField<"markdownBlockLineHeight">
}

export const UISettings = ({ markdownBlockLineHeight, setCachedStateField, className, ...props }: UISettingsProps) => {
const { t } = useAppTranslation()
return (
<div className={cn("flex flex-col gap-2", className)} {...props}>
<SectionHeader description={t("settings:uiSettings.description")}>
<div className="flex items-center gap-2">
<Database className="w-4" />
<div>{t("settings:sections.uiSettings")}</div>
</div>
</SectionHeader>

<Section>
<div>
<span className="block font-medium mb-1">
{t("settings:uiSettings.markdownBlockLineHeight.label")}
</span>
<div className="flex items-center gap-2">
<Slider
min={1.25}
max={2}
step={0.01}
value={[markdownBlockLineHeight ?? 1.25]}
onValueChange={([value]) => setCachedStateField("markdownBlockLineHeight", value)}
data-testid="markdown-lineheight-slider"
/>
<span className="w-10">{markdownBlockLineHeight ?? 1.25}</span>
</div>
<div className="text-vscode-descriptionForeground text-sm mt-1">
{t("settings:uiSettings.markdownBlockLineHeight.description")}
</div>
</div>
</Section>
</div>
)
}
6 changes: 6 additions & 0 deletions webview-ui/src/context/ExtensionStateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface ExtensionStateContextType extends ExtensionState {
currentCheckpoint?: string
filePaths: string[]
openedTabs: Array<{ label: string; isActive: boolean; path?: string }>
markdownBlockLineHeight: number | undefined
setMarkdownBlockLineHeight: (value: number) => void
setApiConfiguration: (config: ProviderSettings) => void
setCustomInstructions: (value?: string) => void
setAlwaysAllowReadOnly: (value: boolean) => void
Expand Down Expand Up @@ -159,6 +161,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
customSupportPrompts: {},
experiments: experimentDefault,
enhancementApiConfigId: "",
markdownBlockLineHeight: 1.25,
autoApprovalEnabled: false,
customModes: [],
maxOpenTabsContext: 20,
Expand Down Expand Up @@ -266,6 +269,9 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
fuzzyMatchThreshold: state.fuzzyMatchThreshold,
writeDelayMs: state.writeDelayMs,
screenshotQuality: state.screenshotQuality,
markdownBlockLineHeight: state.markdownBlockLineHeight,
setMarkdownBlockLineHeight: (value) =>
setState((prevState) => ({ ...prevState, markdownBlockLineHeight: value })),
setExperimentEnabled: (id, enabled) =>
setState((prevState) => ({ ...prevState, experiments: { ...prevState.experiments, [id]: enabled } })),
setApiConfiguration: (value) =>
Expand Down
10 changes: 9 additions & 1 deletion webview-ui/src/i18n/locales/ca/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"sections": {
"providers": "ProveΓ―dors",
"uiSettings": "ConfiguraciΓ³ de la interfΓ­cie",
"autoApprove": "Auto-aprovaciΓ³",
"browser": "AccΓ©s a l'ordinador",
"checkpoints": "Punts de control",
Expand Down Expand Up @@ -324,6 +325,13 @@
"always_full_read": "Llegeix sempre el fitxer sencer"
}
},
"uiSettings": {
"description": "ConfiguraciΓ³ relacionada amb la interfΓ­cie d'usuari",
"markdownBlockLineHeight": {
"label": "Espaiat entre lΓ­nies del contingut del panell",
"description": "Ajusteu l'interlineat del contingut del panell per millorar la llegibilitat."
}
},
"terminal": {
"basic": {
"label": "ConfiguraciΓ³ del terminal: BΓ sica",
Expand Down Expand Up @@ -529,4 +537,4 @@
"customArn": "ARN personalitzat",
"useCustomArn": "Utilitza ARN personalitzat..."
}
}
}
10 changes: 9 additions & 1 deletion webview-ui/src/i18n/locales/de/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"sections": {
"providers": "Anbieter",
"uiSettings": "UI-Einstellungen",
"autoApprove": "Auto-Genehmigung",
"browser": "Computerzugriff",
"checkpoints": "Kontrollpunkte",
Expand Down Expand Up @@ -324,6 +325,13 @@
"always_full_read": "Immer die gesamte Datei lesen"
}
},
"uiSettings": {
"description": "BenutzeroberflΓ€chenbezogene Konfiguration",
"markdownBlockLineHeight": {
"label": "Zeilenabstand des Panelinhalts",
"description": "Passen Sie den Zeilenabstand des Panel-Inhalts an, um die Lesbarkeit zu verbessern."
}
},
"terminal": {
"basic": {
"label": "Terminal-Einstellungen: Grundlegend",
Expand Down Expand Up @@ -529,4 +537,4 @@
"customArn": "Benutzerdefinierte ARN",
"useCustomArn": "Benutzerdefinierte ARN verwenden..."
}
}
}
10 changes: 9 additions & 1 deletion webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"sections": {
"providers": "Providers",
"uiSettings": "UI Settings",
"autoApprove": "Auto-Approve",
"browser": "Browser",
"checkpoints": "Checkpoints",
Expand Down Expand Up @@ -324,6 +325,13 @@
"always_full_read": "Always read entire file"
}
},
"uiSettings": {
"description": "UI related configuration",
"markdownBlockLineHeight": {
"label": "Content vertical spacing",
"description": "Adjust content vertical line spacing to improve readability."
}
},
"terminal": {
"basic": {
"label": "Terminal Settings: Basic",
Expand Down Expand Up @@ -529,4 +537,4 @@
"customArn": "Custom ARN",
"useCustomArn": "Use custom ARN..."
}
}
}
Loading