File tree 3 files changed +4
-6
lines changed
3 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ Before using the extension please make sure to read the [Disclaimer](#Disclaimer
8
8
9
9
# How to use
10
10
11
+ ![ demo] ( images/demo.gif )
12
+
11
13
1 . Press the Shortcut <kbd >Cmd+Alt+N</kbd > or run the ` Files: Advanced New File ` command.
12
14
13
15
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.
Original file line number Diff line number Diff line change @@ -29,9 +29,8 @@ export function activate(context: ExtensionContext) {
29
29
}
30
30
31
31
export class FileController {
32
-
33
32
public showFileNameDialog ( ) : Q . Promise < string > {
34
- const currentFileName : string = window . activeTextEditor . document . fileName ;
33
+ const currentFileName : string = window . activeTextEditor ? window . activeTextEditor . document . fileName : '' ;
35
34
const ext : string = path . extname ( currentFileName ) || '.ts' ;
36
35
const deferred : Q . Deferred < string > = Q . defer < string > ( ) ;
37
36
@@ -55,10 +54,7 @@ export class FileController {
55
54
let fileExists : boolean = fs . existsSync ( newFileName ) ;
56
55
57
56
if ( ! fileExists ) {
58
- let err : string = mkdirp . sync ( dirname ) ;
59
- if ( err ) {
60
- deferred . reject ( err ) ;
61
- }
57
+ mkdirp . sync ( dirname ) ;
62
58
63
59
fs . appendFile ( newFileName , '' , ( err ) => {
64
60
if ( err ) {
You can’t perform that action at this time.
0 commit comments