Files
clide/lib/kernel/src/file_open.dart
T
jpmschweitzerandClaude Opus 4.8 0c7a6e86d5 add quick-open fuzzy file finder (Ctrl/Cmd+P)
A file picker overlay over the whole workspace, distinct from the
command palette. QuickOpenController holds the file list + a
subsequence fuzzy filter; the overlay loads the list via files.walk on
open, shows RecentFilesService entries on an empty query, and opens the
selection through a shared openWorkspaceFile helper (.md → markdown
reader bus, else editor.open) that the files panel now also routes
through, so recents stay in sync from every open site.

Bound to ctrl+p / meta+p with `when: !palette.open` so it never
collides with the palette's ctrl+p navigation; in-overlay arrows/enter/
escape reuse the palette's keymap-driven model via quickOpen.* intents.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 20:19:21 +02:00

24 lines
895 B
Dart

/// The single dispatch point for opening a workspace file the way
/// clide routes file activations (T-51 / T-187):
/// * `.md` paths → the markdown reader, via the kernel MessageBus;
/// * every other path → the editor, via the `editor.open` IPC verb.
///
/// Records the open in [KernelServices.recentFiles] so the quick-open
/// overlay's empty-query state reflects it. Shared by the files panel
/// and the quick-open overlay so the routing stays in one place.
library;
import 'dart:async';
import 'package:clide/kernel/src/facade.dart';
void openWorkspaceFile(KernelServices services, String path) {
if (path.isEmpty) return;
services.recentFiles.push(path);
if (path.toLowerCase().endsWith('.md')) {
services.messages.publish('builtin.markdown', 'selection', {'path': path});
} else {
unawaited(services.ipc.request('editor.open', args: {'path': path}));
}
}