@@ -10,7 +10,7 @@ import { GitHubApiContext, GitHubApi } from './github/api';
1010import { GitHubFS } from './github/fs' ;
1111import { VirtualSCM } from './scm' ;
1212
13- const repositoryRegex = / ^ (?: (?: h t t p s : \/ \/ ) ? g i t h u b .c o m \/ ) ? ( [ ^ \/ ] + ) \/ ( [ ^ \/ ] + ?) (?: \/ | .g i t | $ ) / i;
13+ // const repositoryRegex = /^(?:(?:https:\/\/)?github.com\/)?([^\/]+)\/([^\/]+?)(?:\/|.git|$)/i;
1414
1515export function activate ( context : ExtensionContext ) {
1616 const contextStore = new ContextStore < GitHubApiContext > ( context . workspaceState , GitHubFS . scheme ) ;
@@ -27,34 +27,34 @@ export function activate(context: ExtensionContext) {
2727 new VirtualSCM ( GitHubFS . scheme , githubApi , changeStore )
2828 ) ;
2929
30- commands . registerCommand ( 'githubBrowser.openRepository' , async ( ) => {
31- const value = await window . showInputBox ( {
32- placeHolder : 'e.g. https://github.com/microsoft/vscode' ,
33- prompt : 'Enter a GitHub repository url' ,
34- validateInput : value => repositoryRegex . test ( value ) ? undefined : 'Invalid repository url'
35- } ) ;
36-
37- if ( value ) {
38- const match = repositoryRegex . exec ( value ) ;
39- if ( match ) {
40- const [ , owner , repo ] = match ;
41-
42- const uri = Uri . parse ( `codespace://HEAD/${ owner } /${ repo } ` ) ;
43- openWorkspace ( uri , repo , 'currentWindow' ) ;
44- }
45- }
46- } ) ;
30+ // commands.registerCommand('githubBrowser.openRepository', async () => {
31+ // const value = await window.showInputBox({
32+ // placeHolder: 'e.g. https://github.com/microsoft/vscode',
33+ // prompt: 'Enter a GitHub repository url',
34+ // validateInput: value => repositoryRegex.test(value) ? undefined : 'Invalid repository url'
35+ // });
36+
37+ // if (value) {
38+ // const match = repositoryRegex.exec(value);
39+ // if (match) {
40+ // const [, owner, repo] = match;
41+
42+ // const uri = Uri.parse(`codespace://HEAD/${owner}/${repo}`);
43+ // openWorkspace(uri, repo, 'currentWindow');
44+ // }
45+ // }
46+ // });
4747}
4848
4949export function getRootUri ( uri : Uri ) {
5050 return workspace . getWorkspaceFolder ( uri ) ?. uri ;
5151}
5252
53- function openWorkspace ( uri : Uri , name : string , location : 'currentWindow' | 'newWindow' | 'addToCurrentWorkspace' ) {
54- if ( location === 'addToCurrentWorkspace' ) {
55- const count = ( workspace . workspaceFolders && workspace . workspaceFolders . length ) || 0 ;
56- return workspace . updateWorkspaceFolders ( count , 0 , { uri : uri , name : name } ) ;
57- }
53+ // function openWorkspace(uri: Uri, name: string, location: 'currentWindow' | 'newWindow' | 'addToCurrentWorkspace') {
54+ // if (location === 'addToCurrentWorkspace') {
55+ // const count = (workspace.workspaceFolders && workspace.workspaceFolders.length) || 0;
56+ // return workspace.updateWorkspaceFolders(count, 0, { uri: uri, name: name });
57+ // }
5858
59- return commands . executeCommand ( 'vscode.openFolder' , uri , location === 'newWindow' ) ;
60- }
59+ // return commands.executeCommand('vscode.openFolder', uri, location === 'newWindow');
60+ // }
0 commit comments