Skip to content

Commit 9d63252

Browse files
Copilotcoder3101
andcommitted
Add full workspace parsing to workspace_symbol request
- Add get_workspaces() method to WorkspaceProtoConfigs to retrieve all workspace folders - Update workspace_symbol handler to parse all files from all workspaces before collecting symbols - Add progress reporting support for workspace symbol requests - Now workspace symbols work across entire workspace, not just opened files Co-authored-by: coder3101 <[email protected]>
1 parent ad7ba22 commit 9d63252

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/config/workspace.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ impl WorkspaceProtoConfigs {
131131
Some(ipath)
132132
}
133133

134+
pub fn get_workspaces(&self) -> Vec<&Url> {
135+
self.workspaces.iter().collect()
136+
}
137+
134138
pub fn no_workspace_mode(&mut self) {
135139
let wr = ProtolsConfig::default();
136140
let rp = if cfg!(target_os = "windows") {

src/lsp.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,18 @@ impl ProtoLanguageServer {
385385
params: WorkspaceSymbolParams,
386386
) -> BoxFuture<'static, Result<Option<WorkspaceSymbolResponse>, ResponseError>> {
387387
let query = params.query.to_lowercase();
388+
let work_done_token = params.work_done_progress_params.work_done_token;
389+
390+
// Parse all files from all workspaces
391+
let workspaces = self.configs.get_workspaces();
392+
let progress_sender = work_done_token.map(|token| self.with_report_progress(token));
393+
394+
for workspace in workspaces {
395+
if let Ok(workspace_path) = workspace.to_file_path() {
396+
self.state
397+
.parse_all_from_workspace(workspace_path, progress_sender.clone());
398+
}
399+
}
388400

389401
let symbols = self.state.find_workspace_symbols(&query);
390402

0 commit comments

Comments
 (0)