async function openUrl()

in src/desktop/commands/open_repository.ts [17:38]


async function openUrl(uri: vscode.Uri, action: Action) {
  await GitLabRemoteFileSystem.parseUri(uri); // ensure the URI is a valid gitlab-remote URI

  switch (action) {
    case Action.Replace:
      await vscode.commands.executeCommand('vscode.openFolder', uri, false);
      break;

    case Action.NewWindow:
      await vscode.commands.executeCommand('vscode.openFolder', uri, true);
      break;

    case Action.AddRoot:
      vscode.workspace.updateWorkspaceFolders(vscode.workspace.workspaceFolders?.length || 0, 0, {
        uri,
      });
      break;

    default:
      throw new Error('Invalid action');
  }
}