File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
providers/FileSystemPovider Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
41
41
}
42
42
43
43
public async readDirectory ( uri : vscode . Uri ) : Promise < [ string , vscode . FileType ] [ ] > {
44
+ uri = redirectDotvscodeRoot ( uri ) ;
44
45
const parent = await this . _lookupAsDirectory ( uri ) ;
45
46
const api = new AtelierAPI ( uri ) ;
46
47
if ( ! api . active ) {
@@ -129,6 +130,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
129
130
}
130
131
131
132
public createDirectory ( uri : vscode . Uri ) : void | Thenable < void > {
133
+ uri = redirectDotvscodeRoot ( uri ) ;
132
134
const basename = path . posix . basename ( uri . path ) ;
133
135
const dirname = uri . with ( { path : path . posix . dirname ( uri . path ) } ) ;
134
136
return this . _lookupAsDirectory ( dirname ) . then ( ( parent ) => {
@@ -376,6 +378,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
376
378
}
377
379
378
380
private async _lookupParentDirectory ( uri : vscode . Uri ) : Promise < Directory > {
381
+ uri = redirectDotvscodeRoot ( uri ) ;
379
382
const dirname = uri . with ( { path : path . posix . dirname ( uri . path ) } ) ;
380
383
return await this . _lookupAsDirectory ( dirname ) ;
381
384
}
Original file line number Diff line number Diff line change @@ -363,21 +363,21 @@ export function redirectDotvscodeRoot(uri: vscode.Uri): vscode.Uri {
363
363
if ( ! schemas . includes ( uri . scheme ) ) {
364
364
return uri ;
365
365
}
366
- const dotMatch = uri . path . match ( / ^ \/ ( \. [ ^ / ] * ) \/ ( .* ) $ / ) ;
366
+ const dotMatch = uri . path . match ( / ^ \/ ( \. [ ^ / ] * ) ( \/ .* ) ? $ / ) ;
367
367
if ( dotMatch && dotMatch [ 1 ] === ".vscode" ) {
368
368
let namespace : string ;
369
369
const nsMatch = `&${ uri . query } &` . match ( / & n s = ( [ ^ & ] + ) & / ) ;
370
370
if ( nsMatch ) {
371
371
namespace = nsMatch [ 1 ] ;
372
372
const newQueryString = ( ( "&" + uri . query ) . replace ( `ns=${ namespace } ` , "ns=%SYS" ) + "&csp=1" ) . slice ( 1 ) ;
373
- return uri . with ( { path : `/_vscode/${ namespace } / ${ dotMatch [ 2 ] } ` , query : newQueryString } ) ;
373
+ return uri . with ( { path : `/_vscode/${ namespace } ${ dotMatch [ 2 ] || "" } ` , query : newQueryString } ) ;
374
374
} else {
375
375
const parts = uri . authority . split ( ":" ) ;
376
376
if ( parts . length === 2 ) {
377
377
namespace = parts [ 1 ] ;
378
378
return uri . with ( {
379
379
authority : `${ parts [ 0 ] } :%SYS` ,
380
- path : `/_vscode/${ namespace } / ${ dotMatch [ 2 ] } ` ,
380
+ path : `/_vscode/${ namespace } ${ dotMatch [ 2 ] || "" } ` ,
381
381
query : uri . query + "&csp=1" ,
382
382
} ) ;
383
383
}
You can’t perform that action at this time.
0 commit comments