Файли
openidea/src/features/agents/project.ts
T
l0ng-ai 01defdefe4 feat: multi-project workspaces and project window groups (#448)
Workspaces open several local project folders in one IDE session (File › New / Open / Manage Workspace…, or Attach when opening a project, which creates a workspace automatically for a plain project window). Member folders are the Project view roots and take part in indexing, Find in Files, Git, language servers, run configurations and builds; agent tasks choose which member they work in. Window › Merge All Project Windows groups project windows into one window with project tabs (switch, reorder, close, move to a new window), restored on reopen.

Closes #241
Closes #198
Closes #286
2026-10-30 22:45:42 +08:00

14 рядки
576 B
TypeScript

import { projectFolder } from "@/platform/project";
/** Prefer the active file's member, then the last task's member, then manifest order. */
export function defaultTaskProject(
project: Parameters<typeof projectFolder>[0],
activePath: string | null,
last: string | null | undefined,
): string | null {
const members = project?.workspace?.projects;
if (!members?.length) return project?.root ?? null;
const active = activePath ? projectFolder(project, activePath)?.root : null;
return active ?? (last && members.includes(last) ? last : (members[0] ?? null));
}