private openWorkspace()

in src/controller/urlController.ts [133:166]


  private openWorkspace(
    versionPath: string,
    filepath?: string,
    lineNumber?: string
  ) {
    const versionUri = vscode.Uri.file(versionPath);
    const filePath = path.join(versionPath, filepath ?? "manifest.json");
    const workspace = vscode.workspace.workspaceFolders;

    // If user does not have a workspace open, directly open the folder.
    if (!workspace) {
      vscode.commands
        .executeCommand("vscode.openFolder", versionUri)
        .then(() => {
          this.revealFile(vscode.Uri.file(filePath), lineNumber).then(() => {
            this.lintController.lintWorkspace();
          });
        });
    }
    // If user already has the version folder opened, open the manifest.json
    else if (workspace[0].uri.fsPath === versionUri.fsPath) {
      this.revealFile(vscode.Uri.file(filePath), lineNumber).then(() => {
        this.lintController.lintWorkspace();
      });
    }
    // Otherwise, store the filePath (since the extension must restart) to open on launch.
    else {
      Promise.all([
        this.context.globalState.update("filePath", filePath),
        this.context.globalState.update("lineNumber", lineNumber),
      ]);
      vscode.commands.executeCommand("vscode.openFolder", versionUri, true);
    }
  }