Skip to content

Commit 89f2dcf

Browse files
committed
feat: Add font aliasing support and update initial settings in ClineProvider
1 parent 4fe0b3c commit 89f2dcf

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,25 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
443443
// Listen for when color changes
444444
vscode.workspace.onDidChangeConfiguration(
445445
async (e) => {
446-
if (e && e.affectsConfiguration("workbench.colorTheme")) {
446+
if (e.affectsConfiguration("workbench.colorTheme")) {
447447
// Sends latest theme name to webview
448448
await this.postMessageToWebview({ type: "theme", text: JSON.stringify(await getTheme()) })
449449
}
450+
if (e.affectsConfiguration("workbench.fontAliasing")) {
451+
const fontAliasingSetting = vscode.workspace.getConfiguration("workbench").get("fontAliasing")
452+
const fontAliasing = typeof fontAliasingSetting === "string" ? fontAliasingSetting : undefined
453+
await this.postMessageToWebview({ type: "fontAliasing", value: fontAliasing })
454+
}
450455
},
451456
null,
452457
this.disposables,
453458
)
454459

460+
const initialFontAliasingSetting = vscode.workspace.getConfiguration("workbench").get("fontAliasing")
461+
const initialFontAliasing =
462+
typeof initialFontAliasingSetting === "string" ? initialFontAliasingSetting : undefined
463+
await this.postMessageToWebview({ type: "fontAliasing", value: initialFontAliasing })
464+
455465
// If the extension is starting a new session, clear previous task state.
456466
await this.removeClineFromStack()
457467

src/shared/ExtensionMessage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export interface ExtensionMessage {
6969
| "maxReadFileLine"
7070
| "fileSearchResults"
7171
| "toggleApiConfigPin"
72+
| "fontAliasing"
7273
text?: string
74+
value?: string
7375
action?:
7476
| "chatButtonClicked"
7577
| "mcpButtonClicked"

webview-ui/src/App.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ const App = () => {
7575
const { requestId, promptText } = message
7676
setHumanRelayDialogState({ isOpen: true, requestId, promptText })
7777
}
78+
79+
if (message.type === "fontAliasing") {
80+
const value = message.value as string | undefined
81+
let smoothingValue = "unset" // Default to letting the browser decide
82+
83+
if (value === "antialiased" || value === "subpixel-antialiased" || value === "none") {
84+
smoothingValue = value
85+
}
86+
87+
;(document.documentElement.style as any)["webkitFontSmoothing"] = smoothingValue
88+
}
7889
},
7990
[switchTab],
8091
)

webview-ui/src/index.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ textarea:focus {
190190

191191
html {
192192
height: 100%;
193-
-webkit-font-smoothing: antialiased;
194-
-moz-osx-font-smoothing: grayscale;
193+
-webkit-font-smoothing: inherit;
195194
}
196195

197196
body {

0 commit comments

Comments
 (0)