The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(debugger): keep multi-line values on their row in the variables tree (#1196)
l0ng-aia61098265503
diff --git a/src/features/debugger/__tests__/toolWindow.test.tsx b/src/features/debugger/__tests__/toolWindow.test.tsxindex 415ccdea2..214484166 100644--- a/src/features/debugger/__tests__/toolWindow.test.tsx+++ b/src/features/debugger/__tests__/toolWindow.test.tsx@@ -13,6 +13,13 @@ vi.mock("@/platform/ipc", async (importOriginal) => {ok([{ name: "count", value: "3", typeName: "int", variablesReference: 0, evaluateName: "count" },{ name: "label", value: "'hi'", typeName: "str", variablesReference: 0, evaluateName: "label" },+ {+ name: "bar",+ value: "high 7.86\nlow 7.66\nName: 772, dtype: object",+ typeName: "Series",+ variablesReference: 0,+ evaluateName: "bar",+ },]),},};@@ -72,5 +79,7 @@ describe("debug tool window", () => {expect(screen.getByPlaceholderText("Evaluate expression (↩) or add a watch (⇧⌘↩)")).toBeTruthy();expect(await screen.findByText("{int}")).toBeTruthy();expect(screen.getByText("'hi'")).toBeTruthy();+ // A multi-line rendering stays on its row.+ expect(screen.getByText(/dtype: object/).textContent).toBe("high 7.86 low 7.66 Name: 772, dtype: object");});});diff --git a/src/features/debugger/ui/VariablesView.tsx b/src/features/debugger/ui/VariablesView.tsxindex b073a2b4f..ae54b1cad 100644--- a/src/features/debugger/ui/VariablesView.tsx+++ b/src/features/debugger/ui/VariablesView.tsx@@ -9,7 +9,7 @@ import { addFieldWatchpoint } from "../breakpoints/special";import { methodAt } from "../breakpoints/symbols";import { activeSession, addWatch, removeWatch, revealFrame, sessionSupports, setVariableValue } from "../state";import { blurDebugView, focusDebugView } from "./focusedView";-import { classifyValue, sortVariables } from "../values";+import { classifyValue, oneLine, sortVariables } from "../values";import { workflowSettings } from "@/platform/workflowSettings";import styles from "./VariablesView.module.css";@@ -428,11 +428,11 @@ function VarRow({ node, changed }: { node: VarNode; changed: boolean }) {</span><span className={styles.eq}>=</span>{node.error ? (- <span className={styles.error}>{node.error}</span>+ <span className={styles.error}>{oneLine(node.error)}</span>) : (<>{node.typeName && <span className={styles.type}>{`{${node.typeName}}`}</span>}- <span className={clsx(styles.value, kind && styles[kind])}>{node.value}</span>+ <span className={clsx(styles.value, kind && styles[kind])}>{oneLine(node.value)}</span></>)}</span>diff --git a/src/features/debugger/values.ts b/src/features/debugger/values.tsindex 86d02c8f2..d983a87f7 100644--- a/src/features/debugger/values.ts+++ b/src/features/debugger/values.ts@@ -33,9 +33,14 @@ export function classifyValue(value: string, typeName?: string | null): ValueKinreturn "plain";}+/** The value on one line: a multi-line rendering (a pandas Series, a pretty-printed object) joined with spaces. */+export function oneLine(value: string): string {+ return value.replace(/\s*\n\s*/g, " ");+}+/** Single-line, length-limited value for inline display. */export function inlineValue(value: string, max = 60): string {- const flat = value.replace(/\s*\n\s*/g, " ");+ const flat = oneLine(value);return flat.length > max ? flat.slice(0, max - 1) + "…" : flat;}