diff --git a/extensions/github-browser/package.json b/extensions/github-browser/package.json index f81eb2d45d6..44c5f89b22b 100644 --- a/extensions/github-browser/package.json +++ b/extensions/github-browser/package.json @@ -21,11 +21,6 @@ "main": "./out/extension.js", "contributes": { "commands": [ - { - "command": "githubBrowser.openRepository", - "title": "Open GitHub Repository...", - "category": "GitHub Browser" - }, { "command": "githubBrowser.commit", "title": "Commit", @@ -55,7 +50,7 @@ "commandPalette": [ { "command": "githubBrowser.commit", - "when": "github.hasChanges" + "when": "false" }, { "command": "githubBrowser.discardChanges", diff --git a/extensions/github-browser/src/extension.ts b/extensions/github-browser/src/extension.ts index fe61594935e..5c028c23cef 100644 --- a/extensions/github-browser/src/extension.ts +++ b/extensions/github-browser/src/extension.ts @@ -10,7 +10,7 @@ import { GitHubApiContext, GitHubApi } from './github/api'; import { GitHubFS } from './github/fs'; import { VirtualSCM } from './scm'; -const repositoryRegex = /^(?:(?:https:\/\/)?github.com\/)?([^\/]+)\/([^\/]+?)(?:\/|.git|$)/i; +// const repositoryRegex = /^(?:(?:https:\/\/)?github.com\/)?([^\/]+)\/([^\/]+?)(?:\/|.git|$)/i; export function activate(context: ExtensionContext) { const contextStore = new ContextStore(context.workspaceState, GitHubFS.scheme); @@ -27,34 +27,34 @@ export function activate(context: ExtensionContext) { new VirtualSCM(GitHubFS.scheme, githubApi, changeStore) ); - commands.registerCommand('githubBrowser.openRepository', async () => { - const value = await window.showInputBox({ - placeHolder: 'e.g. https://github.com/microsoft/vscode', - prompt: 'Enter a GitHub repository url', - validateInput: value => repositoryRegex.test(value) ? undefined : 'Invalid repository url' - }); + // commands.registerCommand('githubBrowser.openRepository', async () => { + // const value = await window.showInputBox({ + // placeHolder: 'e.g. https://github.com/microsoft/vscode', + // prompt: 'Enter a GitHub repository url', + // validateInput: value => repositoryRegex.test(value) ? undefined : 'Invalid repository url' + // }); - if (value) { - const match = repositoryRegex.exec(value); - if (match) { - const [, owner, repo] = match; + // if (value) { + // const match = repositoryRegex.exec(value); + // if (match) { + // const [, owner, repo] = match; - const uri = Uri.parse(`codespace://HEAD/${owner}/${repo}`); - openWorkspace(uri, repo, 'currentWindow'); - } - } - }); + // const uri = Uri.parse(`codespace://HEAD/${owner}/${repo}`); + // openWorkspace(uri, repo, 'currentWindow'); + // } + // } + // }); } export function getRootUri(uri: Uri) { return workspace.getWorkspaceFolder(uri)?.uri; } -function openWorkspace(uri: Uri, name: string, location: 'currentWindow' | 'newWindow' | 'addToCurrentWorkspace') { - if (location === 'addToCurrentWorkspace') { - const count = (workspace.workspaceFolders && workspace.workspaceFolders.length) || 0; - return workspace.updateWorkspaceFolders(count, 0, { uri: uri, name: name }); - } +// function openWorkspace(uri: Uri, name: string, location: 'currentWindow' | 'newWindow' | 'addToCurrentWorkspace') { +// if (location === 'addToCurrentWorkspace') { +// const count = (workspace.workspaceFolders && workspace.workspaceFolders.length) || 0; +// return workspace.updateWorkspaceFolders(count, 0, { uri: uri, name: name }); +// } - return commands.executeCommand('vscode.openFolder', uri, location === 'newWindow'); -} +// return commands.executeCommand('vscode.openFolder', uri, location === 'newWindow'); +// }