@@ -74,6 +74,18 @@ interface WorkspaceQuickPickItem extends vscode.QuickPickItem {
7474}
7575
7676const DEFAULT_SHARE_URI_PORT = 1248 ;
77+ /**
78+ * Name, which tells search providers to clear their file search caches.
79+ */
80+ export const EVENT_CLEAR_FILE_SEARCH_CACHE = 'vscrwClearFileSearchCache' ;
81+ /**
82+ * Name, which tells search providers to clear all of their search caches.
83+ */
84+ export const EVENT_CLEAR_SEARCH_CACHE = 'vscrwClearSearchCache' ;
85+ /**
86+ * Name, which tells search providers to clear their text search caches.
87+ */
88+ export const EVENT_CLEAR_TEXT_SEARCH_CACHE = 'vscrwClearTextSearchCache' ;
7789/**
7890 * The name of the extension's directory inside the user's home directory.
7991 */
@@ -183,6 +195,36 @@ export async function activate(context: vscode.ExtensionContext) {
183195 // commands
184196 WF . next ( ( ) => {
185197 context . subscriptions . push (
198+ // clearFileSearchCache
199+ vscode . commands . registerCommand ( 'extension.remote.workspace.clearFileSearchCache' , async ( ) => {
200+ try {
201+ vscode_helpers . EVENTS . emit ( EVENT_CLEAR_FILE_SEARCH_CACHE ,
202+ null ) ;
203+ } catch ( e ) {
204+ showError ( e ) ;
205+ }
206+ } ) ,
207+
208+ // clearSearchCache
209+ vscode . commands . registerCommand ( 'extension.remote.workspace.clearSearchCache' , async ( ) => {
210+ try {
211+ vscode_helpers . EVENTS . emit ( EVENT_CLEAR_SEARCH_CACHE ,
212+ null ) ;
213+ } catch ( e ) {
214+ showError ( e ) ;
215+ }
216+ } ) ,
217+
218+ // clearTextSearchCache
219+ vscode . commands . registerCommand ( 'extension.remote.workspace.clearTextSearchCache' , async ( ) => {
220+ try {
221+ vscode_helpers . EVENTS . emit ( EVENT_CLEAR_TEXT_SEARCH_CACHE ,
222+ null ) ;
223+ } catch ( e ) {
224+ showError ( e ) ;
225+ }
226+ } ) ,
227+
186228 // openURI
187229 vscode . commands . registerCommand ( 'extension.remote.workspace.openURI' , async ( ) => {
188230 try {
@@ -537,8 +579,9 @@ export function deactivate() {
537579 if ( isDeactivating ) {
538580 return ;
539581 }
540-
541582 isDeactivating = true ;
583+
584+ vscode_helpers . EVENTS . removeAllListeners ( ) ;
542585}
543586
544587/**
0 commit comments