From efd4e454ee96937982f0c6d65ad1a31c22374e76 Mon Sep 17 00:00:00 2001
From: Chris Schofield <40196330+ChildishForces@users.noreply.github.com>
Date: Thu, 19 Nov 2026 19:26:32 +0000
Subject: [PATCH] feat(appearance): make Compact Mode match IntelliJ's compact
density (#4593)
Compact Mode only lowered the title bar and narrowed the stripes: row heights, toolbar widgets and icons were fixed in code, and nothing in JS (where virtualised list row heights are set) could tell whether the mode was on. A small density store now mirrors the setting for JS, and Compact Mode uses IntelliJ's *.compact theme values: tree/list rows 22 (VCS log 24), toolbar widgets 26, toolbar and stripe icons 16, status bar 24, island gap 4, and chrome text 1px smaller.
Co-authored-by: ChildishForces <40196330+ChildishForces@users.noreply.github.com>
---
docs/en/guide/themes.mdx | 2 +-
docs/zh/guide/themes.mdx | 2 +-
e2e/compactMode.spec.ts | 48 +++++++++++++++++
src/features/agents/ImportSessionsDialog.tsx | 4 +-
src/features/build-tools/ExecutePopup.tsx | 1 -
src/features/code-insight/UsagesPopup.tsx | 6 ++-
src/features/database/ColumnsPopup.tsx | 4 +-
src/features/database/Grid.test.tsx | 1 +
src/features/debugger/heap/HeapClasses.tsx | 4 +-
.../debugger/heap/editor/BiggestObjects.tsx | 4 +-
src/features/debugger/memory/MemoryView.tsx | 4 +-
.../github/clone/GitHubCloneSource.tsx | 4 +-
src/features/github/create/ChangesPanel.tsx | 4 +-
.../github/create/DirectionSelector.tsx | 1 -
src/features/github/details/BranchWidget.tsx | 1 -
src/features/macros/MacrosDialog.tsx | 1 -
src/features/project-tree/NewPopup.tsx | 1 -
src/features/run-anything/RunAnything.tsx | 1 -
src/features/run/AddConfigPopup.tsx | 6 ++-
src/features/run/ConfigChooser.tsx | 10 ++--
src/features/run/Run.module.css | 10 ++--
src/features/run/RunWidget.tsx | 16 +++---
src/features/scratch/ScratchChooser.tsx | 1 -
.../search/bookmarks/BookmarkPopups.tsx | 5 +-
.../search/everywhere/SearchEverywhere.tsx | 12 +++--
src/features/search/find/FindInFiles.tsx | 6 ++-
src/features/search/recent/RecentPopups.tsx | 2 -
.../search/structure/StructureView.tsx | 6 ++-
.../settings/__tests__/behavior.test.ts | 11 ++++
src/features/settings/appearanceRuntime.ts | 2 +
.../settings/dialog/SettingsDialog.tsx | 1 -
.../templates/files/NewFileDialog.tsx | 1 -
src/features/templates/popup/Chooser.tsx | 4 +-
src/features/vcs/BranchFilterPopup.tsx | 6 ++-
src/features/vcs/BranchWidget.module.css | 4 +-
src/features/vcs/BranchWidget.tsx | 17 +++---
src/features/vcs/CommitChooser.tsx | 4 +-
src/features/vcs/CommitView.tsx | 4 +-
src/features/vcs/CompareBranches.tsx | 4 +-
src/features/vcs/DirectoryCompare.tsx | 5 +-
src/features/vcs/MergeRebaseWidget.module.css | 6 +--
src/features/vcs/RevisionChooser.tsx | 1 -
src/features/vcs/SyncCommitsPopup.tsx | 4 +-
src/features/vcs/TargetBranchInput.tsx | 6 ++-
src/features/vcs/conflictsUi.tsx | 4 +-
src/features/vcs/dialogs.tsx | 1 -
src/features/vcs/log/CommitList.tsx | 15 ++++--
src/features/vcs/log/CommitRow.tsx | 4 +-
src/features/vcs/log/GraphCell.tsx | 10 ++--
src/features/vcs/patches.tsx | 4 +-
src/features/vcs/remoteUi.tsx | 7 ++-
src/styles/tokens.css | 24 +++++++--
src/ui/BarButton.module.css | 8 +--
src/ui/List.tsx | 9 +++-
src/ui/Select.tsx | 1 -
src/ui/Tabs.module.css | 5 +-
src/ui/Tree.tsx | 5 +-
src/ui/density.test.tsx | 54 +++++++++++++++++++
src/ui/density.ts | 27 ++++++++++
src/workbench/MainMenu.tsx | 4 +-
src/workbench/MainToolbarDialog.tsx | 2 -
src/workbench/StatusBar.module.css | 6 ++-
src/workbench/TitleBar.module.css | 15 ++++--
src/workbench/TitleBar.tsx | 7 ++-
src/workbench/inputDialogs.tsx | 2 -
.../toolwindows/ToolWindows.module.css | 6 +++
src/workbench/toolwindows/ToolWindows.tsx | 7 ++-
67 files changed, 356 insertions(+), 118 deletions(-)
create mode 100644 e2e/compactMode.spec.ts
create mode 100644 src/ui/density.test.tsx
create mode 100644 src/ui/density.ts
diff --git a/docs/en/guide/themes.mdx b/docs/en/guide/themes.mdx
index 5e57627e7..4172563c1 100644
--- a/docs/en/guide/themes.mdx
+++ b/docs/en/guide/themes.mdx
@@ -26,7 +26,7 @@ The same page also has:
- **Different tool window background**: set tool windows apart from the editor.
- **Background Image**: an image shown through the project window, with its **Opacity**, **Fill** (scale, original size or tile) and **Anchor**.
- **Accessibility**: **Use contrast scrollbars** and **Adjust colors for red-green vision deficiency** (for protanopia and deuteranopia).
-- **Compact mode** under **UI Options**.
+- **Compact mode** under **UI Options**, also in **View › Appearance**. As in IntelliJ IDEA, it uses shorter tree and list rows, a smaller main toolbar, tool window stripes and status bar, 16px toolbar and stripe icons, and 1px smaller text in the toolbar, status bar, editor tabs and tool window headers.
## Editor color scheme
diff --git a/docs/zh/guide/themes.mdx b/docs/zh/guide/themes.mdx
index 2ec7e51a2..9e65ba18e 100644
--- a/docs/zh/guide/themes.mdx
+++ b/docs/zh/guide/themes.mdx
@@ -26,7 +26,7 @@ description: "选择界面主题和编辑器配色方案,导入 IntelliJ 主
- **不同的工具窗口背景**:让工具窗口与编辑器区分开。
- **背景图像**:透过项目窗口显示的图像,可设置 **不透明度**、**填充**(缩放、原始大小或平铺)和 **位置**。
- **辅助功能**:**使用对比度滚动条** 和 **针对红绿色觉缺陷调整颜色**(适用于红色盲和绿色盲)。
-- **UI 选项** 下的 **紧凑模式**。
+- **UI 选项** 下的 **紧凑模式**,也可在 **视图 › 外观** 中切换。与 IntelliJ IDEA 一致:树和列表的行更矮,主工具栏、工具窗口栏和状态栏更紧凑,工具栏和工具窗口栏图标为 16px,工具栏、状态栏、编辑器标签页和工具窗口标题的文字小 1px。
## 编辑器配色方案
diff --git a/e2e/compactMode.spec.ts b/e2e/compactMode.spec.ts
new file mode 100644
index 000000000..33ebe2bea
--- /dev/null
+++ b/e2e/compactMode.spec.ts
@@ -0,0 +1,48 @@
+import { expect, test } from "./fixtures";
+
+/** Heights IDEA's Islands theme uses in compact mode (`*.compact` keys), against the defaults. */
+const SIZES = {
+ normal: { titleBar: 40, treeRow: 24, stripeIcon: 20, statusBar: 34, runButton: 30 },
+ compact: { titleBar: 32, treeRow: 22, stripeIcon: 16, statusBar: 24, runButton: 26 },
+};
+
+async function measure(page: import("@playwright/test").Page) {
+ return page.evaluate(() => {
+ const height = (selector: string) => document.querySelector(selector)?.getBoundingClientRect().height ?? null;
+ return {
+ titleBar: height("header"),
+ treeRow: height('[role="tree"][aria-label="Project"] [role="treeitem"]'),
+ stripeIcon: height("[data-stripe-button] svg"),
+ statusBar: height('footer[aria-label="Status bar"]'),
+ runButton: height("[data-run-chooser] + * button"),
+ };
+ });
+}
+
+test("Compact Mode shrinks rows, toolbars, stripes and the status bar like IDEA", async ({ workbench: page }, info) => {
+ // Plain-browser mode has no settings backend: set what the toggle action would store.
+ const setCompact = (compactMode: boolean) =>
+ page.evaluate(async (compactMode) => {
+ const projectPath = "/src/platform/project.ts";
+ const { useProject } = await import(/* @vite-ignore */ projectPath);
+ const settings = useProject.getState().settings;
+ useProject.setState({
+ settings: {
+ ...settings,
+ appearance: { ...settings?.appearance, theme: "dark", syncWithOs: false, compactMode },
+ },
+ });
+ }, compactMode);
+
+ await setCompact(false);
+ await expect.poll(() => measure(page)).toEqual(SIZES.normal);
+ await info.attach("normal", { body: await page.screenshot({ animations: "disabled" }), contentType: "image/png" });
+
+ await setCompact(true);
+ await expect(page.locator("html")).toHaveAttribute("data-compact", "");
+ await expect.poll(() => measure(page)).toEqual(SIZES.compact);
+ await info.attach("compact", { body: await page.screenshot({ animations: "disabled" }), contentType: "image/png" });
+
+ await setCompact(false);
+ await expect.poll(() => measure(page)).toEqual(SIZES.normal);
+});
diff --git a/src/features/agents/ImportSessionsDialog.tsx b/src/features/agents/ImportSessionsDialog.tsx
index 20ff9d9b0..74b77d34e 100644
--- a/src/features/agents/ImportSessionsDialog.tsx
+++ b/src/features/agents/ImportSessionsDialog.tsx
@@ -1,6 +1,7 @@
/** Import Sessions from Other Apps: pick sessions a scan found now, and import them as tasks. */
import { useEffect, useId, useMemo, useRef, useState, type KeyboardEvent, type MouseEvent } from "react";
import { Button, Dialog, Icon, List, SearchField, Spinner, T, listNavigate, rowSelectionMode, selectRow } from "@/ui";
+import { useRowHeight } from "@/ui/density";
import { hasPrimaryModifier } from "@/platform/keymap";
import { relativePath, useProject } from "@/platform/project";
import { useTx } from "@/platform/i18n";
@@ -41,6 +42,7 @@ function folderOf(cwd: string | null, root: string | undefined): string {
function ImportSessionsDialog() {
const tx = useTx();
+ const rowHeight = useRowHeight(ROW);
const listId = useId();
const root = useProject((s) => s.project?.root);
const external = useAgents((s) => s.external);
@@ -216,7 +218,7 @@ function ImportSessionsDialog() {
activeIndex={lead}
onSelect={select}
isSelected={(r) => !!sel.keys?.has(r.key)}
- rowHeight={ROW}
+ rowHeight={rowHeight}
aria-label={tx("Sessions from other apps")}
empty={
diff --git a/src/features/build-tools/ExecutePopup.tsx b/src/features/build-tools/ExecutePopup.tsx
index fbac2b5cd..f4ce3716e 100644
--- a/src/features/build-tools/ExecutePopup.tsx
+++ b/src/features/build-tools/ExecutePopup.tsx
@@ -176,7 +176,6 @@ function ExecutePopup({ tool }: { tool: BuildTool }) {
}}
focusable={false}
hoverSelects={false}
- rowHeight={24}
sectionHeight={28}
className={styles.completions}
aria-label="Completions"
diff --git a/src/features/code-insight/UsagesPopup.tsx b/src/features/code-insight/UsagesPopup.tsx
index 3a5fee831..cf1ec02b7 100644
--- a/src/features/code-insight/UsagesPopup.tsx
+++ b/src/features/code-insight/UsagesPopup.tsx
@@ -12,6 +12,7 @@ import { codePreviewExtensions } from "@/editor/api";
import { basename } from "@/platform/project";
import { shortcutLabel } from "@/platform/keymap";
import { Icon, IconButton, List, Popup, Select, Spinner, fileIconName, listNavigate } from "@/ui";
+import { useRowHeight } from "@/ui/density";
import { openLocation, readFileLines } from "./ipc";
import {
dismissUsagesPopup,
@@ -83,6 +84,7 @@ const ROW = 24;
function UsagesPopupInner() {
const { anchor, symbol, groups, note, loading, scope } = useUsagesPopup();
const preview = useUsagesPopupPreview((s) => s.preview);
+ const rowHeight = useRowHeight(ROW);
const all = useMemo
(() => groups.flatMap((g) => g.usages), [groups]);
const [filter, setFilter] = useState("");
const accessOptions = useUsageAccessOptions();
@@ -210,7 +212,7 @@ function UsagesPopupInner() {
)}
void;
onClose: () => void;
}) {
+ const rowHeight = useRowHeight(22);
const [query, setQuery] = useState("");
const [active, setActive] = useState(0);
const shown = filterColumns(props.columns, query);
@@ -72,7 +74,7 @@ export function ColumnsPopup(props: {
onActivate={(_, i) => pick(i)}
focusable={false}
hoverSelects
- rowHeight={22}
+ rowHeight={rowHeight}
aria-label={tx("Columns")}
className={styles.columnsList}
empty={{tx("No matching columns")}}
diff --git a/src/features/database/Grid.test.tsx b/src/features/database/Grid.test.tsx
index 3615906f3..50585a2ba 100644
--- a/src/features/database/Grid.test.tsx
+++ b/src/features/database/Grid.test.tsx
@@ -30,6 +30,7 @@ vi.mock("@tanstack/react-virtual", () => ({
getTotalSize: () => count * 24,
getVirtualItems: () => Array.from({ length: count }, (_, index) => ({ index, start: index * 24, key: index })),
scrollToIndex: () => {},
+ measure: () => {},
}),
}));
diff --git a/src/features/debugger/heap/HeapClasses.tsx b/src/features/debugger/heap/HeapClasses.tsx
index d99cf385c..046d9e951 100644
--- a/src/features/debugger/heap/HeapClasses.tsx
+++ b/src/features/debugger/heap/HeapClasses.tsx
@@ -14,6 +14,7 @@ import {
type ClassSort,
} from "./editor/classRows";
import styles from "./HeapSnapshotEditor.module.css";
+import { useRowHeight } from "@/ui/density";
const COLUMNS: ReadonlyArray<{ key: ClassSort; label: string; numeric: boolean; diff?: boolean }> = [
{ key: "name", label: "Class", numeric: false },
@@ -66,6 +67,7 @@ export function HeapClasses({
selected: number | null;
onSelect: (row: HeapClassRow | null) => void;
}) {
+ const rowHeight = useRowHeight(22);
const tx = useTx();
const [query, setQuery] = useState(DEFAULT_CLASS_QUERY);
const compared = changes !== null;
@@ -124,7 +126,7 @@ export function HeapClasses({
renderItem={(r) => }
activeIndex={selected === null ? -1 : rows.findIndex((r) => r.classIndex === selected)}
onActiveChange={(i) => onSelect(rows[i] ?? null)}
- rowHeight={22}
+ rowHeight={rowHeight}
tableBody={{ headerRows: 1 }}
empty={{tx("No matches")}}
/>
diff --git a/src/features/debugger/heap/editor/BiggestObjects.tsx b/src/features/debugger/heap/editor/BiggestObjects.tsx
index 7c92362b5..6f1a0dcbd 100644
--- a/src/features/debugger/heap/editor/BiggestObjects.tsx
+++ b/src/features/debugger/heap/editor/BiggestObjects.tsx
@@ -6,6 +6,7 @@ import { formatBytes } from "../../memory/rows";
import { useHeapQuery } from "./heapQuery";
import { ObjectText } from "./ObjectText";
import styles from "../HeapSnapshotEditor.module.css";
+import { useRowHeight } from "@/ui/density";
const LIMIT = 100;
@@ -21,6 +22,7 @@ export function BiggestObjects({
selected: number | null;
onSelect: (object: HeapObjectRow) => void;
}) {
+ const rowHeight = useRowHeight(22);
const tx = useTx();
const page = useHeapQuery(`${snapshot}:${cls.classIndex}`, () =>
call(commands.debugHeapDominators(snapshot, null, cls.classIndex, 0, LIMIT)),
@@ -70,7 +72,7 @@ export function BiggestObjects({
)}
activeIndex={selected === null ? -1 : rows.findIndex((o) => o.object === selected)}
onActiveChange={(i) => rows[i] && onSelect(rows[i])}
- rowHeight={22}
+ rowHeight={rowHeight}
tableBody={{ headerRows: 1 }}
/>
diff --git a/src/features/debugger/memory/MemoryView.tsx b/src/features/debugger/memory/MemoryView.tsx
index 62ae0238f..5a15421a2 100644
--- a/src/features/debugger/memory/MemoryView.tsx
+++ b/src/features/debugger/memory/MemoryView.tsx
@@ -24,6 +24,7 @@ import { keepKeysOnButton } from "./rowButtonKeys";
import { columnsOf, formatBytes, formatCount, formatDelta, queryFor, visibleRows, type SortKey } from "./rows";
import { unavailableText } from "./unavailableText";
import styles from "./MemoryView.module.css";
+import { useRowHeight } from "@/ui/density";
const COLUMNS: ReadonlyArray<{ key: SortKey; label: string; numeric: boolean }> = [
{ key: "name", label: "Class", numeric: false },
@@ -105,6 +106,7 @@ function ClassRow({
}
export function MemoryView({ session }: { session: DebugSession }) {
+ const rowHeight = useRowHeight(22);
// Also re-renders the reason text, which reads the catalog when called.
const tx = useTx();
const id = session.id;
@@ -248,7 +250,7 @@ export function MemoryView({ session }: { session: DebugSession }) {
onActivate={(r, _i, e) => {
if (e.type === "keydown" && listsInstances && paused) showInstancesOf(r.name);
}}
- rowHeight={22}
+ rowHeight={rowHeight}
tableBody={{ headerRows: 1 }}
empty={{tx("No matches")}}
/>
diff --git a/src/features/github/clone/GitHubCloneSource.tsx b/src/features/github/clone/GitHubCloneSource.tsx
index 81844e866..1bec8493f 100644
--- a/src/features/github/clone/GitHubCloneSource.tsx
+++ b/src/features/github/clone/GitHubCloneSource.tsx
@@ -18,6 +18,7 @@ import {
import type { CloneSourceProps } from "@/workbench/contributions";
import { openInBrowser } from "../data/local";
import styles from "./GitHubCloneSource.module.css";
+import { useRowHeight } from "@/ui/density";
type Row = { repo: GhAccountRepo; indices: number[] | null };
@@ -32,6 +33,7 @@ export function matchRepos(repos: readonly GhAccountRepo[], query: string): Row[
}
export function GitHubCloneSource({ url, onUrl, onClone, disabled }: CloneSourceProps) {
+ const rowHeight = useRowHeight(26);
const [state, setState] = useState(null);
const [query, setQuery] = useState("");
const [attempt, setAttempt] = useState(0);
@@ -140,7 +142,7 @@ export function GitHubCloneSource({ url, onUrl, onClone, disabled }: CloneSource
activeIndex={active}
onActiveChange={pick}
focusable={false}
- rowHeight={26}
+ rowHeight={rowHeight}
empty={
{state.repos.length ? "No matching repositories" : "No repositories"}
diff --git a/src/features/github/create/ChangesPanel.tsx b/src/features/github/create/ChangesPanel.tsx
index a1b2e3212..e657be580 100644
--- a/src/features/github/create/ChangesPanel.tsx
+++ b/src/features/github/create/ChangesPanel.tsx
@@ -16,6 +16,7 @@ import { prettyDate } from "../ui/prettyDate";
import { commitDescription } from "./model";
import { selectCommit, useCreatePr, type CreateChange } from "./store";
import styles from "./Create.module.css";
+import { useRowHeight } from "@/ui/density";
function Centered({ children, error }: { children: ReactNode; error?: boolean }) {
return {children}
;
@@ -170,6 +171,7 @@ function showDiff(all: readonly CreateChange[], first: CreateChange) {
}
function ChangesTree() {
+ const rowHeight = useRowHeight(22);
const changes = useCreatePr((s) => s.changes);
const files = changes?.state === "ok" ? changes.value : null;
const roots = useMemo(() => (files ? buildFileTree(files, (f) => f.path) : []), [files]);
@@ -219,7 +221,7 @@ function ChangesTree() {
selected={selection}
onSelectionChange={setSelection}
multiSelect
- rowHeight={22}
+ rowHeight={rowHeight}
aria-label="Changes"
speedSearch
onActivate={(n) => n.file && showDiff(ordered, n.file)}
diff --git a/src/features/github/create/DirectionSelector.tsx b/src/features/github/create/DirectionSelector.tsx
index 275dd37d0..490dbbcbf 100644
--- a/src/features/github/create/DirectionSelector.tsx
+++ b/src/features/github/create/DirectionSelector.tsx
@@ -178,7 +178,6 @@ function HeadPopup(props: { anchor: HTMLElement; initialRepo: GHRemote; onClose:
onActivate={(r) => choose(r)}
focusable={false}
hoverSelects
- rowHeight={24}
className={styles.headList}
aria-label="Branches"
empty={{tx("Nothing to show")}
}
diff --git a/src/features/github/details/BranchWidget.tsx b/src/features/github/details/BranchWidget.tsx
index 77d9faa69..551b0fca2 100644
--- a/src/features/github/details/BranchWidget.tsx
+++ b/src/features/github/details/BranchWidget.tsx
@@ -78,7 +78,6 @@ export function BranchWidget({
getKey={(a) => a}
onActivate={(a) => run(a)}
hoverSelects
- rowHeight={24}
aria-label={tx("Branches")}
renderItem={(a, state) => (
diff --git a/src/features/macros/MacrosDialog.tsx b/src/features/macros/MacrosDialog.tsx
index 17e2f9a42..6842a82d2 100644
--- a/src/features/macros/MacrosDialog.tsx
+++ b/src/features/macros/MacrosDialog.tsx
@@ -86,7 +86,6 @@ function EditMacrosDialog({ onClose }: { onClose: () => void }) {
getKey={(m) => m.name}
activeIndex={Math.min(active, saved.length - 1)}
onActiveChange={setActive}
- rowHeight={24}
className={styles.list}
aria-label="Macros"
empty={
diff --git a/src/features/project-tree/NewPopup.tsx b/src/features/project-tree/NewPopup.tsx
index 38167c9b3..4d0e85238 100644
--- a/src/features/project-tree/NewPopup.tsx
+++ b/src/features/project-tree/NewPopup.tsx
@@ -79,7 +79,6 @@ function NewPopup({ at, items }: { at: { x: number; y: number }; items: MenuItem
onActivate={(r) => pick(r)}
focusable={false}
hoverSelects
- rowHeight={24}
className={styles.list}
aria-label="File types"
empty={
diff --git a/src/features/run-anything/RunAnything.tsx b/src/features/run-anything/RunAnything.tsx
index aeec1dae7..ecbab5803 100644
--- a/src/features/run-anything/RunAnything.tsx
+++ b/src/features/run-anything/RunAnything.tsx
@@ -149,7 +149,6 @@ function RunAnythingPopup({ root }: { root: string }) {
onActivate={(r) => run(r)}
focusable={false}
hoverSelects={false}
- rowHeight={24}
className={styles.rows}
aria-label="Run Anything entries"
empty={
diff --git a/src/features/run/AddConfigPopup.tsx b/src/features/run/AddConfigPopup.tsx
index d26da2316..6eed4fd1d 100644
--- a/src/features/run/AddConfigPopup.tsx
+++ b/src/features/run/AddConfigPopup.tsx
@@ -1,6 +1,7 @@
import { useMemo, useState, type KeyboardEvent } from "react";
import clsx from "clsx";
import { HighlightedText, Icon, List, Popup, SearchField, fuzzyMatch, listNavigate, T, type PopupAnchor } from "@/ui";
+import { useRowHeight } from "@/ui/density";
import { useRunConfigTypes, runConfigTypes, type RunConfigTypeContribution } from "@/workbench/contributions";
import styles from "./Run.module.css";
@@ -59,6 +60,7 @@ export function AddConfigPopup({
onClose: () => void;
}) {
const types = useRunConfigTypes((s) => s.types);
+ const rowHeight = useRowHeight(ROW);
const [query, setQuery] = useState("");
const rows = useMemo(() => typeRows(runConfigTypes(types), query), [types, query]);
const isSection = (r: TypeRow) => r.kind === "group";
@@ -115,7 +117,7 @@ export function AddConfigPopup({
variant="bare"
/>
-
+
aria-label="Configuration types"
className={styles.chooserList}
@@ -127,7 +129,7 @@ export function AddConfigPopup({
onActiveChange={setActive}
focusable={false}
hoverSelects
- rowHeight={ROW}
+ rowHeight={rowHeight}
onActivate={(r) => pick(r)}
empty={
diff --git a/src/features/run/ConfigChooser.tsx b/src/features/run/ConfigChooser.tsx
index 4c8cf1833..038900719 100644
--- a/src/features/run/ConfigChooser.tsx
+++ b/src/features/run/ConfigChooser.tsx
@@ -16,6 +16,7 @@ import {
T,
type MenuItem,
} from "@/ui";
+import { useRowHeight } from "@/ui/density";
import type { RunConfig } from "@/platform/ipc";
import { useWorkflowSettings } from "@/platform/workflowSettings";
import { useDebugRunSessions } from "@/workbench/contributions";
@@ -99,7 +100,7 @@ export function buildRows(
return rows;
}
-const rowHeight = (r: Row) => (r.type === "section" && !r.label ? SEPARATOR : ROW);
+const heightOf = (r: Row, rowHeight: number) => (r.type === "section" && !r.label ? SEPARATOR : rowHeight);
let closedAt = 0;
/** The chooser closed within the last moment (a click on its own anchor shouldn't reopen it). */
@@ -145,6 +146,7 @@ export function mnemonics(rows: readonly Row[]): Map {
function ConfigChooser() {
const mode = useRun((s) => s.chooserMode);
+ const rowHeight = useRowHeight(ROW);
const configs = useRun((s) => s.configs);
const selectedId = useRun((s) => s.selectedId);
const temporary = useRun((s) => s.temporary);
@@ -285,8 +287,8 @@ function ConfigChooser() {
};
const height = Math.min(
- rows.reduce((sum, r) => sum + rowHeight(r), 0),
- 14 * ROW,
+ rows.reduce((sum, r) => sum + heightOf(r, rowHeight), 0),
+ 14 * rowHeight,
);
// IDEA: a configuration's submenu lists its executors, then Edit and Pin.
@@ -366,7 +368,7 @@ function ConfigChooser() {
onActiveChange={setActive}
focusable={false}
hoverSelects
- rowHeight={ROW}
+ rowHeight={rowHeight}
onActivate={(r) => activate(r)}
renderItem={(r, { active: isActive }) => {
if (r.type === "save") {
diff --git a/src/features/run/Run.module.css b/src/features/run/Run.module.css
index b330f6e3e..113d36018 100644
--- a/src/features/run/Run.module.css
+++ b/src/features/run/Run.module.css
@@ -338,17 +338,17 @@
align-items: center;
gap: var(--space-1);
max-width: 260px;
- height: 30px;
- border-radius: 6px;
+ height: var(--h-toolbar-widget);
+ border-radius: var(--radius-toolbar-dropdown);
}
.widgetDevice {
composes: widgetChooser;
max-width: 180px;
}
.widgetButton {
- width: 30px;
- height: 30px;
- border-radius: 6px;
+ width: var(--titlebar-tool-button);
+ height: var(--titlebar-tool-button);
+ border-radius: var(--radius-toolbar-button);
}
.widgetLoading {
display: inline-flex;
diff --git a/src/features/run/RunWidget.tsx b/src/features/run/RunWidget.tsx
index f8dc1a364..05e1a50f3 100644
--- a/src/features/run/RunWidget.tsx
+++ b/src/features/run/RunWidget.tsx
@@ -12,9 +12,11 @@ import { CURRENT_FILE, useRun, isLive } from "./store";
import { compoundTargets, selectedTarget } from "./sessionTargets";
import { isDebugOnly } from "./types";
import styles from "./Run.module.css";
+import { useChromeIconSize } from "@/ui/density";
/** Title bar: configuration chooser, Run / Debug, and Rerun / Stop while running. */
export function RunWidget() {
+ const iconSize = useChromeIconSize();
const tx = useTx();
const label = useRemoteLabel();
const configs = useRun((s) => s.configs);
@@ -92,20 +94,20 @@ export function RunWidget() {
)}
-
+
{!debugging && (
pick(r)}
focusable={false}
hoverSelects
- rowHeight={24}
className={styles.list}
aria-label="Languages"
empty={
diff --git a/src/features/search/bookmarks/BookmarkPopups.tsx b/src/features/search/bookmarks/BookmarkPopups.tsx
index f30b1c1f0..52ad86f56 100644
--- a/src/features/search/bookmarks/BookmarkPopups.tsx
+++ b/src/features/search/bookmarks/BookmarkPopups.tsx
@@ -29,6 +29,7 @@ import {
type PathBookmark,
} from "./store";
import styles from "./BookmarkPopups.module.css";
+import { useRowHeight } from "@/ui/density";
export function BookmarkPopupsOverlay() {
const chooser = useBookmarkPopups((s) => s.chooser);
@@ -186,6 +187,7 @@ export function bookmarkRows(
const isSectionRow = (r: Row) => r.kind === "file" || r.kind === "list";
function BookmarksPopup() {
+ const rowHeight = useRowHeight(22);
const items = useBookmarks((s) => s.items);
const paths = useBookmarks((s) => s.paths);
const lists = useBookmarks((s) => s.lists);
@@ -247,8 +249,7 @@ function BookmarksPopup() {
jump(r);
}}
aria-label="Bookmarks"
- rowHeight={22}
- sectionHeight={24}
+ rowHeight={rowHeight}
empty={{items.length || paths.length ? null : No bookmarks}}
renderSection={(r) =>
r.kind === "file" ? (
diff --git a/src/features/search/everywhere/SearchEverywhere.tsx b/src/features/search/everywhere/SearchEverywhere.tsx
index ee507a951..8c9c06f0b 100644
--- a/src/features/search/everywhere/SearchEverywhere.tsx
+++ b/src/features/search/everywhere/SearchEverywhere.tsx
@@ -1,6 +1,7 @@
import { writeClipboardText } from "@/platform/clipboard";
import { onSearchCategoriesChanged, onEndpointsChanged } from "@/workbench/contributions";
import { useFilePresentation } from "@/ui/filePresentation";
+import { useRowHeight } from "@/ui/density";
import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type MouseEvent } from "react";
import clsx from "clsx";
import { actionToggled, executeAction, executeActionFrom, getAction } from "@/platform/actions";
@@ -87,7 +88,7 @@ export function claimSearchKeys(input: () => HTMLElement | null): () => void {
return registerKeyClaim((e) => e.target === input() && SEARCH_KEYS.has(e.key));
}
const ROW = 24;
-const MIN_LIST = 10 * ROW;
+const MIN_LIST_ROWS = 10;
const DEBOUNCE_MS = 60;
export function SearchEverywhereOverlay() {
@@ -100,6 +101,7 @@ const INITIAL_SELECTION: Selection = { key: null, anchorKey: null, lead: -1, anc
function SearchEverywhereDialog() {
const tx = useTx();
+ const rowHeight = useRowHeight(ROW);
const tab = useSearchEverywhere((s) => s.tab);
const hint = hintFor(tab, tx);
const [tabs, setTabs] = useState(searchTabs);
@@ -472,8 +474,8 @@ function SearchEverywhereDialog() {
};
// While a query is typed the list keeps a minimum height so the popup doesn't jump with every keystroke.
- const minList = parsed.text.trim() && !listing ? MIN_LIST : 0;
- const listHeight = Math.max(minList, rows.length * ROW);
+ const minList = parsed.text.trim() && !listing ? MIN_LIST_ROWS * rowHeight : 0;
+ const listHeight = Math.max(minList, rows.length * rowHeight);
const previewTarget = previewOf(activeRow);
const emptyQuery = !parsed.text.trim();
const showEmpty = !rows.length && snap && !snap.loading && (!emptyQuery || tab !== "all");
@@ -521,8 +523,8 @@ function SearchEverywhereDialog() {
isSelected={(r) => !!sel.keys?.has(r.key)}
onActivate={(r, _i, e) => activate(r, (e as MouseEvent).shiftKey)}
focusable={false}
- rowHeight={ROW}
- sectionHeight={ROW}
+ rowHeight={rowHeight}
+ sectionHeight={rowHeight}
className={styles.list}
aria-label={tx("Results")}
renderItem={(r, state) => (
diff --git a/src/features/search/find/FindInFiles.tsx b/src/features/search/find/FindInFiles.tsx
index 9cb96adb5..e7c36a4b5 100644
--- a/src/features/search/find/FindInFiles.tsx
+++ b/src/features/search/find/FindInFiles.tsx
@@ -37,6 +37,7 @@ import {
type MenuItem,
T,
} from "@/ui";
+import { useRowHeight } from "@/ui/density";
import { maybeEditorService, notifications } from "@/workbench/contributions";
import { confirm } from "@/workbench/messages";
import { basename, dirname, openLocation } from "../common/open";
@@ -144,6 +145,7 @@ function displayDirectory(dir: string, root: string | null): string {
function FindInFilesDialog() {
const s = useFindPopup();
+ const rowHeight = useRowHeight(ROW);
const txt = useTxTemplate();
const project = useProject((p) => p.project);
const root = project?.workspace?.projects[0] ?? (project?.workspace ? null : (project?.root ?? null));
@@ -591,7 +593,7 @@ function FindInFilesDialog() {
openRow(r, e.shiftKey);
}}
focusable={false}
- rowHeight={ROW}
+ rowHeight={rowHeight}
aria-label="Matches"
empty={
query ? (
@@ -864,7 +866,7 @@ function FindInFilesDialog() {
{rows.length ? (