Skip to content

Commit

Permalink
Add close and closeAll actions to Action model and DemoRunner #24
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Jan 3, 2025
1 parent be93954 commit 8855a59
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [0.0.50] - 2025-01-xx

- [#23](https://github.com/estruyf/vscode-demo-time/issues/23): Add the ability to add notes to demos
- [#24](https://github.com/estruyf/vscode-demo-time/issues/24): Added the `close` and `closeAll` actions to close editors

## [0.0.49] - 2024-12-30

Expand Down
2 changes: 2 additions & 0 deletions src/models/Action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export type Action =
| "open"
| "rename"
| "deleteFile"
| "close"
| "closeAll"
// Markdown
| "markdownPreview"
// Code
Expand Down
10 changes: 10 additions & 0 deletions src/services/DemoRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,16 @@ export class DemoRunner {
await DemoRunner.saveFile();
}

if (step.action === "close") {
await commands.executeCommand("workbench.action.closeActiveEditor");
continue;
}

if (step.action === "closeAll") {
await commands.executeCommand("workbench.action.closeAllEditors");
continue;
}

/**
* All the following actions require a file path.
*/
Expand Down

0 comments on commit 8855a59

Please sign in to comment.