feat: make chat file references clickable and responsive (#587)

* docs: clarify named and quick Cloudflare tunnel usage

* feat: make chat file paths openable from rendered responses

* perf: speed up chat file-path links and open behavior

* fix: open chat file references at mentioned lines

* fix: prevent context panel flicker on blocked file opens
This commit is contained in:
Iuliia Ivashko
2026-03-03 18:35:03 +02:00
committed by GitHub
parent 0b6c1e4165
commit ca754d6589
10 changed files with 730 additions and 8 deletions
@@ -47,6 +47,7 @@ import { copyTextToClipboard } from '@/lib/clipboard';
import { cn } from '@/lib/utils';
import { opencodeClient } from '@/lib/opencode/client';
import { FileTypeIcon } from '@/components/icons/FileTypeIcon';
import { getContextFileOpenFailureMessage, validateContextFileOpen } from '@/lib/contextFileOpenGuard';
type FileNode = {
name: string;
@@ -590,13 +591,19 @@ export const SidebarFilesTree: React.FC = () => {
// --- File operations ---
const handleOpenFile = React.useCallback((node: FileNode) => {
const handleOpenFile = React.useCallback(async (node: FileNode) => {
if (!root) return;
const openValidation = await validateContextFileOpen(files, node.path);
if (!openValidation.ok) {
toast.error(getContextFileOpenFailureMessage(openValidation.reason));
return;
}
setSelectedPath(root, node.path);
addOpenPath(root, node.path);
openContextFile(root, node.path);
}, [addOpenPath, openContextFile, root, setSelectedPath]);
}, [addOpenPath, files, openContextFile, root, setSelectedPath]);
const toggleDirectory = React.useCallback(async (dirPath: string) => {
const normalized = normalizePath(dirPath);