diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index b7c8e12f8d..08c1298f80 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -32,6 +32,7 @@ import { useSavedSqlStore } from "@/stores/savedSqlStore"; import { usePromptTemplateStore } from "@/stores/promptTemplateStore"; import { useToast } from "@/composables/useToast"; import { useTheme } from "@/composables/useTheme"; +import { useEditorFontFamilyStyle } from "@/composables/useEditorFontFamilyStyle"; import { canDownloadAndInstallUpdate, useAppUpdater } from "@/composables/useAppUpdater"; import { useMcpUpdateBadge } from "@/composables/useMcpUpdateBadge"; import { useComponentUpdates, type ComponentUpdateCategory } from "@/composables/useComponentUpdates"; @@ -234,6 +235,7 @@ const queryStore = useQueryStore(); const navigationStore = useNavigationStore(); const settingsStore = useSettingsStore(); const { active: appBackgroundActive, backgroundObjectUrl: appBackgroundObjectUrl, backgroundImageStyle: appBackgroundImageStyle } = useBackgroundImage(settingsStore); +const editorFontFamilyStyle = useEditorFontFamilyStyle(); const { uiFontFamilyPreview } = useUiFontFamilyPreview(); const savedSqlStore = useSavedSqlStore(); const promptTemplateStore = usePromptTemplateStore(); @@ -5382,7 +5384,7 @@ onUnmounted(() => { @saved="onQueryEditorObjectSourceSaved" /> -
+ diff --git a/apps/desktop/src/lib/__tests__/editorThemes.spec.ts b/apps/desktop/src/lib/__tests__/editorThemes.spec.ts index 3475dabd3a..48ef2b03aa 100644 --- a/apps/desktop/src/lib/__tests__/editorThemes.spec.ts +++ b/apps/desktop/src/lib/__tests__/editorThemes.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { buildEditorFontThemeRules, buildSqlCompletionThemeRules, editorDiagnosticColors, editorThemeAppearanceFor, IDE_EDITOR_THEMES, loadEditorTheme, resolveCustomThemeBackgrounds, resolveEditorTheme, SQL_BUILTIN_HIGHLIGHT_TAG } from "@/lib/editor/editorThemes"; +import { buildEditorFontThemeRules, buildSqlCompletionThemeRules, EDITOR_FONT_FAMILY_CSS_VAR, editorDiagnosticColors, editorThemeAppearanceFor, IDE_EDITOR_THEMES, loadEditorTheme, resolveCustomThemeBackgrounds, resolveEditorTheme, SQL_BUILTIN_HIGHLIGHT_TAG } from "@/lib/editor/editorThemes"; import { DEFAULT_APP_CUSTOM_UI_COLORS, wcagContrastRatio, type AppThemePalette } from "@/lib/app/appTheme"; import { DEFAULT_CUSTOM_THEME_COLORS, type CustomThemeColors, type EditorTheme } from "@/stores/settingsStore"; import { createDbxCodeMirrorSqlDialect } from "@/lib/editor/codemirrorSqlDialect"; @@ -216,6 +216,17 @@ describe("SQL completion theme", () => { expect(rules[".cm-tooltip.cm-tooltip-autocomplete > ul > li"]).toMatchObject({ borderRadius: "var(--dbx-radius-sm)" }); }); + it("renders the info popup in the configured editor font", () => { + // The info popup is a sibling tooltip rather than a child of the + // autocomplete tooltip, so it inherits nothing from it and needs the + // variable set on its own rule. + const rules = buildSqlCompletionThemeRules(); + const editorFont = `var(${EDITOR_FONT_FAMILY_CSS_VAR}, var(--font-mono, monospace))`; + + expect(rules[".cm-tooltip.cm-completionInfo"]).toMatchObject({ fontFamily: editorFont }); + expect(rules[".cm-completionLabel"]).toMatchObject({ fontFamily: editorFont }); + }); + it("keeps completion labels ahead of long detail text", () => { const rules = buildSqlCompletionThemeRules(); diff --git a/apps/desktop/src/lib/editor/editorThemes.ts b/apps/desktop/src/lib/editor/editorThemes.ts index 51b7ba7eee..300a1f453e 100644 --- a/apps/desktop/src/lib/editor/editorThemes.ts +++ b/apps/desktop/src/lib/editor/editorThemes.ts @@ -1131,6 +1131,7 @@ export function buildSqlCompletionThemeRules(): CodeMirrorStyleSpec { whiteSpace: "nowrap", }, ".cm-tooltip.cm-completionInfo": { + fontFamily: `var(${EDITOR_FONT_FAMILY_CSS_VAR}, var(--font-mono, monospace))`, maxWidth: "min(420px, calc(100vw - 24px))", overflowWrap: "anywhere", zIndex: "10000",