Compare commits

...
Author SHA1 Message Date
l0ng-ai 29f473f004 feat(project): Jump to Source in the project view menu; hide deleted files from Recent Files
The project view context menu gains Jump to Source (F4) for files. Recent Files
no longer lists files deleted since they were opened, including files removed
while the IDE was closed; virtual documents stay listed.
2026-10-29 03:37:40 +08:00
4 changed files with 27 additions and 3 deletions

No files matched your search

+4 -2
View File
@@ -218,9 +218,11 @@ impl ProjectIndex {
self.shared.enqueue(Job::SaveRecent);
}
/// Recently opened files, most recent first.
/// Recently opened files, most recent first; files deleted since (also while
/// the IDE was closed) are left out. Virtual documents are always listed.
pub fn recent_files(&self) -> Vec<PathBuf> {
self.shared.recent.lock().clone()
let recent = self.shared.recent.lock().clone();
recent.into_iter().filter(|p| p.to_str().is_some_and(ide_core::text::is_virtual_uri) || p.exists()).collect()
}
/// Blocks until the initial scan and every queued update has been applied
+13
View File
@@ -178,6 +178,19 @@ fn symbol_ranking_is_idea_like() {
assert!(idx.find_symbols("", SymbolFilter::All, 5).is_empty());
}
#[test]
fn recent_files_skip_deleted_files_but_keep_virtual_documents() {
let fx = sample();
let idx = fx.open();
let app = fx.root.join("web/app.py");
let virt = PathBuf::from("jdt://contents/rt.jar/java.lang/String.class");
idx.mark_recent(&app);
idx.mark_recent(&virt);
assert_eq!(idx.recent_files(), vec![virt.clone(), app.clone()]);
std::fs::remove_file(&app).unwrap();
assert_eq!(idx.recent_files(), vec![virt]);
}
#[test]
fn persistence_skips_unchanged_files_on_reopen() {
let fx = sample();
@@ -84,6 +84,7 @@ describe("project view context menu", () => {
"Copy Path/Reference…",
"Paste",
"-",
"Jump to Source",
"Find Usages",
"Find in Files…",
"Replace in Files…",
+9 -1
View File
@@ -20,6 +20,7 @@ import {
findFileUsages,
folderOf,
openCopyDialog,
openFile,
openMoveDialog,
openRenameDialog,
paste,
@@ -196,8 +197,15 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
{ kind: "separator" },
);
// Find Usages / Find in Files… / Replace in Files…
// Jump to Source / Find Usages / Find in Files… / Replace in Files…
push(
files.length > 0 && {
id: "jumpToSource",
label: "Jump to Source",
icon: "edit",
shortcut: keyLabel("project.open"),
run: () => files.forEach((f) => void openFile(f.path)),
},
inProject &&
singleFile && {
id: "findUsages",