Skip to content

Commit c22d728

Browse files
committed
add new setting view for UI settings, support markdown block lineheight
1 parent 7d99689 commit c22d728

30 files changed

+229
-5
lines changed

evals/packages/types/src/roo-code-defaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const rooCodeDefaults: RooCodeSettings = {
88

99
pinnedApiConfigs: {},
1010

11+
markdownBlockLineheight: 1.25,
1112
autoApprovalEnabled: true,
1213
alwaysAllowReadOnly: true,
1314
alwaysAllowReadOnlyOutsideWorkspace: false,

evals/packages/types/src/roo-code.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ export const globalSettingsSchema = z.object({
731731
customInstructions: z.string().optional(),
732732
taskHistory: z.array(historyItemSchema).optional(),
733733

734+
markdownBlockLineheight: z.number().optional(),
734735
autoApprovalEnabled: z.boolean().optional(),
735736
alwaysAllowReadOnly: z.boolean().optional(),
736737
alwaysAllowReadOnlyOutsideWorkspace: z.boolean().optional(),
@@ -810,6 +811,7 @@ const globalSettingsRecord: GlobalSettingsRecord = {
810811
customInstructions: undefined,
811812
taskHistory: undefined,
812813

814+
markdownBlockLineheight: undefined,
813815
autoApprovalEnabled: undefined,
814816
alwaysAllowReadOnly: undefined,
815817
alwaysAllowReadOnlyOutsideWorkspace: undefined,

src/core/webview/ClineProvider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
12681268
maxReadFileLine,
12691269
terminalCompressProgressBar,
12701270
historyPreviewCollapsed,
1271+
markdownBlockLineheight,
12711272
} = await this.getState()
12721273

12731274
const telemetryKey = process.env.POSTHOG_API_KEY
@@ -1356,6 +1357,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
13561357
terminalCompressProgressBar: terminalCompressProgressBar ?? true,
13571358
hasSystemPromptOverride,
13581359
historyPreviewCollapsed: historyPreviewCollapsed ?? false,
1360+
markdownBlockLineheight: markdownBlockLineheight ?? 1.25,
13591361
}
13601362
}
13611363

@@ -1446,6 +1448,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
14461448
showRooIgnoredFiles: stateValues.showRooIgnoredFiles ?? true,
14471449
maxReadFileLine: stateValues.maxReadFileLine ?? 500,
14481450
historyPreviewCollapsed: stateValues.historyPreviewCollapsed ?? false,
1451+
markdownBlockLineheight: stateValues.markdownBlockLineheight ?? 1.25,
14491452
}
14501453
}
14511454

src/core/webview/webviewMessageHandler.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,10 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We
894894
await updateGlobalState("maxReadFileLine", message.value)
895895
await provider.postStateToWebview()
896896
break
897+
case "markdownBlockLineheight":
898+
await updateGlobalState("markdownBlockLineheight", message.value ?? 1.25)
899+
await provider.postStateToWebview()
900+
break
897901
case "setHistoryPreviewCollapsed": // Add the new case handler
898902
await updateGlobalState("historyPreviewCollapsed", message.bool ?? false)
899903
// No need to call postStateToWebview here as the UI already updated optimistically

src/exports/roo-code.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type GlobalSettings = {
5656
workspace?: string | undefined
5757
}[]
5858
| undefined
59+
markdownBlockLineheight: number | undefined
5960
autoApprovalEnabled?: boolean | undefined
6061
alwaysAllowReadOnly?: boolean | undefined
6162
alwaysAllowReadOnlyOutsideWorkspace?: boolean | undefined

src/exports/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type GlobalSettings = {
5656
workspace?: string | undefined
5757
}[]
5858
| undefined
59+
markdownBlockLineheight?: number | undefined
5960
autoApprovalEnabled?: boolean | undefined
6061
alwaysAllowReadOnly?: boolean | undefined
6162
alwaysAllowReadOnlyOutsideWorkspace?: boolean | undefined

src/schemas/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ export const globalSettingsSchema = z.object({
735735
customInstructions: z.string().optional(),
736736
taskHistory: z.array(historyItemSchema).optional(),
737737

738+
markdownBlockLineheight: z.number().optional(),
738739
autoApprovalEnabled: z.boolean().optional(),
739740
alwaysAllowReadOnly: z.boolean().optional(),
740741
alwaysAllowReadOnlyOutsideWorkspace: z.boolean().optional(),
@@ -815,6 +816,7 @@ const globalSettingsRecord: GlobalSettingsRecord = {
815816
customInstructions: undefined,
816817
taskHistory: undefined,
817818

819+
markdownBlockLineheight: undefined,
818820
autoApprovalEnabled: undefined,
819821
alwaysAllowReadOnly: undefined,
820822
alwaysAllowReadOnlyOutsideWorkspace: undefined,

src/shared/ExtensionMessage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export interface ExtensionMessage {
7070
| "commandExecutionStatus"
7171
| "vsCodeSetting"
7272
| "condenseTaskContextResponse"
73+
| "markdownBlockLineheight"
7374
text?: string
7475
action?:
7576
| "chatButtonClicked"
@@ -170,6 +171,7 @@ export type ExtensionState = Pick<
170171
| "customModePrompts"
171172
| "customSupportPrompts"
172173
| "enhancementApiConfigId"
174+
| "markdownBlockLineheight"
173175
> & {
174176
version: string
175177
clineMessages: ClineMessage[]

src/shared/WebviewMessage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export interface WebviewMessage {
132132
| "toggleApiConfigPin"
133133
| "setHistoryPreviewCollapsed"
134134
| "condenseTaskContextRequest"
135+
| "markdownBlockLineheight"
135136
text?: string
136137
disabled?: boolean
137138
askResponse?: ClineAskResponse

webview-ui/src/components/common/MarkdownBlock.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const remarkUrlToLink = () => {
5555
}
5656
}
5757

58-
const StyledMarkdown = styled.div`
58+
const StyledMarkdown = styled.div<{ lineheight: number | string }>`
5959
code:not(pre > code) {
6060
font-family: var(--vscode-editor-font-family, monospace);
6161
filter: saturation(110%) brightness(95%);
@@ -95,7 +95,7 @@ const StyledMarkdown = styled.div`
9595
li,
9696
ol,
9797
ul {
98-
line-height: 1.25;
98+
line-height: ${(props) => props.lineheight};
9999
}
100100
101101
ol,
@@ -122,7 +122,7 @@ const StyledMarkdown = styled.div`
122122
`
123123

124124
const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => {
125-
const { theme } = useExtensionState()
125+
const { theme, markdownBlockLineheight } = useExtensionState()
126126
const [reactContent, setMarkdown] = useRemark({
127127
remarkPlugins: [
128128
remarkUrlToLink,
@@ -229,7 +229,7 @@ const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => {
229229

230230
return (
231231
<div style={{}}>
232-
<StyledMarkdown>{reactContent}</StyledMarkdown>
232+
<StyledMarkdown lineheight={markdownBlockLineheight || 1.25}>{reactContent}</StyledMarkdown>
233233
</div>
234234
)
235235
})

0 commit comments

Comments
 (0)