@@ -24,7 +24,8 @@ export type Entry = File | Directory;
24
24
export function generateFileContent ( fileName : string , sourceContent : Buffer ) : { content : string [ ] ; enc : boolean } {
25
25
const sourceLines = sourceContent . toString ( ) . split ( "\n" ) ;
26
26
const fileExt = fileName . split ( "." ) . pop ( ) . toLowerCase ( ) ;
27
- if ( fileExt === "cls" ) {
27
+ const csp = fileName . startsWith ( "/" ) ;
28
+ if ( fileExt === "cls" && ! csp ) {
28
29
const className = fileName . split ( "." ) . slice ( 0 , - 1 ) . join ( "." ) ;
29
30
const content : string [ ] = [ ] ;
30
31
const preamble : string [ ] = [ ] ;
@@ -48,7 +49,7 @@ export function generateFileContent(fileName: string, sourceContent: Buffer): {
48
49
content,
49
50
enc : false ,
50
51
} ;
51
- } else if ( [ "int" , "inc" , "mac" ] . includes ( fileExt ) ) {
52
+ } else if ( [ "int" , "inc" , "mac" ] . includes ( fileExt ) && ! csp ) {
52
53
sourceLines . shift ( ) ;
53
54
const routineName = fileName . split ( "." ) . slice ( 0 , - 1 ) . join ( "." ) ;
54
55
const routineType = fileExt != "mac" ? `[Type=${ fileExt . toUpperCase ( ) } ]` : "" ;
@@ -144,6 +145,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
144
145
}
145
146
146
147
public stat ( uri : vscode . Uri ) : Promise < vscode . FileStat > {
148
+ uri = redirectDotvscodeRoot ( uri ) ;
147
149
return this . _lookup ( uri ) ;
148
150
}
149
151
@@ -346,7 +348,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
346
348
return Promise . reject ( ) ;
347
349
}
348
350
// File doesn't exist on the server, and we are allowed to create it.
349
- // Create content (typically a stub).
351
+ // Create content (typically a stub, unless the write-phase of a copy operation ).
350
352
const newContent = generateFileContent ( fileName , content ) ;
351
353
352
354
// Write it to the server
@@ -434,6 +436,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
434
436
}
435
437
436
438
public async delete ( uri : vscode . Uri , options : { recursive : boolean } ) : Promise < void > {
439
+ uri = redirectDotvscodeRoot ( uri ) ;
437
440
const csp = isCSPFile ( uri ) ;
438
441
const fileName = csp ? uri . path : uri . path . slice ( 1 ) . replace ( / \/ / g, "." ) ;
439
442
const params = new URLSearchParams ( uri . query ) ;
@@ -442,7 +445,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
442
445
if ( fileName . startsWith ( "." ) ) {
443
446
return ;
444
447
}
445
- if ( await this . _lookup ( uri ) . then ( ( entry ) => entry instanceof Directory ) ) {
448
+ if ( await this . _lookup ( uri , true ) . then ( ( entry ) => entry instanceof Directory ) ) {
446
449
// Get the list of documents to delete
447
450
let toDeletePromise : Promise < any > ;
448
451
if ( project ) {
@@ -554,7 +557,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
554
557
}
555
558
// Write the new file
556
559
// This is going to attempt the write regardless of the user's response to the check out prompt
557
- const api = new AtelierAPI ( oldUri ) ;
560
+ const api = new AtelierAPI ( newUri ) ;
558
561
await api
559
562
. putDoc (
560
563
newFileName ,
0 commit comments