File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -211,21 +211,23 @@ export function activate(context: vscode.ExtensionContext) {
211
211
const serverSpec = await getServerSpec ( serverName , undefined , undefined , true ) ;
212
212
if ( serverSpec ) {
213
213
const uri = vscode . Uri . parse ( `isfs${ readonly ? "-readonly" : "" } ://${ serverName } :${ namespace } /${ serverSpec . webServer . pathPrefix || '' } ` ) ;
214
- const label = ` ${ serverName } : ${ namespace } ${ readonly ? " (read-only)" : "" } ` ;
215
- const added = vscode . workspace . updateWorkspaceFolders (
216
- vscode . workspace . workspaceFolders ? vscode . workspace . workspaceFolders . length : 0 ,
217
- 0 ,
218
- { uri , name : label }
219
- ) ;
220
- // Switch to Explorer view so user sees the outcome
221
- await vscode . commands . executeCommand ( "workbench.view.explorer" ) ;
222
- // Handle failure
223
- if ( added ) {
224
- await view . addToRecents ( serverName ) ;
225
- }
226
- else {
227
- vscode . window . showErrorMessage ( `Folder ${ uri . toString ( ) } could not be added. Maybe it already exists in the workspace.` , "Close" )
214
+ if ( ( vscode . workspace . workspaceFolders || [ ] ) . filter ( ( workspaceFolder ) => workspaceFolder . uri . toString ( ) === uri . toString ( ) ) . length === 0 ) {
215
+ const label = ` ${ serverName } : ${ namespace } ${ readonly ? " (read-only)" : "" } ` ;
216
+ const added = vscode . workspace . updateWorkspaceFolders (
217
+ vscode . workspace . workspaceFolders ? vscode . workspace . workspaceFolders . length : 0 ,
218
+ 0 ,
219
+ { uri , name : label }
220
+ ) ;
221
+ // Handle failure
222
+ if ( added ) {
223
+ await view . addToRecents ( serverName ) ;
224
+ }
225
+ else {
226
+ vscode . window . showErrorMessage ( `Folder ${ uri . toString ( ) } could not be added.` , "Close" )
227
+ }
228
228
}
229
+ // Switch to Explorer view and focus on the folder
230
+ await vscode . commands . executeCommand ( "revealInExplorer" , uri ) ;
229
231
}
230
232
}
231
233
}
You can’t perform that action at this time.
0 commit comments