diff --git a/.gitignore b/.gitignore index 7411dad063..cf4a513f6a 100644 --- a/.gitignore +++ b/.gitignore @@ -79,3 +79,4 @@ Cross.toml ASSETS_LICENSES.md external/ +/.bitfun/search/flashgrep-index/ diff --git a/resources/flashgrep/README.md b/resources/flashgrep/README.md index a7206fee70..c4d8429161 100644 --- a/resources/flashgrep/README.md +++ b/resources/flashgrep/README.md @@ -2,7 +2,7 @@ Place the prebuilt `flashgrep` daemon binary in this directory. Pinned release: -- `v0.2.6` from `wgqqqqq/flashgrep` +- `v0.2.10` from `wgqqqqq/flashgrep` Expected filenames: diff --git a/resources/flashgrep/VERSION.json b/resources/flashgrep/VERSION.json index 61ff82f2c1..42da02c4b5 100644 --- a/resources/flashgrep/VERSION.json +++ b/resources/flashgrep/VERSION.json @@ -1,5 +1,5 @@ { "repo": "wgqqqqq/flashgrep", - "tag": "v0.2.7", - "published_at": "2026-05-12T04:48:18Z" + "tag": "v0.2.10", + "published_at": "2026-06-17T08:15:11Z" } diff --git a/resources/flashgrep/flashgrep-aarch64-apple-darwin b/resources/flashgrep/flashgrep-aarch64-apple-darwin index fe670685b1..410b228d2d 100755 Binary files a/resources/flashgrep/flashgrep-aarch64-apple-darwin and b/resources/flashgrep/flashgrep-aarch64-apple-darwin differ diff --git a/resources/flashgrep/flashgrep-aarch64-pc-windows-msvc.exe b/resources/flashgrep/flashgrep-aarch64-pc-windows-msvc.exe index c060bd8759..d99a4b41bd 100644 Binary files a/resources/flashgrep/flashgrep-aarch64-pc-windows-msvc.exe and b/resources/flashgrep/flashgrep-aarch64-pc-windows-msvc.exe differ diff --git a/resources/flashgrep/flashgrep-aarch64-unknown-linux-musl b/resources/flashgrep/flashgrep-aarch64-unknown-linux-musl index d7101d8dce..3639f94f22 100755 Binary files a/resources/flashgrep/flashgrep-aarch64-unknown-linux-musl and b/resources/flashgrep/flashgrep-aarch64-unknown-linux-musl differ diff --git a/resources/flashgrep/flashgrep-x86_64-apple-darwin b/resources/flashgrep/flashgrep-x86_64-apple-darwin index ed1cf1ccd8..53231225ad 100755 Binary files a/resources/flashgrep/flashgrep-x86_64-apple-darwin and b/resources/flashgrep/flashgrep-x86_64-apple-darwin differ diff --git a/resources/flashgrep/flashgrep-x86_64-pc-windows-msvc.exe b/resources/flashgrep/flashgrep-x86_64-pc-windows-msvc.exe index 977d7b0050..b74384f85c 100644 Binary files a/resources/flashgrep/flashgrep-x86_64-pc-windows-msvc.exe and b/resources/flashgrep/flashgrep-x86_64-pc-windows-msvc.exe differ diff --git a/resources/flashgrep/flashgrep-x86_64-unknown-linux-musl b/resources/flashgrep/flashgrep-x86_64-unknown-linux-musl index 55b3e5d864..51aa97b8a0 100755 Binary files a/resources/flashgrep/flashgrep-x86_64-unknown-linux-musl and b/resources/flashgrep/flashgrep-x86_64-unknown-linux-musl differ diff --git a/scripts/dev.cjs b/scripts/dev.cjs index 6237dfd3b5..9097666798 100644 --- a/scripts/dev.cjs +++ b/scripts/dev.cjs @@ -558,10 +558,16 @@ function flashgrepBinaryNames() { return ['flashgrep-aarch64-apple-darwin']; } if (process.platform === 'linux' && process.arch === 'x64') { - return ['flashgrep-x86_64-unknown-linux-gnu']; + return [ + 'flashgrep-x86_64-unknown-linux-musl', + 'flashgrep-x86_64-unknown-linux-gnu', + ]; } if (process.platform === 'linux' && process.arch === 'arm64') { - return ['flashgrep-aarch64-unknown-linux-gnu']; + return [ + 'flashgrep-aarch64-unknown-linux-musl', + 'flashgrep-aarch64-unknown-linux-gnu', + ]; } return [process.platform === 'win32' ? 'flashgrep.exe' : 'flashgrep']; } diff --git a/src/crates/services/services-integrations/src/remote_ssh/workspace_search/mod.rs b/src/crates/services/services-integrations/src/remote_ssh/workspace_search/mod.rs index 93a17b97b8..711aa035b0 100644 --- a/src/crates/services/services-integrations/src/remote_ssh/workspace_search/mod.rs +++ b/src/crates/services/services-integrations/src/remote_ssh/workspace_search/mod.rs @@ -220,7 +220,7 @@ pub(crate) fn should_retry_remote_scan_fallback_as_files_with_matches( primary_search_mode: SearchModeConfig, search_results: &SearchResults, ) -> bool { - let primary_has_details = !search_results.hits.is_empty() + let primary_has_details = !search_results.line_matches.is_empty() || !search_results.file_counts.is_empty() || !search_results.file_match_counts.is_empty() || !search_results.matched_paths.is_empty(); @@ -289,8 +289,9 @@ fn hex_encode(bytes: &[u8]) -> String { #[cfg(test)] mod tests { use super::*; + use crate::workspace_search::flashgrep::protocol::LineMatch; use crate::workspace_search::flashgrep::{ - FileCount, SearchBackend, SearchHit, SearchModeConfig, SearchResults, + FileCount, SearchBackend, SearchModeConfig, SearchResults, }; use std::path::{Path, PathBuf}; @@ -450,16 +451,16 @@ mod tests { &with_file_counts, )); - let mut with_hits = search_results_with_counts(7, 12); - with_hits.hits.push(SearchHit { + let mut with_line_matches = search_results_with_counts(7, 12); + with_line_matches.line_matches.push(LineMatch { path: "/repo/src/lib.rs".to_string(), - matches: Vec::new(), - lines: Vec::new(), + line_number: 42, + line_text: Some("needle".to_string()), }); assert!(!should_retry_remote_scan_fallback_as_files_with_matches( SearchBackend::ScanFallback, SearchModeConfig::LineMatches, - &with_hits, + &with_line_matches, )); assert!(!should_retry_remote_scan_fallback_as_files_with_matches( SearchBackend::IndexedClean, @@ -492,7 +493,6 @@ mod tests { file_counts: Vec::new(), file_match_counts: Vec::new(), line_matches: Vec::new(), - hits: Vec::new(), } } diff --git a/src/crates/services/services-integrations/src/remote_ssh/workspace_search/service.rs b/src/crates/services/services-integrations/src/remote_ssh/workspace_search/service.rs index c2f36f7865..1e1c97ed60 100644 --- a/src/crates/services/services-integrations/src/remote_ssh/workspace_search/service.rs +++ b/src/crates/services/services-integrations/src/remote_ssh/workspace_search/service.rs @@ -9,16 +9,15 @@ use crate::remote_ssh::{normalize_remote_workspace_path, RemoteWorkspaceEntry}; use crate::workspace_search::flashgrep::error::AppError; use crate::workspace_search::flashgrep::{ drain_content_length_messages, log_flashgrep_stderr_line_with_context, ClientCapabilities, - ClientInfo, ConsistencyMode, FlashgrepRepoSession, GlobOutcome, GlobParams, GlobRequest, - InitializeParams, OpenRepoParams, ProtocolClient, QuerySpec, RefreshPolicyConfig, RepoConfig, - RepoRef, RepoStatus, Request, Response, SearchBackend, SearchModeConfig, SearchOutcome, - SearchParams, SearchRequest, SearchResults, TaskRef, TaskStatus, FLASHGREP_LOG_TARGET, + ClientInfo, FlashgrepRepoSession, GlobOutcome, GlobParams, GlobRequest, InitializeParams, + OpenRepoParams, ProtocolClient, QuerySpec, RefreshPolicyConfig, RepoConfig, RepoRef, + RepoStatus, Request, Response, SearchBackend, SearchModeConfig, SearchOutcome, SearchParams, + SearchRequest, SearchResults, TaskRef, TaskStatus, FLASHGREP_LOG_TARGET, }; use crate::workspace_search::result_mapping::convert_search_results; use crate::workspace_search::{ ContentSearchRequest, ContentSearchResult, GlobSearchRequest, GlobSearchResult, - IndexTaskHandle, WorkspaceIndexStatus, WorkspaceSearchFileCount, WorkspaceSearchHit, - WorkspaceSearchRepoStatus, + IndexTaskHandle, WorkspaceIndexStatus, WorkspaceSearchFileCount, WorkspaceSearchRepoStatus, }; use async_trait::async_trait; use bitfun_services_core::filesystem::FileSearchOutcome; @@ -355,7 +354,6 @@ impl RemoteStdioRepoSession { repo_id: self.repo_id.clone(), query, scope, - consistency: ConsistencyMode::WorkspaceEventual, allow_scan_fallback: true, }, }) @@ -633,10 +631,10 @@ impl RemoteWorkspaceSearchService { let mut results = convert_search_results(&raw_results, output_mode); log::debug!( - "Remote workspace content search converted: backend={:?}, repo_phase={:?}, hits={}, file_counts={}, file_match_counts={}, matched_paths={}, converted_results={}, matched_lines={}, matched_occurrences={}", + "Remote workspace content search converted: backend={:?}, repo_phase={:?}, line_matches={}, file_counts={}, file_match_counts={}, matched_paths={}, converted_results={}, matched_lines={}, matched_occurrences={}", backend, repo_status.phase, - raw_results.hits.len(), + raw_results.line_matches.len(), raw_results.file_counts.len(), raw_results.file_match_counts.len(), raw_results.matched_paths.len(), @@ -659,12 +657,7 @@ impl RemoteWorkspaceSearchService { .into_iter() .map(WorkspaceSearchFileCount::from) .collect(), - hits: raw_results - .hits - .clone() - .into_iter() - .map(WorkspaceSearchHit::from) - .collect(), + hits: Vec::new(), backend: backend.into(), repo_status: repo_status.into(), candidate_docs: raw_results.candidate_docs, diff --git a/src/crates/services/services-integrations/src/workspace_search/flashgrep/client.rs b/src/crates/services/services-integrations/src/workspace_search/flashgrep/client.rs index f02de41e48..62c5a13887 100644 --- a/src/crates/services/services-integrations/src/workspace_search/flashgrep/client.rs +++ b/src/crates/services/services-integrations/src/workspace_search/flashgrep/client.rs @@ -273,7 +273,6 @@ impl RepoSession { repo_id: self.repo_id.clone(), query: request.query, scope: request.scope, - consistency: request.consistency, allow_scan_fallback: request.allow_scan_fallback, }, }, diff --git a/src/crates/services/services-integrations/src/workspace_search/flashgrep/mod.rs b/src/crates/services/services-integrations/src/workspace_search/flashgrep/mod.rs index 6923ee0702..a689253381 100644 --- a/src/crates/services/services-integrations/src/workspace_search/flashgrep/mod.rs +++ b/src/crates/services/services-integrations/src/workspace_search/flashgrep/mod.rs @@ -2,10 +2,10 @@ mod client; pub mod error; -mod protocol; +pub(crate) mod protocol; mod repo_session; mod rpc_client; -mod types; +pub(crate) mod types; pub const FLASHGREP_LOG_TARGET: &str = "flashgrep"; @@ -47,14 +47,14 @@ pub fn log_flashgrep_stderr_line_with_context(context: Option<&str>, line: &str) pub use client::{ManagedClient, RepoSession}; pub use protocol::{ - ClientCapabilities, ClientInfo, FileMatch, GlobParams, InitializeParams, MatchLocation, - RepoRef, Request, Response, SearchHit, SearchLine, SearchParams, TaskRef, + ClientCapabilities, ClientInfo, GlobParams, InitializeParams, RepoRef, Request, Response, + SearchParams, TaskRef, }; pub use repo_session::FlashgrepRepoSession; pub use rpc_client::{drain_content_length_messages, ProtocolClient}; pub use types::{ - ConsistencyMode, DirtyFileStats, FileCount, GlobOutcome, GlobRequest, OpenRepoParams, - PathScope, QuerySpec, RefreshPolicyConfig, RepoConfig, RepoPhase, RepoStatus, SearchBackend, - SearchModeConfig, SearchOutcome, SearchRequest, SearchResults, TaskKind, TaskPhase, TaskState, - TaskStatus, WorkspaceOverlayStatus, + DirtyFileStats, FileCount, GlobOutcome, GlobRequest, OpenRepoParams, PathScope, QuerySpec, + RefreshPolicyConfig, RepoConfig, RepoPhase, RepoStatus, SearchBackend, SearchModeConfig, + SearchOutcome, SearchRequest, SearchResults, TaskKind, TaskPhase, TaskState, TaskStatus, + WorkspaceOverlayStatus, }; diff --git a/src/crates/services/services-integrations/src/workspace_search/flashgrep/protocol.rs b/src/crates/services/services-integrations/src/workspace_search/flashgrep/protocol.rs index 22323b5b65..c941dfa2e9 100644 --- a/src/crates/services/services-integrations/src/workspace_search/flashgrep/protocol.rs +++ b/src/crates/services/services-integrations/src/workspace_search/flashgrep/protocol.rs @@ -108,8 +108,6 @@ pub struct SearchParams { #[serde(default)] pub scope: PathScope, #[serde(default)] - pub consistency: ConsistencyMode, - #[serde(default)] pub allow_scan_fallback: bool, } @@ -241,21 +239,11 @@ pub enum CorpusModeConfig { #[derive(Debug, Clone, Copy, Serialize, Deserialize, Default, PartialEq, Eq)] #[serde(rename_all = "snake_case")] pub enum SearchModeConfig { - CountOnly, - CountMatches, - #[default] - MaterializeMatches, FilesWithMatches, - LineMatches, -} - -#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default)] -#[serde(rename_all = "snake_case")] -pub enum ConsistencyMode { - SnapshotOnly, #[default] - WorkspaceEventual, - WorkspaceStrict, + LineMatches, + CountOnly, + CountMatches, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -324,8 +312,6 @@ pub enum Response { SearchCompleted { repo_id: String, backend: SearchBackend, - #[serde(default, skip_serializing_if = "Option::is_none")] - consistency_applied: Option, status: RepoStatus, results: SearchResults, }, @@ -364,8 +350,6 @@ pub struct ServerCapabilities { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SearchProtocolCapabilities { - #[serde(default)] - pub consistency_modes: Vec, pub search_modes: Vec, } @@ -473,7 +457,6 @@ pub enum TaskPhase { #[derive(Debug, Clone, Copy, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum SearchBackend { - IndexedSnapshot, IndexedClean, IndexedWorkspaceView, RgFallback, @@ -497,8 +480,6 @@ pub struct SearchResults { pub file_match_counts: Vec, #[serde(default)] pub line_matches: Vec, - #[serde(default)] - pub hits: Vec, } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -517,35 +498,8 @@ pub struct FileMatchCount { pub struct LineMatch { pub path: String, pub line_number: usize, - pub line_text: String, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SearchHit { - pub path: String, - pub matches: Vec, - pub lines: Vec, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct FileMatch { - pub location: MatchLocation, - pub snippet: String, - pub matched_text: String, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct MatchLocation { - pub line: usize, - pub column: usize, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(tag = "kind", rename_all = "snake_case")] -pub enum SearchLine { - Match { value: FileMatch }, - Context { line_number: usize, snippet: String }, - ContextBreak, + #[serde(default)] + pub line_text: Option, } fn default_top_k_tokens() -> usize { diff --git a/src/crates/services/services-integrations/src/workspace_search/flashgrep/types.rs b/src/crates/services/services-integrations/src/workspace_search/flashgrep/types.rs index 50c4d030b9..25722c0dc1 100644 --- a/src/crates/services/services-integrations/src/workspace_search/flashgrep/types.rs +++ b/src/crates/services/services-integrations/src/workspace_search/flashgrep/types.rs @@ -1,14 +1,13 @@ pub use super::protocol::{ - ConsistencyMode, DirtyFileStats, FileCount, OpenRepoParams, PathScope, QuerySpec, - RefreshPolicyConfig, RepoConfig, RepoPhase, RepoStatus, SearchBackend, SearchModeConfig, - SearchResults, TaskKind, TaskPhase, TaskState, TaskStatus, WorkspaceOverlayStatus, + DirtyFileStats, FileCount, OpenRepoParams, PathScope, QuerySpec, RefreshPolicyConfig, + RepoConfig, RepoPhase, RepoStatus, SearchBackend, SearchModeConfig, SearchResults, TaskKind, + TaskPhase, TaskState, TaskStatus, WorkspaceOverlayStatus, }; #[derive(Debug, Clone)] pub struct SearchRequest { pub query: QuerySpec, pub scope: PathScope, - pub consistency: ConsistencyMode, pub allow_scan_fallback: bool, } @@ -35,7 +34,6 @@ impl SearchRequest { Self { query, scope: PathScope::default(), - consistency: ConsistencyMode::WorkspaceEventual, allow_scan_fallback: false, } } @@ -45,11 +43,6 @@ impl SearchRequest { self } - pub fn with_consistency(mut self, consistency: ConsistencyMode) -> Self { - self.consistency = consistency; - self - } - pub fn with_scan_fallback(mut self, allow_scan_fallback: bool) -> Self { self.allow_scan_fallback = allow_scan_fallback; self diff --git a/src/crates/services/services-integrations/src/workspace_search/result_mapping.rs b/src/crates/services/services-integrations/src/workspace_search/result_mapping.rs index 91dc2246d7..ea22b82cd2 100644 --- a/src/crates/services/services-integrations/src/workspace_search/result_mapping.rs +++ b/src/crates/services/services-integrations/src/workspace_search/result_mapping.rs @@ -1,7 +1,6 @@ use super::flashgrep::SearchResults; use super::types::ContentSearchOutputMode; use bitfun_services_core::filesystem::{FileSearchResult, SearchMatchType}; -use std::collections::BTreeMap; use std::path::Path; pub(crate) fn convert_search_results( @@ -10,11 +9,6 @@ pub(crate) fn convert_search_results( ) -> Vec { match output_mode { ContentSearchOutputMode::Content => { - let hit_results = convert_hits_to_file_search_results(search_results); - if !hit_results.is_empty() { - return hit_results; - } - let line_results = convert_line_matches_to_file_search_results(search_results); if !line_results.is_empty() { return line_results; @@ -55,9 +49,12 @@ fn convert_line_matches_to_file_search_results( is_directory: false, match_type: SearchMatchType::Content, line_number: Some(matched.line_number), - matched_content: Some(matched.line_text.clone()), + matched_content: matched + .line_text + .clone() + .or_else(|| Some(format!("line {}", matched.line_number))), preview_before: None, - preview_inside: Some(matched.line_text.clone()), + preview_inside: matched.line_text.clone(), preview_after: None, }) .collect() @@ -109,41 +106,6 @@ fn convert_file_match_counts_to_search_results( .collect() } -fn convert_hits_to_file_search_results(search_results: &SearchResults) -> Vec { - let mut file_results = Vec::new(); - for hit in &search_results.hits { - let name = Path::new(&hit.path) - .file_name() - .and_then(|file_name| file_name.to_str()) - .unwrap_or(&hit.path) - .to_string(); - - let mut lines = BTreeMap::new(); - for file_match in &hit.matches { - lines - .entry(file_match.location.line) - .or_insert_with(|| file_match.clone()); - } - - for (_, file_match) in lines { - let (preview_before, preview_inside, preview_after) = - split_preview(&file_match.snippet, &file_match.matched_text); - file_results.push(FileSearchResult { - path: hit.path.clone(), - name: name.clone(), - is_directory: false, - match_type: SearchMatchType::Content, - line_number: Some(file_match.location.line), - matched_content: Some(file_match.snippet), - preview_before, - preview_inside, - preview_after, - }); - } - } - file_results -} - fn convert_matched_paths_to_file_only_results( search_results: &SearchResults, ) -> Vec { @@ -167,25 +129,3 @@ fn convert_matched_paths_to_file_only_results( }) .collect() } - -fn split_preview( - snippet: &str, - matched_text: &str, -) -> (Option, Option, Option) { - if matched_text.is_empty() { - return (None, Some(snippet.to_string()), None); - } - - if let Some(offset) = snippet.find(matched_text) { - let before = snippet[..offset].to_string(); - let inside = matched_text.to_string(); - let after = snippet[offset + matched_text.len()..].to_string(); - return ( - (!before.is_empty()).then_some(before), - Some(inside), - (!after.is_empty()).then_some(after), - ); - } - - (None, Some(snippet.to_string()), None) -} diff --git a/src/crates/services/services-integrations/src/workspace_search/service.rs b/src/crates/services/services-integrations/src/workspace_search/service.rs index 5e610b7b8c..844a1f7c04 100644 --- a/src/crates/services/services-integrations/src/workspace_search/service.rs +++ b/src/crates/services/services-integrations/src/workspace_search/service.rs @@ -1,6 +1,6 @@ use super::flashgrep::{ - ConsistencyMode, FlashgrepRepoSession, GlobRequest, ManagedClient, OpenRepoParams, PathScope, - QuerySpec, RefreshPolicyConfig, RepoConfig, RepoSession, SearchRequest, FLASHGREP_LOG_TARGET, + FlashgrepRepoSession, GlobRequest, ManagedClient, OpenRepoParams, PathScope, QuerySpec, + RefreshPolicyConfig, RepoConfig, RepoSession, SearchRequest, FLASHGREP_LOG_TARGET, }; use async_trait::async_trait; use bitfun_services_core::filesystem::FileSearchOutcome; @@ -17,7 +17,7 @@ use tokio::sync::{Mutex, RwLock}; use super::result_mapping::convert_search_results; use super::types::{ ContentSearchRequest, ContentSearchResult, GlobSearchRequest, GlobSearchResult, - IndexTaskHandle, WorkspaceIndexStatus, WorkspaceSearchFileCount, WorkspaceSearchHit, + IndexTaskHandle, WorkspaceIndexStatus, WorkspaceSearchFileCount, }; pub type WorkspaceSearchResult = Result; @@ -221,7 +221,6 @@ impl WorkspaceSearchService { session.as_ref(), SearchRequest::new(query) .with_scope(scope) - .with_consistency(ConsistencyMode::WorkspaceEventual) .with_scan_fallback(true), ) .await @@ -246,13 +245,7 @@ impl WorkspaceSearchService { .into_iter() .map(WorkspaceSearchFileCount::from) .collect(), - hits: search - .results - .hits - .clone() - .into_iter() - .map(WorkspaceSearchHit::from) - .collect(), + hits: Vec::new(), backend: search.backend.into(), repo_status: search.status.into(), candidate_docs: search.results.candidate_docs, @@ -856,14 +849,13 @@ mod tests { } #[test] - fn content_search_converts_legacy_line_matches() { + fn content_search_converts_line_matches_without_line_text() { let mut search_results = empty_search_results(); search_results.line_matches = serde_json::from_value(serde_json::json!([{ "path": "src/search.rs", - "line_number": 42, - "line_text": "pub enum SearchMode" + "line_number": 42 }])) - .expect("legacy line_matches should decode"); + .expect("line_matches should decode"); let results = convert_search_results(&search_results, ContentSearchOutputMode::Content); @@ -871,9 +863,7 @@ mod tests { assert_eq!(results[0].path, "src/search.rs"); assert_eq!(results[0].name, "search.rs"); assert_eq!(results[0].line_number, Some(42)); - assert_eq!( - results[0].matched_content.as_deref(), - Some("pub enum SearchMode") - ); + assert_eq!(results[0].matched_content.as_deref(), Some("line 42")); + assert_eq!(results[0].preview_inside, None); } } diff --git a/src/crates/services/services-integrations/src/workspace_search/types.rs b/src/crates/services/services-integrations/src/workspace_search/types.rs index 97585bdff4..7cb801274d 100644 --- a/src/crates/services/services-integrations/src/workspace_search/types.rs +++ b/src/crates/services/services-integrations/src/workspace_search/types.rs @@ -2,10 +2,8 @@ use bitfun_services_core::filesystem::FileSearchOutcome; use super::flashgrep::{ DirtyFileStats as FlashgrepDirtyFileStats, FileCount as FlashgrepFileCount, - FileMatch as FlashgrepFileMatch, MatchLocation as FlashgrepMatchLocation, RepoPhase as FlashgrepRepoPhase, RepoStatus as FlashgrepRepoStatus, - SearchBackend as FlashgrepSearchBackend, SearchHit as FlashgrepSearchHit, - SearchLine as FlashgrepSearchLine, SearchModeConfig, TaskKind as FlashgrepTaskKind, + SearchBackend as FlashgrepSearchBackend, SearchModeConfig, TaskKind as FlashgrepTaskKind, TaskPhase as FlashgrepTaskPhase, TaskState as FlashgrepTaskState, TaskStatus as FlashgrepTaskStatus, WorkspaceOverlayStatus as FlashgrepWorkspaceOverlayStatus, }; @@ -67,9 +65,7 @@ pub enum WorkspaceSearchBackend { impl From for WorkspaceSearchBackend { fn from(value: FlashgrepSearchBackend) -> Self { match value { - FlashgrepSearchBackend::IndexedSnapshot | FlashgrepSearchBackend::IndexedClean => { - Self::Indexed - } + FlashgrepSearchBackend::IndexedClean => Self::Indexed, FlashgrepSearchBackend::IndexedWorkspaceView => Self::IndexedWorkspace, FlashgrepSearchBackend::RgFallback => Self::TextFallback, FlashgrepSearchBackend::ScanFallback => Self::ScanFallback, @@ -322,15 +318,6 @@ pub struct WorkspaceSearchMatchLocation { pub column: usize, } -impl From for WorkspaceSearchMatchLocation { - fn from(value: FlashgrepMatchLocation) -> Self { - Self { - line: value.line, - column: value.column, - } - } -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct WorkspaceSearchMatch { @@ -339,16 +326,6 @@ pub struct WorkspaceSearchMatch { pub matched_text: String, } -impl From for WorkspaceSearchMatch { - fn from(value: FlashgrepFileMatch) -> Self { - Self { - location: value.location.into(), - snippet: value.snippet, - matched_text: value.matched_text, - } - } -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct WorkspaceSearchContextLine { @@ -364,26 +341,6 @@ pub enum WorkspaceSearchLine { ContextBreak, } -impl From for WorkspaceSearchLine { - fn from(value: FlashgrepSearchLine) -> Self { - match value { - FlashgrepSearchLine::Match { value } => Self::Match { - value: value.into(), - }, - FlashgrepSearchLine::Context { - line_number, - snippet, - } => Self::Context { - value: WorkspaceSearchContextLine { - line_number, - snippet, - }, - }, - FlashgrepSearchLine::ContextBreak => Self::ContextBreak, - } - } -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct WorkspaceSearchHit { @@ -392,16 +349,6 @@ pub struct WorkspaceSearchHit { pub lines: Vec, } -impl From for WorkspaceSearchHit { - fn from(value: FlashgrepSearchHit) -> Self { - Self { - path: value.path, - matches: value.matches.into_iter().map(Into::into).collect(), - lines: value.lines.into_iter().map(Into::into).collect(), - } - } -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct WorkspaceIndexStatus {