Skip to content

Commit 84b4d2d

Browse files
author
Tyler Deemer
committed
Support AfterUserAction when creating and deleting files on isfs
1 parent 7c940e2 commit 84b4d2d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/providers/FileSystemPovider/FileSystemProvider.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as url from "url";
44
import { AtelierAPI } from "../../api";
55
import { Directory } from "./Directory";
66
import { File } from "./File";
7+
import { fireOtherStudioAction, OtherStudioAction } from "../../commands/studio";
78

89
export type Entry = File | Directory;
910

@@ -151,11 +152,15 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
151152
throw new Error("Not implemented");
152153
}
153154
})
154-
.then(() =>
155+
.then((response) => {
156+
if (response && response.result.ext && response.result.ext[0] && response.result.ext[1]) {
157+
fireOtherStudioAction(OtherStudioAction.CreatedNewDocument, uri, response.result.ext[0]);
158+
fireOtherStudioAction(OtherStudioAction.FirstTimeDocumentSave, uri, response.result.ext[1]);
159+
}
155160
this._lookupAsFile(uri).then((entry) => {
156161
this._fireSoon({ type: vscode.FileChangeType.Changed, uri });
157-
})
158-
);
162+
});
163+
});
159164
}
160165

161166
public delete(uri: vscode.Uri, options: { recursive: boolean }): void | Thenable<void> {
@@ -166,7 +171,12 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
166171
return;
167172
}
168173
const api = new AtelierAPI(uri);
169-
return api.deleteDoc(fileName).then(() => this._fireSoon({ type: vscode.FileChangeType.Deleted, uri }));
174+
return api.deleteDoc(fileName).then((response) => {
175+
if (response.result.ext) {
176+
fireOtherStudioAction(OtherStudioAction.DeletedDocument, uri, response.result.ext);
177+
}
178+
this._fireSoon({ type: vscode.FileChangeType.Deleted, uri });
179+
});
170180
}
171181

172182
public rename(oldUri: vscode.Uri, newUri: vscode.Uri, options: { overwrite: boolean }): void | Thenable<void> {

0 commit comments

Comments
 (0)