Unload languages when uninstalling their extension (#7743)

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-02-13 12:25:54 -08:00 committed by GitHub
parent a2144faf9c
commit e73e93f333
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 120 additions and 28 deletions

View file

@ -311,6 +311,13 @@ impl ExtensionStore {
}
fn manifest_updated(&mut self, manifest: Manifest, cx: &mut ModelContext<Self>) {
let old_manifest = self.manifest.read();
let language_names = old_manifest.languages.keys().cloned().collect::<Vec<_>>();
let grammar_names = old_manifest.grammars.keys().cloned().collect::<Vec<_>>();
drop(old_manifest);
self.language_registry
.remove_languages(&language_names, &grammar_names);
self.language_registry
.register_wasm_grammars(manifest.grammars.iter().map(|(grammar_name, grammar)| {
let mut grammar_path = self.extensions_dir.clone();