@@ -231,7 +231,11 @@ export function getResolvedConnectionSpec(key: string, dflt: any): any {
231
231
*/
232
232
export const cspApps : Map < string , string [ ] > = new Map ( ) ;
233
233
234
- export async function checkConnection ( clearCookies = false , uri ?: vscode . Uri ) : Promise < void > {
234
+ export async function checkConnection (
235
+ clearCookies = false ,
236
+ uri ?: vscode . Uri ,
237
+ triggerRefreshes ?: boolean
238
+ ) : Promise < void > {
235
239
// Do nothing if already checking the connection
236
240
if ( checkingConnection ) {
237
241
return ;
@@ -418,10 +422,18 @@ export async function checkConnection(clearCookies = false, uri?: vscode.Uri): P
418
422
} )
419
423
. finally ( ( ) => {
420
424
checkingConnection = false ;
421
- setTimeout ( ( ) => {
422
- explorerProvider . refresh ( ) ;
423
- projectsExplorerProvider . refresh ( ) ;
424
- } , 20 ) ;
425
+ if ( triggerRefreshes ) {
426
+ setTimeout ( ( ) => {
427
+ explorerProvider . refresh ( ) ;
428
+ projectsExplorerProvider . refresh ( ) ;
429
+ // Refreshing Files Explorer also switches to it, so only do this if the uri is part of the workspace,
430
+ // otherwise files opened from ObjectScript Explorer (objectscript:// or isfs:// depending on the "objectscript.serverSideEditing" setting)
431
+ // will cause an unwanted switch.
432
+ if ( uri && schemas . includes ( uri . scheme ) && vscode . workspace . getWorkspaceFolder ( uri ) ) {
433
+ vscode . commands . executeCommand ( "workbench.files.action.refreshFilesExplorer" ) ;
434
+ }
435
+ } , 20 ) ;
436
+ }
425
437
} ) ;
426
438
}
427
439
@@ -594,7 +606,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
594
606
try {
595
607
await resolveConnectionSpec ( serverName ) ;
596
608
} finally {
597
- await checkConnection ( true , uri ) ;
609
+ await checkConnection ( true , uri , true ) ;
598
610
}
599
611
} catch ( _ ) {
600
612
// Ignore any failure
@@ -1060,7 +1072,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
1060
1072
refreshFilesExplorer = true ;
1061
1073
}
1062
1074
try {
1063
- await checkConnection ( true , folder . uri ) ;
1075
+ await checkConnection ( true , folder . uri , true ) ;
1064
1076
} catch ( _ ) {
1065
1077
continue ;
1066
1078
}
0 commit comments