feat(state): Alirkan mention_index lewat ToolCtx dan AppStateRest, bangun index di background thread
Menambahkan field mention_index: MentionIndex ke ToolCtx/ToolCtxBuilder dan AppStateRest, mengikuti pola dir_cache yang sudah ada. AppStateRest::new() sekarang men-spawn thread background yang men-walk setiap workspace root via ignore::Walk, membangun daftar path file (dengan prefix [N] untuk root selain yang pertama) dan mengisi mention_index — data ini yang akan dipakai fitur autocomplete @file-mention.
This commit is contained in:
@@ -47,6 +47,7 @@ pub struct ToolCtx {
|
||||
pub memory_dir: PathBuf,
|
||||
pub worktrees_dir: PathBuf,
|
||||
pub dir_cache: std::sync::Arc<tokio::sync::RwLock<super::app::state::misc::DirCache>>,
|
||||
pub mention_index: super::app::state::misc::MentionIndex,
|
||||
pub origin: crate::app::state::types::Origin,
|
||||
pub graduated_checks: Vec<GraduatedCheck>,
|
||||
pub lsp_manager: Arc<Mutex<crate::app::lsp::LspManager>>,
|
||||
@@ -94,6 +95,7 @@ pub struct ToolCtxBuilder {
|
||||
pub memory_dir: PathBuf,
|
||||
pub worktrees_dir: PathBuf,
|
||||
pub dir_cache: std::sync::Arc<tokio::sync::RwLock<super::app::state::misc::DirCache>>,
|
||||
pub mention_index: super::app::state::misc::MentionIndex,
|
||||
pub origin: crate::app::state::types::Origin,
|
||||
pub graduated_checks: Vec<GraduatedCheck>,
|
||||
pub lsp_manager: Arc<Mutex<crate::app::lsp::LspManager>>,
|
||||
@@ -110,6 +112,7 @@ impl Default for ToolCtxBuilder {
|
||||
memory_dir: PathBuf::new(),
|
||||
worktrees_dir: PathBuf::new(),
|
||||
dir_cache: std::sync::Arc::new(tokio::sync::RwLock::new(super::app::state::misc::DirCache::new())),
|
||||
mention_index: super::app::state::misc::MentionIndex::new(),
|
||||
origin: crate::app::state::types::Origin::Main,
|
||||
graduated_checks: Vec::new(),
|
||||
lsp_manager: Arc::new(Mutex::new(crate::app::lsp::LspManager::new())),
|
||||
@@ -138,6 +141,7 @@ impl ToolCtxBuilder {
|
||||
memory_dir: self.memory_dir,
|
||||
worktrees_dir: self.worktrees_dir,
|
||||
dir_cache: self.dir_cache,
|
||||
mention_index: self.mention_index,
|
||||
origin: self.origin,
|
||||
graduated_checks: self.graduated_checks,
|
||||
lsp_manager: self.lsp_manager,
|
||||
|
||||
Reference in New Issue
Block a user