Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion crates/pet/src/jsonrpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ pub fn handle_refresh(context: Arc<Context>, id: u32, params: Value) {
let mut search_scope = None;

// If search kind is provided and no search_paths, then we will only search in the global locations.
config.executables = None; // This can only be provided in the refresh request.
if refresh_options.search_kind.is_some() || refresh_options.search_paths.is_some() {
// Always clear this, as we will either serach in specified folder or a specific kind in global locations.
config.workspace_directories = None;
if let Some(search_paths) = refresh_options.search_paths {
// These workspace folders are only for this refresh.
config.workspace_directories = Some(
search_paths
.iter()
Expand All @@ -201,6 +202,15 @@ pub fn handle_refresh(context: Arc<Context>, id: u32, params: Value) {
config.executables = None;
search_scope = Some(SearchScope::Global(search_kind));
}

// Configure the locators with the modified config.
for locator in context.locators.iter() {
locator.configure(&config);
}
} else {
// Re-configure the locators with an un-modified config.
// Possible we congirued the locators with a modified config in the in the previous request.
// & the config was scoped to a particular search folder, executables or kind.
for locator in context.locators.iter() {
locator.configure(&config);
}
Expand Down