From c871c164c1db0a653fabae227a9df73e7bd5b372 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Mon, 16 Nov 2026 18:40:53 +0800 Subject: [PATCH] fix(ui): editor hints and balloons stay inside the window (#3738) An editor hint is the tooltip element itself, so the editor theme's .cm-tooltip max-width (same specificity, loaded later) replaced its 480 px limit and long messages ran past the window edge; the limit now applies to .cm-tooltip.cm-lsp-hint. The balloon stack keeps 16 px from the left as well and balloons narrow to fit, so they are no longer cut off in a narrow window. --- src/editor/lsp/theme.ts | 3 ++- src/ui/Feedback.module.css | 1 + src/workbench/Notifications.module.css | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/editor/lsp/theme.ts b/src/editor/lsp/theme.ts index c550a607b..bf8ddac9d 100644 --- a/src/editor/lsp/theme.ts +++ b/src/editor/lsp/theme.ts @@ -295,9 +295,10 @@ export const lspTheme = EditorView.theme({ padding: "6px 10px", borderRadius: "var(--radius-popup)", boxShadow: "var(--shadow-popup)", - maxWidth: "480px", whiteSpace: "pre-wrap", }, + // The hint is the tooltip element itself: beat the editor theme's `.cm-tooltip` width. + ".cm-tooltip.cm-lsp-hint": { maxWidth: "min(480px, 100%)" }, ".cm-lsp-hint-error": { backgroundColor: "var(--bg-feedback-error, color-mix(in srgb, var(--danger) 8%, var(--bg-popup)))", borderColor: "color-mix(in srgb, var(--danger) 35%, var(--border-popup))", diff --git a/src/ui/Feedback.module.css b/src/ui/Feedback.module.css index e0e356210..8b10dddd0 100644 --- a/src/ui/Feedback.module.css +++ b/src/ui/Feedback.module.css @@ -105,6 +105,7 @@ display: flex; gap: 10px; width: 340px; + max-width: 100%; /* Never grow past the window: the close button must stay reachable. */ max-height: calc(100vh - 48px); padding: 14px 34px 14px 14px; diff --git a/src/workbench/Notifications.module.css b/src/workbench/Notifications.module.css index 93a6ee031..db5585e2d 100644 --- a/src/workbench/Notifications.module.css +++ b/src/workbench/Notifications.module.css @@ -2,6 +2,8 @@ position: fixed; /* Inside the editor island's bottom-right corner, clear of the right stripe. */ right: 78px; + /* A narrow window narrows the balloons instead of pushing them off its left edge. */ + left: 16px; bottom: calc(var(--h-statusbar) + 16px); /* Balloons belong to the main window: modal dialogs cover them, like IDEA. */ z-index: calc(var(--z-dialog) - 1); @@ -12,6 +14,7 @@ pointer-events: none; } .balloon { + max-width: 100%; pointer-events: auto; animation: slideIn var(--dur) var(--ease); }