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