From f2869643b7ed0b2cf65bca3a0936b74739c42c38 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:05:24 +0800 Subject: [PATCH] fix(index,app): desktop body for project_roots and a type alias for validated files --- crates/ide-index/src/worker.rs | 5 ++++- src-tauri/src/commands/app.rs | 7 +++++++ src-tauri/src/commands/mod.rs | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/ide-index/src/worker.rs b/crates/ide-index/src/worker.rs index ea39ffe430..c165090165 100644 --- a/crates/ide-index/src/worker.rs +++ b/crates/ide-index/src/worker.rs @@ -335,7 +335,7 @@ impl Shared { by_dir.entry(dir).or_default().push(i); } let by_dir: Vec<(&str, Vec)> = by_dir.into_iter().collect(); - let entries: Option)>>> = INDEX_POOL.install(|| { + let entries: Option>> = INDEX_POOL.install(|| { by_dir .par_iter() .map(|(dir, files)| { @@ -1149,6 +1149,9 @@ impl Shared { type ContentHash = [u8; 32]; +/// A file validated on a warm start, with its stored symbols. +type Indexed = (FileEntry, Vec); + /// `Some(prev_hash)` when `f` is missing or stale in `d` (`None` inner hash when /// the file must be parsed fresh); `None` when `d` is already current for `f`. fn prev_hash_if_stale(d: &IndexData, f: &Found) -> Option> { diff --git a/src-tauri/src/commands/app.rs b/src-tauri/src/commands/app.rs index 45d9fbf4cb..2f8be18003 100644 --- a/src-tauri/src/commands/app.rs +++ b/src-tauri/src/commands/app.rs @@ -387,6 +387,13 @@ pub(crate) fn project_current(window: Window) -> Option { state.project(window.label()).ok().filter(|p| !p.light).map(|p| project_info(&p)) } +// Off the IPC thread: Gradle source roots may walk the project for builds, slow on a network share. +pub(crate) fn project_roots(window: Window) -> IdeResult { + let state = window.state::(); + state.note_ipc(); + ide_host::ops::project::project_roots(&state.host, window.label()) +} + // Off the IPC thread: each member's `for_project().layer(Project)` re-parses both settings layers // and validates the merge against the whole `Settings` type, which a debug build's stack-heavy // recursion can overflow from the WebView2 callback (see the `settings_set` note above). diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs index 6645741537..b427a8d719 100644 --- a/src-tauri/src/commands/mod.rs +++ b/src-tauri/src/commands/mod.rs @@ -42,7 +42,7 @@ use std::sync::LazyLock; // Desktop bodies of project-host commands (`#[command(desktop_body = …)]`), which their derived // adapters call. use app::{ - close_project, open_project, project_current, project_trust_remove_location, project_trust_set, + close_project, open_project, project_current, project_roots, project_trust_remove_location, project_trust_set, project_workspace_member_set, project_workspace_members, settings_get, settings_removed_theme, settings_set, }; use doc::doc_edit;