@@ -8,6 +8,7 @@ import * as gitignoreToGlob from 'gitignore-to-glob';
88import { sync as globSync } from 'glob' ;
99import * as Cache from 'vscode-cache' ;
1010import { QuickPickItem , ViewColumn } from 'vscode' ;
11+ import * as braces from 'braces' ;
1112
1213export interface FSLocation {
1314 relative : string ;
@@ -188,6 +189,17 @@ export function currentEditorPath(): string {
188189 return path . dirname ( activeEditor . document . fileName ) ;
189190}
190191
192+ export function expandBraces ( absolutePath : string ) : string [ ] {
193+ const shouldExpandBraces =
194+ vscode . workspace . getConfiguration ( 'advancedNewFile' ) . get ( 'expandBraces' ) ;
195+
196+ if ( ! shouldExpandBraces ) {
197+ return [ absolutePath ] ;
198+ }
199+
200+ return braces . expand ( absolutePath ) ;
201+ }
202+
191203export function createFileOrFolder ( absolutePath : string ) : void {
192204 let directoryToFile = path . dirname ( absolutePath ) ;
193205
@@ -213,7 +225,7 @@ export async function openFile(absolutePath: string): Promise<void> {
213225 const textDocument = await vscode . workspace . openTextDocument ( absolutePath ) ;
214226
215227 if ( textDocument ) {
216- vscode . window . showTextDocument ( textDocument , ViewColumn . Active ) ;
228+ vscode . window . showTextDocument ( textDocument , { preview : false } ) ;
217229 }
218230 }
219231}
@@ -360,8 +372,11 @@ export async function command(context: vscode.ExtensionContext) {
360372 const newFileInput = await showInputBox ( dir ) ;
361373 if ( ! newFileInput ) return ;
362374
363- createFileOrFolder ( newFileInput ) ;
364- await openFile ( newFileInput ) ;
375+ const newFileArray = expandBraces ( newFileInput ) ;
376+ for ( let newFile of newFileArray ) {
377+ createFileOrFolder ( newFile ) ;
378+ await openFile ( newFile ) ;
379+ }
365380 } else {
366381 await vscode . window . showErrorMessage (
367382 'It doesn\'t look like you have a folder opened in your workspace. ' +
0 commit comments