@@ -4,6 +4,8 @@ import * as url from "url";
44import { AtelierAPI } from "../../api" ;
55import { Directory } from "./Directory" ;
66import { File } from "./File" ;
7+ import { fireOtherStudioAction , OtherStudioAction } from "../../commands/studio" ;
8+ import { StudioOpenDialog } from "../../queries" ;
79
810export type Entry = File | Directory ;
911
@@ -55,7 +57,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
5557 . actionQuery ( sql , [ spec , dir , orderBy , system , flat , notStudio , generated ] )
5658 . then ( ( data ) => data . result . content || [ ] )
5759 . then ( ( data ) =>
58- data . map ( ( item ) => {
60+ data . map ( ( item : StudioOpenDialog ) => {
5961 const name = item . Name ;
6062 const fullName = folder === "" ? name : folder + "/" + name ;
6163 if ( item . Type === "10" || item . Type === "9" ) {
@@ -151,11 +153,15 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
151153 throw new Error ( "Not implemented" ) ;
152154 }
153155 } )
154- . then ( ( ) =>
156+ . then ( ( response ) => {
157+ if ( response && response . result . ext && response . result . ext [ 0 ] && response . result . ext [ 1 ] ) {
158+ fireOtherStudioAction ( OtherStudioAction . CreatedNewDocument , uri , response . result . ext [ 0 ] ) ;
159+ fireOtherStudioAction ( OtherStudioAction . FirstTimeDocumentSave , uri , response . result . ext [ 1 ] ) ;
160+ }
155161 this . _lookupAsFile ( uri ) . then ( ( entry ) => {
156162 this . _fireSoon ( { type : vscode . FileChangeType . Changed , uri } ) ;
157- } )
158- ) ;
163+ } ) ;
164+ } ) ;
159165 }
160166
161167 public delete ( uri : vscode . Uri , options : { recursive : boolean } ) : void | Thenable < void > {
@@ -166,7 +172,12 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
166172 return ;
167173 }
168174 const api = new AtelierAPI ( uri ) ;
169- return api . deleteDoc ( fileName ) . then ( ( ) => this . _fireSoon ( { type : vscode . FileChangeType . Deleted , uri } ) ) ;
175+ return api . deleteDoc ( fileName ) . then ( ( response ) => {
176+ if ( response . result . ext ) {
177+ fireOtherStudioAction ( OtherStudioAction . DeletedDocument , uri , response . result . ext ) ;
178+ }
179+ this . _fireSoon ( { type : vscode . FileChangeType . Deleted , uri } ) ;
180+ } ) ;
170181 }
171182
172183 public rename ( oldUri : vscode . Uri , newUri : vscode . Uri , options : { overwrite : boolean } ) : void | Thenable < void > {
0 commit comments