(&self, request: WorkspaceGlobRequest)
| 168 | #[async_trait] |
| 169 | impl WorkspaceSearch for LocalWorkspaceBackend { |
| 170 | async fn glob(&self, request: WorkspaceGlobRequest) -> Result<WorkspaceGlobResult> { |
| 171 | validate_relative_pattern(&request.pattern, "glob pattern")?; |
| 172 | let base = self.local_path_for_read(&request.base)?; |
| 173 | let full_pattern = base.join(&request.pattern); |
| 174 | let full_pattern = full_pattern.to_string_lossy().replace('\\', "/"); |
| 175 | |
| 176 | let entries = glob::glob(&full_pattern) |
| 177 | .map_err(|e| anyhow!("Invalid glob pattern '{}': {}", request.pattern, e))?; |
| 178 | |
| 179 | let mut matches = Vec::new(); |
| 180 | for entry in entries { |
| 181 | match entry { |
| 182 | Ok(path) => { |
| 183 | if let Ok(relative) = path.strip_prefix(&self.root) { |
| 184 | matches.push(pathbuf_to_workspace_path(relative)); |
| 185 | } |
| 186 | } |
| 187 | Err(e) => tracing::warn!("Glob entry error: {}", e), |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | matches.sort_by(|a, b| a.as_str().cmp(b.as_str())); |
| 192 | Ok(WorkspaceGlobResult { matches }) |
| 193 | } |
| 194 | |
| 195 | async fn grep(&self, request: WorkspaceGrepRequest) -> Result<WorkspaceGrepResult> { |
| 196 | if let Some(ref glob) = request.glob { |
no test coverage detected