Remove unused languages field on LocalWorktree

This commit is contained in:
Antonio Scandurra 2022-01-19 17:27:00 +01:00
parent 9c9a09cccb
commit e7235a82ec

View file

@ -1002,7 +1002,6 @@ pub struct LocalWorktree {
client: Arc<Client>, client: Arc<Client>,
user_store: ModelHandle<UserStore>, user_store: ModelHandle<UserStore>,
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
languages: Vec<Arc<Language>>,
language_servers: HashMap<String, Arc<LanguageServer>>, language_servers: HashMap<String, Arc<LanguageServer>>,
} }
@ -1110,7 +1109,6 @@ impl LocalWorktree {
client, client,
user_store, user_store,
fs, fs,
languages: Default::default(),
language_servers: Default::default(), language_servers: Default::default(),
}; };
@ -1155,19 +1153,11 @@ impl LocalWorktree {
&self.language_registry &self.language_registry
} }
pub fn languages(&self) -> &[Arc<Language>] {
&self.languages
}
pub fn register_language( pub fn register_language(
&mut self, &mut self,
language: &Arc<Language>, language: &Arc<Language>,
cx: &mut ModelContext<Worktree>, cx: &mut ModelContext<Worktree>,
) -> Option<Arc<LanguageServer>> { ) -> Option<Arc<LanguageServer>> {
if !self.languages.iter().any(|l| Arc::ptr_eq(l, language)) {
self.languages.push(language.clone());
}
if let Some(server) = self.language_servers.get(language.name()) { if let Some(server) = self.language_servers.get(language.name()) {
return Some(server.clone()); return Some(server.clone());
} }