Consider nested configs for settings reloading (#12253)

## Summary

This PR fixes a bug in the settings reloading logic to consider nested
configuration in a workspace.

fixes: #11766

## Test Plan


69704b7b-44b9-4cc7-b5a7-376bf87c6ef4
This commit is contained in:
Dhruv Manilawala 2024-07-12 10:30:08 +05:30 committed by GitHub
parent bd01004a42
commit 90e9aae3f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -299,7 +299,6 @@ impl Index {
} }
/// Reloads relevant existing settings files based on a changed settings file path. /// Reloads relevant existing settings files based on a changed settings file path.
/// This does not currently register new settings files.
pub(super) fn reload_settings(&mut self, changed_url: &Url) { pub(super) fn reload_settings(&mut self, changed_url: &Url) {
let Ok(changed_path) = changed_url.to_file_path() else { let Ok(changed_path) = changed_url.to_file_path() else {
// Files that don't map to a path can't be a workspace configuration file. // Files that don't map to a path can't be a workspace configuration file.
@ -310,10 +309,12 @@ impl Index {
return; return;
}; };
// TODO: I think this does not correctly reload settings when using `extend` and the extended for (root, settings) in self
// setting isn't in a parent folder. .settings
for (root, settings) in self.settings.range_mut(enclosing_folder.to_path_buf()..) { .range_mut(..=enclosing_folder.to_path_buf())
if !root.starts_with(enclosing_folder) { .rev()
{
if !enclosing_folder.starts_with(root) {
break; break;
} }