Files
kandev/apps/web/lib/commands/content-search-selection.ts
T
2026-07-29 09:50:29 +01:00

15 lines
720 B
TypeScript

import { scrollEditorIfMounted, setPendingCursorPosition } from "@/hooks/file-editor-cursor";
import { useDockviewStore } from "@/lib/state/dockview-store";
import type { WorkspaceContentSearchResult } from "@/lib/types/backend";
import { getFileName } from "@/lib/utils/file-path";
export function openContentSearchResult(
result: WorkspaceContentSearchResult,
worktreePath: string | null,
): void {
const repo = result.repository_name || undefined;
setPendingCursorPosition(result.path, result.line, result.column, repo);
scrollEditorIfMounted(result.path, worktreePath, result.line, result.column, repo);
useDockviewStore.getState().addFileEditorPanel(result.path, getFileName(result.path), { repo });
}