@@ -100,7 +100,7 @@ async function initialize() {
100100 mainFilePath += '.js' ;
101101 }
102102 if ( ! await exists ( mainFilePath ) ) {
103- unbuiltExensions . push ( path . relative ( EXTENSIONS_ROOT , mainFilePath ) )
103+ unbuiltExensions . push ( path . relative ( EXTENSIONS_ROOT , mainFilePath ) ) ;
104104 }
105105 }
106106 packageJSON . extensionKind = [ 'web' ] ; // enable for Web
@@ -221,22 +221,34 @@ function handleStaticExtension(req, res, parsedUrl) {
221221 * @param {import('http').ServerResponse } res
222222 */
223223async function handleRoot ( req , res ) {
224+ let folderUri = { scheme : 'memfs' , path : `/sample-folder` } ;
225+
224226 const match = req . url && req . url . match ( / \? ( [ ^ # ] + ) / ) ;
225- let ghPath ;
226227 if ( match ) {
227228 const qs = new URLSearchParams ( match [ 1 ] ) ;
228- ghPath = qs . get ( 'gh' ) ;
229- if ( ghPath && ! ghPath . startsWith ( '/' ) ) {
230- ghPath = '/' + ghPath ;
229+
230+ let ghPath = qs . get ( 'gh' ) ;
231+ if ( ghPath ) {
232+ if ( ! ghPath . startsWith ( '/' ) ) {
233+ ghPath = '/' + ghPath ;
234+ }
235+ folderUri = { scheme : 'github' , authority : 'HEAD' , path : ghPath } ;
236+ } else {
237+
238+ let csPath = qs . get ( 'cs' ) ;
239+ if ( csPath ) {
240+ if ( ! csPath . startsWith ( '/' ) ) {
241+ csPath = '/' + csPath ;
242+ }
243+ folderUri = { scheme : 'codespace' , authority : 'HEAD' , path : csPath } ;
244+ }
231245 }
232246 }
233247
234248 const builtinExtensions = await builtinExtensionsPromise ;
235249
236250 const webConfigJSON = escapeAttribute ( JSON . stringify ( {
237- folderUri : ghPath
238- ? { scheme : 'github' , authority : 'HEAD' , path : ghPath }
239- : { scheme : 'memfs' , path : `/sample-folder` } ,
251+ folderUri : folderUri ,
240252 builtinExtensionsServiceUrl : `${ SCHEME } ://${ AUTHORITY } /static-extension`
241253 } ) ) ;
242254
0 commit comments