Skip to content

Commit 78cbfee

Browse files
committed
adding demo gif
1 parent b232c5a commit 78cbfee

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Before using the extension please make sure to read the [Disclaimer](#Disclaimer
88
99
# How to use
1010

11+
![demo](images/demo.gif)
12+
1113
1. Press the Shortcut <kbd>Cmd+Alt+N</kbd> or run the `Files: Advanced New File` command.
1214

1315
2. Enter a relative file path or stick with the default. If you have a file open it will guess the extension based on the current extension.

Diff for: images/demo.gif

198 KB
Loading

Diff for: src/extension.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ export function activate(context: ExtensionContext) {
2929
}
3030

3131
export class FileController {
32-
3332
public showFileNameDialog(): Q.Promise<string> {
34-
const currentFileName: string = window.activeTextEditor.document.fileName;
33+
const currentFileName: string = window.activeTextEditor ? window.activeTextEditor.document.fileName : '';
3534
const ext: string = path.extname(currentFileName) || '.ts';
3635
const deferred: Q.Deferred<string> = Q.defer<string>();
3736

@@ -55,10 +54,7 @@ export class FileController {
5554
let fileExists: boolean = fs.existsSync(newFileName);
5655

5756
if (!fileExists) {
58-
let err: string = mkdirp.sync(dirname);
59-
if (err) {
60-
deferred.reject(err);
61-
}
57+
mkdirp.sync(dirname);
6258

6359
fs.appendFile(newFileName, '', (err) => {
6460
if (err) {

0 commit comments

Comments
 (0)