@devries-cameron20 / t3code Mirror · read-only / commits / 3a78a2d15a
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 03:00 UTC

fix(web): Open in → Finder in the file preview opened the file in its default app instead of revealing it (#16955)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

James Villarrubia committed Oct 19, 2026 at 00:45 UTC 3a78a2d15acb96d68e47bb6e12138ec5f298cbd3
3 files changed +33 -2
apps/web/src/components/chat/OpenInPicker.browser.test.tsx
+20 -2
@@ -98,7 +98,11 @@ afterEach(async () => {
98 vi.unstubAllGlobals();
99 });
100
101 -async function renderPicker(availableEditors: readonly EditorId[] = editors, panel = false) {
101 +async function renderPicker(
102 + availableEditors: readonly EditorId[] = editors,
103 + panel = false,
104 + { openInCwd = "/work/project", revealFileManager = false } = {},
105 +) {
106 await act(async () => {
107 for (const listener of state.listeners) listener();
108 const node = (
@@ -106,7 +110,8 @@ async function renderPicker(availableEditors: readonly EditorId[] = editors, pan
110 environmentId={selected}
111 keybindings={DEFAULT_RESOLVED_KEYBINDINGS}
112 availableEditors={availableEditors}
109 - openInCwd="/work/project"
113 + openInCwd={openInCwd}
114 + revealFileManager={revealFileManager}
115 displayMode={panel ? "panel" : "toolbar"}
116 compact={!panel}
117 />
@@ -208,6 +213,19 @@ describe("host editor access", () => {
213 });
214 });
215
216 +it("reveals a file in the file manager instead of opening it", async () => {
217 + state.allowed.add(selected);
218 + await renderPicker(["file-manager"], false, {
219 + openInCwd: "/work/project/README.md",
220 + revealFileManager: true,
221 + });
222 + await click(primaryButton());
223 + expect(state.run).toHaveBeenCalledExactlyOnceWith({
224 + environmentId: selected,
225 + input: { cwd: "/work/project/README.md", editor: "file-manager", reveal: true },
226 + });
227 +});
228 +
229 describe("client editor links", () => {
230 it("opens an SSH editor URL without host operate permission", async () => {
231 state.remote = { mode: "remote-links", host: { kind: "ssh-alias", host: "test-host" } };
apps/web/src/components/chat/OpenInPicker.tsx
+3
@@ -212,6 +212,7 @@ export const OpenInPicker = memo(function OpenInPicker({
212 compact = false,
213 enableShortcut = true,
214 displayMode = "toolbar",
215 + revealFileManager = false,
216 }: {
217 environmentId: EnvironmentId;
218 keybindings: ResolvedKeybindingsConfig;
@@ -221,6 +222,7 @@ export const OpenInPicker = memo(function OpenInPicker({
222 compact?: boolean;
223 enableShortcut?: boolean;
224 displayMode?: "toolbar" | "panel";
225 + revealFileManager?: boolean;
226 }) {
227 const isPanel = displayMode === "panel";
228 const ActionGroup = isPanel ? "div" : Group;
@@ -266,6 +268,7 @@ export const OpenInPicker = memo(function OpenInPicker({
268 input: {
269 cwd: openInCwd,
270 editor,
271 + ...(revealFileManager && editor === "file-manager" ? { reveal: true } : {}),
272 },
273 });
274 setPreferredEditor(editor);
apps/web/src/components/files/FilePreviewPanel.tsx
+10
@@ -13,6 +13,7 @@ import {
13 isWorkspaceImagePreviewPath,
14 isWorkspaceVideoPreviewPath,
15 } from "@t3tools/shared/filePreview";
16 +import { useAtomValue } from "@effect/atom-react";
17 import {
18 DEFAULT_TOKENIZE_MAX_LENGTH,
19 VirtualizedFile,
@@ -67,6 +68,7 @@ import { assetEnvironment } from "~/state/assets";
68 import { usePreviewAvailable } from "~/browser/previewRuntime";
69 import { useEnvironmentHttpBaseUrl, usePrimaryEnvironmentId } from "~/state/environments";
70 import { previewEnvironment } from "~/state/preview";
71 +import { serverEnvironment } from "~/state/server";
72 import { useEnvironmentScope } from "~/state/session";
73 import { useAtomCommand } from "~/state/use-atom-command";
74 import { useAtomQueryRunner } from "~/state/use-atom-query-runner";
@@ -991,6 +993,7 @@ export default function FilePreviewPanel({
993 const canOperatePreview = useEnvironmentScope(environmentId, AuthPreviewOperateScope);
994 const primaryEnvironmentId = usePrimaryEnvironmentId();
995 const remoteOpenState = useRemoteOpenState(environmentId);
996 + const serverConfig = useAtomValue(serverEnvironment.configValueAtom(environmentId));
997 const environmentHttpBaseUrl = useEnvironmentHttpBaseUrl(environmentId);
998 const previewAvailable = usePreviewAvailable(environmentId);
999 const createAssetUrl = useAtomQueryRunner(assetEnvironment.createUrl, {
@@ -1036,6 +1039,12 @@ export default function FilePreviewPanel({
1039 attachment === undefined &&
1040 (file.isNotFile || (folderTrail !== undefined && file.data === null && file.error === null));
1041 const hostFolderPath = isFolder && isHostFile ? relativePath : null;
1042 + // A chat-linked folder reads as a file until its read settles, and revealing a
1043 + // folder selects it in its parent instead of opening it, so reveal waits.
1044 + const revealsInFileManager =
1045 + !isFolder &&
1046 + (file.data !== null || file.error !== null) &&
1047 + serverConfig?.shellRevealInFileManager === true;
1048 // Everything preview-related keys off previewPath; a folder has no preview.
1049 const previewPath = isFolder ? null : relativePath;
1050 const [explorerOpen, setExplorerOpen] = useState(initialExplorerOpen);
@@ -1229,6 +1238,7 @@ export default function FilePreviewPanel({
1238 availableEditors={availableEditors}
1239 openInCwd={absolutePath}
1240 compact
1241 + revealFileManager={revealsInFileManager}
1242 />
1243 ) : null}
1244 {canToggleRendered && renderedMode ? (