Fix different kinds values used for worktree_id (#17523)

This commit is contained in:
Kirill Bulatov
2024-09-07 00:51:09 -04:00
committed by GitHub
parent 47aec5e64d
commit 8985fd87c2
18 changed files with 136 additions and 127 deletions
+4 -10
View File
@@ -20,15 +20,6 @@ use settings::{add_references_to_properties, Settings, SettingsLocation, Setting
use std::{num::NonZeroU32, path::Path, sync::Arc};
use util::serde::default_true;
impl<'a> From<&'a dyn File> for SettingsLocation<'a> {
fn from(val: &'a dyn File) -> Self {
SettingsLocation {
worktree_id: val.worktree_id(),
path: val.path().as_ref(),
}
}
}
/// Initializes the language settings.
pub fn init(cx: &mut AppContext) {
AllLanguageSettings::register(cx);
@@ -49,7 +40,10 @@ pub fn all_language_settings<'a>(
file: Option<&Arc<dyn File>>,
cx: &'a AppContext,
) -> &'a AllLanguageSettings {
let location = file.map(|f| f.as_ref().into());
let location = file.map(|f| SettingsLocation {
worktree_id: f.worktree_id(cx),
path: f.path().as_ref(),
});
AllLanguageSettings::get(location, cx)
}