Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: editor chips and menu theme

ogsamrat86c796f19b85
diff --git a/apps/app/src/app/themes/editor-themes.ts b/apps/app/src/app/themes/editor-themes.ts
index 27733749..adc0ec85 100644
--- a/apps/app/src/app/themes/editor-themes.ts
+++ b/apps/app/src/app/themes/editor-themes.ts
@@ -22,6 +22,26 @@ export type MonacoThemeData = {
colors: Record<string, string>;
};
+/** Monaco's own menus and widgets (right-click menu, hover, suggest, peek) in the theme's surfaces. */
+function widgetColours(w: { surface: string; text: string; border: string; selection: string; accent: string; peekEditor: string; peekList: string }): Record<string, string> {
+ return {
+ "menu.background": w.surface,
+ "menu.foreground": w.text,
+ "menu.selectionBackground": w.selection,
+ "menu.selectionForeground": w.text,
+ "menu.separatorBackground": w.border,
+ "menu.border": w.border,
+ "editorHoverWidget.background": w.surface,
+ "editorHoverWidget.border": w.border,
+ "editorSuggestWidget.background": w.surface,
+ "editorSuggestWidget.border": w.border,
+ "peekView.border": w.accent,
+ "peekViewEditor.background": w.peekEditor,
+ "peekViewResult.background": w.peekList,
+ "peekViewTitle.background": w.peekList,
+ };
+}
+
/** Today's editor look (Default preset): background/foreground from the app stylesheet. */
export function legacyMonacoTheme(dark: boolean, background: string, foreground: string): MonacoThemeData {
return {
@@ -44,6 +64,15 @@ export function legacyMonacoTheme(dark: boolean, background: string, foreground:
"diffEditor.removedTextBackground": dark ? "#ff959233" : "#e5484d33",
"scrollbarSlider.background": dark ? "#ffffff1a" : "#0000001a",
"scrollbarSlider.hoverBackground": dark ? "#ffffff29" : "#00000029",
+ ...widgetColours({
+ surface: dark ? "#18191b" : "#ffffff",
+ text: dark ? "#edeef0" : "#1c2024",
+ border: dark ? "#2e3135" : "#e0e1e6",
+ selection: dark ? "#2e3135" : "#f0f0f3",
+ accent: dark ? "#3b9eff" : "#0090ff",
+ peekEditor: dark ? "#111113" : "#f9fbff",
+ peekList: dark ? "#18191b" : "#f9f9fb",
+ }),
},
};
}
@@ -110,6 +139,15 @@ export function monacoThemeFor(active: Pick<ActiveTheme, "variant" | "mode">): M
"diffEditor.removedTextBackground": alpha(v.danger, "33"),
"scrollbarSlider.background": alpha(c.fg, "1a"),
"scrollbarSlider.hoverBackground": alpha(c.fg, "29"),
+ ...widgetColours({
+ surface: v.surfaceRaised,
+ text: v.text,
+ border: v.border,
+ selection: mix(v.surfaceRaised, v.text, 0.1),
+ accent: v.accent,
+ peekEditor: c.bg,
+ peekList: v.surface,
+ }),
},
};
}
diff --git a/apps/app/src/react-app/domains/session/surface/composer/editor.tsx b/apps/app/src/react-app/domains/session/surface/composer/editor.tsx
index 66e9cb58..4010d3ce 100644
--- a/apps/app/src/react-app/domains/session/surface/composer/editor.tsx
+++ b/apps/app/src/react-app/domains/session/surface/composer/editor.tsx
@@ -330,8 +330,10 @@ function $createComposerSkillNode(skillName: string, skillToken?: string) {
return $applyNodeReplacement(new ComposerSkillNode(skillName, skillToken));
}
-function pastedTextChipLabel(lines: number) {
- return `Pasted · ${lines} line${lines === 1 ? "" : "s"}`;
+/** A paste shows "Pasted · N lines"; a chip from the code editor shows its own label ("orders.ts L4–6 · selection"). */
+function pastedTextChipLabel(label: string, lines: number) {
+ if (/^[a-z0-9]{1,8} · \d+ lines?$/.test(label)) return `Pasted · ${lines} line${lines === 1 ? "" : "s"}`;
+ return label;
}
function createPastedTextChipDom(label: string, lines: number) {
@@ -342,7 +344,7 @@ function createPastedTextChipDom(label: string, lines: number) {
dom.title = `Pasted text · ${label}`;
const text = document.createElement("span");
- text.textContent = pastedTextChipLabel(lines);
+ text.textContent = pastedTextChipLabel(label, lines);
const button = document.createElement("button");
button.type = "button";
@@ -373,7 +375,7 @@ function createPastedTextChipDom(label: string, lines: number) {
function updatePastedTextChipDom(dom: HTMLElement, label: string, lines: number) {
const text = dom.firstElementChild;
- if (text) text.textContent = pastedTextChipLabel(lines);
+ if (text) text.textContent = pastedTextChipLabel(label, lines);
const button = dom.querySelector("button[data-pasted-expand-label]");
if (button instanceof HTMLButtonElement) {
button.title = "Expand";