дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
Opening a linked worktree from an SSH or WSL project treated the remote directory as a local path. The Worktrees toolbar, row double-click and the checkout prompt's Open now go through openWorktree, which reuses the session's remote target and opens a remote window; local projects are unchanged. Verified with vcs and remote-dev vitest and typecheck on macOS (local path); the SSH flow was verified by the author in the native Linux app. Co-authored-by: leen2175 <[email protected]>
30 рядки
1.0 KiB
TypeScript
30 рядки
1.0 KiB
TypeScript
import { executeAction } from "@/platform/actions";
|
|
import { t } from "@/platform/i18n";
|
|
import { call, commands, isCancelled } from "@/platform/ipc";
|
|
import { useRemote } from "@/platform/remote";
|
|
import { notifications } from "@/workbench/contributions";
|
|
|
|
/**
|
|
* Opens worktree `path` in a new window. In an SSH or WSL session the path is on that
|
|
* machine, so the window connects there instead of opening it as a local folder.
|
|
*/
|
|
export async function openWorktree(path: string): Promise<void> {
|
|
const target = useRemote.getState().session?.target;
|
|
if (target?.kind !== "ssh" && target?.kind !== "wsl") {
|
|
await executeAction("file.openProjectPath", path);
|
|
return;
|
|
}
|
|
try {
|
|
await call(commands.windowOpenRemote(target, path, true));
|
|
} catch (error) {
|
|
if (isCancelled(error)) return;
|
|
notifications().notify({
|
|
level: "error",
|
|
group: "vcs",
|
|
userInitiated: true,
|
|
title: t("app.window.openFailed", { name: path }),
|
|
body: error instanceof Error ? error.message : String(error),
|
|
});
|
|
}
|
|
}
|