Skip to content

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.

813 B
Raw Blame
/** The expanded value hint: an object under the mouse as a variables tree (as IDEA). */
import { createRoot } from "react-dom/client";
import type { DebugSessionId, Variable } from "@/platform/ipc";
import { VariablesView } from "./VariablesView";
import styles from "./VariablesView.module.css";

export function mountValueTree(host: HTMLElement, expression: string, variable: Variable, session: DebugSessionId) {
  const root = createRoot(host);
  root.render(
    <div className={styles.hint}>
      <VariablesView
        roots={[{ key: "hint", kind: "eval", name: expression, variable, error: null }]}
        session={session}
        defaultExpanded={["hint"]}
        autoFocus
        aria-label={expression}
      />
    </div>,
  );
  return { unmount: () => queueMicrotask(() => root.unmount()) };
}