Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix-78
Browse files Browse the repository at this point in the history
  • Loading branch information
gjsjohnmurray committed Apr 21, 2021
2 parents b4477fa + 89b872c commit 0a158e4
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,23 @@ export function activate(context: vscode.ExtensionContext) {
const serverSpec = await getServerSpec(serverName, undefined, undefined, true);
if (serverSpec) {
const uri = vscode.Uri.parse(`isfs${readonly ? "-readonly" : ""}://${serverName}:${namespace}/${serverSpec.webServer.pathPrefix || ''}`);
const label = `${serverName}:${namespace}${readonly ? " (read-only)" : ""}`;
const added = vscode.workspace.updateWorkspaceFolders(
vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders.length : 0,
0,
{ uri, name: label }
);
// Switch to Explorer view so user sees the outcome
await vscode.commands.executeCommand("workbench.view.explorer");
// Handle failure
if (added) {
await view.addToRecents(serverName);
}
else {
vscode.window.showErrorMessage(`Folder ${uri.toString()} could not be added. Maybe it already exists in the workspace.`, "Close")
if ((vscode.workspace.workspaceFolders || []).filter((workspaceFolder) => workspaceFolder.uri.toString() === uri.toString()).length === 0) {
const label = `${serverName}:${namespace}${readonly ? " (read-only)" : ""}`;
const added = vscode.workspace.updateWorkspaceFolders(
vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders.length : 0,
0,
{ uri, name: label }
);
// Handle failure
if (added) {
await view.addToRecents(serverName);
}
else {
vscode.window.showErrorMessage(`Folder ${uri.toString()} could not be added.`, "Close")
}
}
// Switch to Explorer view and focus on the folder
await vscode.commands.executeCommand("revealInExplorer", uri);
}
}
}
Expand Down

0 comments on commit 0a158e4

Please sign in to comment.