Skip to content

Commit

Permalink
fix(open multiple files): keep editor open, don't split
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
Ken Howard committed Nov 7, 2017
1 parent 3862114 commit ff6e3cf
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/controllers/main.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,8 @@ export class MainController {
const directory = this._createTmpDir(codeBlock.id);

// Open an editor for each file in CodeFile
let i = 0;
for(let fileName in codeBlock.files) {
i++;
let file = codeBlock.files[fileName];
if (i > 1) {
await commands.executeCommand('workbench.action.focusFirstEditorGroup');
await commands.executeCommand('workbench.action.splitEditor');
}
await this._openTextDocument(directory, fileName, file.content);
}
} catch (error) {
Expand Down Expand Up @@ -332,7 +326,8 @@ export class MainController {
let file = path.join(dir, filename);
fs.writeFileSync(file, content);
return workspace.openTextDocument(file)
.then((doc: TextDocument) => window.showTextDocument(doc));
.then((doc: TextDocument) => window.showTextDocument(doc))
.then(() => commands.executeCommand('workbench.action.keepEditor'));
}

private async _loginUser() {
Expand Down

0 comments on commit ff6e3cf

Please sign in to comment.