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
@@ -649,6 +649,8 @@ export const FilesView: React.FC<FilesViewProps> = ({ mode = 'full' }) => {
const setMainTabGuard = useUIStore((state) => state.setMainTabGuard);
const pendingFileNavigation = useUIStore((state) => state.pendingFileNavigation);
const setPendingFileNavigation = useUIStore((state) => state.setPendingFileNavigation);
const pendingFileFocusPath = useUIStore((state) => state.pendingFileFocusPath);
const setPendingFileFocusPath = useUIStore((state) => state.setPendingFileFocusPath);
// Global mouseup to end drag selection
React.useEffect(() => {
@@ -1842,6 +1844,57 @@ export const FilesView: React.FC<FilesViewProps> = ({ mode = 'full' }) => {
textViewMode,
]);
React.useEffect(() => {
if (!pendingFileFocusPath || !root) {
return;
}
const targetPath = normalizePath(pendingFileFocusPath);
if (!targetPath) {
setPendingFileFocusPath(null);
return;
}
if (selectedFile?.path !== targetPath) {
if (selectedPath !== targetPath) {
setSelectedPath(root, targetPath);
}
return;
}
if (fileLoading || loadedFilePath !== targetPath || fileError || isSelectedImage) {
return;
}
if (canEdit && textViewMode !== 'edit') {
setTextViewMode('edit');
return;
}
if (canEdit) {
const view = editorViewRef.current;
if (!view) {
return;
}
view.focus();
}
setPendingFileFocusPath(null);
}, [
canEdit,
fileError,
fileLoading,
isSelectedImage,
loadedFilePath,
pendingFileFocusPath,
root,
selectedFile?.path,
selectedPath,
setPendingFileFocusPath,
setSelectedPath,
textViewMode,
]);
const nudgeEditorSelectionAboveKeyboard = React.useCallback((view: EditorView | null) => {
if (!isMobile || !view || !view.hasFocus || typeof window === 'undefined') {
return;