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

@ -302,6 +302,10 @@ async fn test_extension_store(cx: &mut TestAppContext) {
language_registry.language_names(),
["ERB", "Plain Text", "Ruby"]
);
assert_eq!(
language_registry.grammar_names(),
["embedded_template".into(), "ruby".into()]
);
assert_eq!(
theme_registry.list_names(false),
[
@ -319,4 +323,27 @@ async fn test_extension_store(cx: &mut TestAppContext) {
assert_eq!(fs.read_dir_call_count(), prev_fs_read_dir_call_count);
assert_eq!(fs.metadata_call_count(), prev_fs_metadata_call_count + 2);
});
store
.update(cx, |store, cx| {
store.uninstall_extension("zed-ruby".into(), cx)
})
.await
.unwrap();
expected_manifest.extensions.remove("zed-ruby");
expected_manifest.languages.remove("Ruby");
expected_manifest.languages.remove("ERB");
expected_manifest.grammars.remove("ruby");
expected_manifest.grammars.remove("embedded_template");
store.read_with(cx, |store, _| {
let manifest = store.manifest.read();
assert_eq!(manifest.grammars, expected_manifest.grammars);
assert_eq!(manifest.languages, expected_manifest.languages);
assert_eq!(manifest.themes, expected_manifest.themes);
assert_eq!(language_registry.language_names(), ["Plain Text"]);
assert_eq!(language_registry.grammar_names(), []);
});
}