Files
openidea/src/features/run/TerminalConsole.tsx
T
l0ng-ai 1e00ea5ee2 feat: Third pass aligning core experience with IntelliJ IDEA
Project & files
- Project view modes (Project Files / Open Files / All Changed Files /
  Scratches); External Libraries for Python, JDK (src.zip), Node, Cargo, Go,
  Maven/Gradle jars; read-only jar/zip browsing
- ⌘N New popup with type search and more file kinds; New Project, Rename
  Project, Reload All from Disk, Export/Import Settings, Power Save Mode
- File type associations, extra content roots and exclude patterns (indexed
  and watched without reopening the project)

Editor & navigation
- Find bar: search scope (comments/strings), Preserve Case, Exclude, multiline,
  history; Find in Files: Module scope, custom pattern scopes, multiline
- Search Everywhere filters, Assign Shortcut, settings results; named bookmark
  lists, file/folder bookmarks; Structure filters and Show Inherited; Recent
  Locations timestamps and breadcrumbs; Code Vision author
- Completion options, editor tab placement/layout, inline completion (LSP 3.18)
- Spell checking (Typo inspection, ide-spell) and Inspections settings with
  custom profiles; Code Style schemes, formatter markers, Do not format

Run, VCS, services, database
- Typed run configurations (Shell, Program, npm, Gradle, Maven, Docker,
  Compound), Modify options, Before launch, env dialog, Current File,
  Emulate terminal (PTY)
- Git log graph/view options, Go to Hash/Branch/Tag, date filter keeps the
  graph; Pull/Merge/Rebase dialogs, Manage Remotes, Worktrees
- Generic Services host (Docker connections/registries, run sessions); TODO
  scope/changes tabs with changelists; Coverage report import
- Data sources: wire-compatible vendors, URL import, SSL certs, Options,
  Schemas and Advanced tabs, color and comment

Workbench
- Run Anything, Customize Main Toolbar, named tool window layouts, menu
  completeness, Code Cleanup, macros, "Don't Show Again", editor banners
- Chinese translations for the new UI

Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
2026-10-25 21:24:00 +08:00

67 lines
1.8 KiB
TypeScript

/**
* The Run console of a configuration with "Emulate terminal in output console":
* the terminal widget (provided by the terminal feature) shows the raw output
* and sends keystrokes and its size to the process.
*/
import { useEffect, useRef } from "react";
import { T } from "@/ui";
import { embeddedTerminal } from "@/workbench/contributions";
import type { TerminalOutput } from "./terminalOutput";
import styles from "./Run.module.css";
export function TerminalConsole({
output,
cwd,
onData,
onResize,
"aria-label": ariaLabel,
}: {
output: TerminalOutput;
cwd: string;
onData: (data: string) => void;
onResize: (cols: number, rows: number) => void;
"aria-label": string;
}) {
const host = useRef<HTMLDivElement>(null);
const handlers = useRef({ onData, onResize });
useEffect(() => {
handlers.current = { onData, onResize };
});
const factory = embeddedTerminal();
useEffect(() => {
const el = host.current;
if (!el || !factory) return;
let disposed = false;
let cleanup = () => {};
void factory(el, {
cwd,
"aria-label": ariaLabel,
onData: (d) => handlers.current.onData(d),
onResize: (c, r) => handlers.current.onResize(c, r),
}).then((term) => {
if (disposed) return term.dispose();
const detach = output.attach(
(d) => term.write(d),
() => term.clear(),
);
cleanup = () => {
detach();
term.dispose();
};
});
return () => {
disposed = true;
cleanup();
};
}, [factory, output, cwd, ariaLabel]);
if (!factory)
return (
<div className={styles.notice}>
<T>The terminal is not available; turn off "Emulate terminal in output console" to see the output.</T>
</div>
);
return <div ref={host} className={styles.terminalConsole} />;
}