Skip to content

Commit 5f1fdeb

Browse files
author
ty-d
authored
Merge pull request #190 from ty-d/CreateAndDeleteAfterUserAction
Support AfterUserAction when creating and deleting files on isfs
2 parents 5ebea51 + 2e6c57d commit 5f1fdeb

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
import { StudioOpenDialog } from "../../queries";
89

910
export type Entry = File | Directory;
@@ -152,11 +153,15 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
152153
throw new Error("Not implemented");
153154
}
154155
})
155-
.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+
}
156161
this._lookupAsFile(uri).then((entry) => {
157162
this._fireSoon({ type: vscode.FileChangeType.Changed, uri });
158-
})
159-
);
163+
});
164+
});
160165
}
161166

162167
public delete(uri: vscode.Uri, options: { recursive: boolean }): void | Thenable<void> {
@@ -167,7 +172,12 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
167172
return;
168173
}
169174
const api = new AtelierAPI(uri);
170-
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+
});
171181
}
172182

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

0 commit comments

Comments
 (0)