Open History to see the last commit
1import type { EnvironmentId } from "@t3tools/contracts";
2
3import type { RemoteOpenMode } from "../../remoteOpen";
4
5export function shouldShowOpenInPicker(input: {
6 readonly activeProjectName: string | undefined;
7 readonly activeThreadEnvironmentId: EnvironmentId;
8 readonly primaryEnvironmentId: EnvironmentId | null;
9 readonly hostEnvironmentId: string | null;
10 readonly remoteOpenMode: RemoteOpenMode;
11}): boolean {
12 if (!input.activeProjectName) return false;
13 if (
14 input.activeThreadEnvironmentId === input.primaryEnvironmentId ||
15 input.activeThreadEnvironmentId === input.hostEnvironmentId
16 ) {
17 return true;
18 }
19 return input.remoteOpenMode !== "local-exec";
20}
21
22export type FileManagerAction = "open" | "reveal" | "unavailable";
23
24/**
25 * The file manager opens folders and shows files in their folder. A path whose read has not
26 * settled may be either, and a file needs the server's reveal support, so both wait.
27 */
28export function fileManagerActionForPath(input: {
29 readonly isFolder: boolean;
30 readonly isSettled: boolean;
31 readonly canReveal: boolean;
32}): FileManagerAction {
33 if (input.isFolder) return "open";
34 return input.isSettled && input.canReveal ? "reveal" : "unavailable";
35}