@@ -4,7 +4,6 @@ use super::alter_extension_json_file;
44use super :: canonicalize_relative_icon_path;
55use super :: Extension ;
66use super :: ExtensionType ;
7- use crate :: util:: platform:: Platform ;
87use super :: LOCAL_QUERY_SOURCE_TYPE ;
98use super :: PLUGIN_JSON_FILE_NAME ;
109use crate :: common:: document:: open;
@@ -16,6 +15,7 @@ use crate::common::search::QuerySource;
1615use crate :: common:: search:: SearchQuery ;
1716use crate :: common:: traits:: SearchSource ;
1817use crate :: extension:: ExtensionBundleIdBorrowed ;
18+ use crate :: util:: platform:: Platform ;
1919use crate :: GLOBAL_TAURI_APP_HANDLE ;
2020use async_trait:: async_trait;
2121use borrowme:: ToOwned ;
@@ -48,7 +48,6 @@ pub(crate) static THIRD_PARTY_EXTENSIONS_DIRECTORY: LazyLock<PathBuf> = LazyLock
4848 app_data_dir
4949} ) ;
5050
51-
5251pub ( crate ) async fn list_third_party_extensions (
5352 directory : & Path ,
5453) -> Result < ( bool , Vec < Extension > ) , String > {
@@ -810,7 +809,7 @@ impl ThirdPartyExtensionsSearchSource {
810809 }
811810
812811 /// Remove `extension` from the **in-memory** extension list.
813- pub ( crate ) async fn remove_extension ( & self , developer : & str , extension_id : & str ) {
812+ pub ( crate ) async fn remove_extension ( & self , developer : & str , extension_id : & str ) -> Extension {
814813 let mut write_lock_guard = self . inner . extensions . write ( ) . await ;
815814 let Some ( index) = write_lock_guard
816815 . iter ( )
@@ -822,7 +821,7 @@ impl ThirdPartyExtensionsSearchSource {
822821 ) ;
823822 } ;
824823
825- write_lock_guard. remove ( index) ;
824+ write_lock_guard. remove ( index)
826825 }
827826}
828827
@@ -1044,7 +1043,6 @@ fn calculate_text_similarity(query: &str, text: &str) -> Option<f64> {
10441043 }
10451044}
10461045
1047-
10481046#[ tauri:: command]
10491047pub ( crate ) async fn uninstall_extension (
10501048 developer : String ,
@@ -1066,12 +1064,19 @@ pub(crate) async fn uninstall_extension(
10661064 . await
10671065 . map_err ( |e| e. to_string ( ) ) ?;
10681066
1069- THIRD_PARTY_EXTENSIONS_SEARCH_SOURCE
1067+ let extension = THIRD_PARTY_EXTENSIONS_SEARCH_SOURCE
10701068 . get ( )
10711069 . unwrap ( )
10721070 . remove_extension ( & developer, & extension_id)
10731071 . await ;
10741072
1073+ // Unregister the extension hotkey, if set.
1074+ //
1075+ // Unregistering hotkey is the only thing that we will do when we disable
1076+ // an extension, so we directly use this function here even though "disabling"
1077+ // the extension that one is trying to uninstall does not make too much sense.
1078+ ThirdPartyExtensionsSearchSource :: _disable_extension ( & extension) . await ?;
1079+
10751080 Ok ( ( ) )
10761081}
10771082
0 commit comments