Skip to content

Commit 83ddbac

Browse files
timlogemannpatbenatar
authored andcommitted
maintain original behavior if expandBraces is not enabled. Fix broken test
1 parent ecd2164 commit 83ddbac

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ files anywhere in your workspace.
2222
AdvancedNewFile plugin only. (thanks to [Kaffiend](https://github.com/Kaffiend))
2323
* Control the order of top convenient options ("last selection", "current file",
2424
etc) via config setting `advancedNewFile.convenienceOptions`
25-
* Brace expansion - expand braces into multiple files. Entering `index.{html,css}` will create and open `index.html` and `index.css`. (thanks to [chuckhendo](https://github.com/chuckhendo))
25+
* Brace expansion - expand braces into multiple files. Entering `index.{html,css}` will create and open `index.html` and `index.css`. (thanks to [chuckhendo](https://github.com/chuckhendo) and [timlogemann](https://github.com/timlogemann))
2626

2727
## Configuration Example
2828

src/extension.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,14 @@ export async function openFile(absolutePath: string): Promise<void> {
225225
const textDocument = await vscode.workspace.openTextDocument(absolutePath);
226226

227227
if (textDocument) {
228-
vscode.window.showTextDocument(textDocument, { preview: false });
228+
const shouldExpandBraces =
229+
vscode.workspace.getConfiguration('advancedNewFile').get('expandBraces');
230+
231+
if (shouldExpandBraces) {
232+
vscode.window.showTextDocument(textDocument, { preview: false });
233+
} else {
234+
vscode.window.showTextDocument(textDocument, ViewColumn.Active);
235+
}
229236
}
230237
}
231238
}

test/extension.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ describe('Advanced New File', () => {
396396
workspace: {
397397
openTextDocument,
398398
getConfiguration: mockGetConfiguration({
399+
expandBraces: false,
399400
showInformationMessages: false
400401
})
401402
},

0 commit comments

Comments
 (0)