@@ -24,7 +24,8 @@ export type Entry = File | Directory;
2424export function generateFileContent ( fileName : string , sourceContent : Buffer ) : { content : string [ ] ; enc : boolean } {
2525 const sourceLines = sourceContent . toString ( ) . split ( "\n" ) ;
2626 const fileExt = fileName . split ( "." ) . pop ( ) . toLowerCase ( ) ;
27- if ( fileExt === "cls" ) {
27+ const csp = fileName . startsWith ( "/" ) ;
28+ if ( fileExt === "cls" && ! csp ) {
2829 const className = fileName . split ( "." ) . slice ( 0 , - 1 ) . join ( "." ) ;
2930 const content : string [ ] = [ ] ;
3031 const preamble : string [ ] = [ ] ;
@@ -48,7 +49,7 @@ export function generateFileContent(fileName: string, sourceContent: Buffer): {
4849 content,
4950 enc : false ,
5051 } ;
51- } else if ( [ "int" , "inc" , "mac" ] . includes ( fileExt ) ) {
52+ } else if ( [ "int" , "inc" , "mac" ] . includes ( fileExt ) && ! csp ) {
5253 sourceLines . shift ( ) ;
5354 const routineName = fileName . split ( "." ) . slice ( 0 , - 1 ) . join ( "." ) ;
5455 const routineType = fileExt != "mac" ? `[Type=${ fileExt . toUpperCase ( ) } ]` : "" ;
@@ -144,6 +145,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
144145 }
145146
146147 public stat ( uri : vscode . Uri ) : Promise < vscode . FileStat > {
148+ uri = redirectDotvscodeRoot ( uri ) ;
147149 return this . _lookup ( uri ) ;
148150 }
149151
@@ -346,7 +348,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
346348 return Promise . reject ( ) ;
347349 }
348350 // 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 ).
350352 const newContent = generateFileContent ( fileName , content ) ;
351353
352354 // Write it to the server
@@ -434,6 +436,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
434436 }
435437
436438 public async delete ( uri : vscode . Uri , options : { recursive : boolean } ) : Promise < void > {
439+ uri = redirectDotvscodeRoot ( uri ) ;
437440 const csp = isCSPFile ( uri ) ;
438441 const fileName = csp ? uri . path : uri . path . slice ( 1 ) . replace ( / \/ / g, "." ) ;
439442 const params = new URLSearchParams ( uri . query ) ;
@@ -442,7 +445,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
442445 if ( fileName . startsWith ( "." ) ) {
443446 return ;
444447 }
445- if ( await this . _lookup ( uri ) . then ( ( entry ) => entry instanceof Directory ) ) {
448+ if ( await this . _lookup ( uri , true ) . then ( ( entry ) => entry instanceof Directory ) ) {
446449 // Get the list of documents to delete
447450 let toDeletePromise : Promise < any > ;
448451 if ( project ) {
@@ -554,7 +557,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
554557 }
555558 // Write the new file
556559 // 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 ) ;
558561 await api
559562 . putDoc (
560563 newFileName ,
0 commit comments