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.

feat(run): a Find entry on every console, not just the Run toolbar (#1764)

misswell89b178f9aa84
diff --git a/src/features/run/ConsoleView.tsx b/src/features/run/ConsoleView.tsx
index 64cb70cb9..4493beae5 100644
--- a/src/features/run/ConsoleView.tsx
+++ b/src/features/run/ConsoleView.tsx
@@ -498,6 +498,19 @@ export function ConsoleView({
const items = virtualizer.getVirtualItems();
return (
<div className={styles.consoleWrap}>
+ {/* A console whose find bar is not driven by a toolbar (a stack-trace tab, say) still
+ needs a visible way in: the same Find the Run toolbar offers, over the output. */}
+ {controlledFindOpen === undefined && !findOpen && (
+ <button
+ type="button"
+ className={styles.consoleFindOpen}
+ title="Find…"
+ aria-label="Find in console"
+ onClick={() => setFindOpen(true)}
+ >
+ <Icon name="search" size={14} />
+ </button>
+ )}
{findOpen && (
<ConsoleFindBar
query={query}
diff --git a/src/features/run/Run.module.css b/src/features/run/Run.module.css
index f809fd380..1b8bc4352 100644
--- a/src/features/run/Run.module.css
+++ b/src/features/run/Run.module.css
@@ -81,7 +81,32 @@
/* Console */
+.consoleFindOpen {
+ position: absolute;
+ top: 6px;
+ right: 14px;
+ z-index: 2;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 22px;
+ height: 22px;
+ padding: 0;
+ border: none;
+ border-radius: 4px;
+ color: var(--fg-secondary);
+ background: var(--bg-toolbar);
+ opacity: 0.6;
+}
+
+.consoleFindOpen:hover,
+.consoleFindOpen:focus-visible {
+ opacity: 1;
+ color: var(--fg-primary);
+}
+
.consoleWrap {
+ position: relative;
flex: 1;
display: flex;
flex-direction: column;
diff --git a/src/features/run/findBar.test.tsx b/src/features/run/findBar.test.tsx
index 9aa44c4d8..29500a9b1 100644
--- a/src/features/run/findBar.test.tsx
+++ b/src/features/run/findBar.test.tsx
@@ -44,6 +44,13 @@ function markCount(container: HTMLElement) {
}
describe("Run console find", () => {
+ it("offers a visible Find entry in a console without a toolbar (stack traces)", () => {
+ setup();
+ fireEvent.click(screen.getByRole("button", { name: "Find in console" }));
+ expect(screen.getByRole("search")).toBeInTheDocument();
+ expect(input()).toHaveFocus();
+ });
+
it("opens on ⌘F, searches as you type and highlights every match", () => {
const { log, view } = setup();
const bar = openFind(log);