Skip to content

Commit

Permalink
add the ability to open all files in a file group with one click.
Browse files Browse the repository at this point in the history
  • Loading branch information
quicken committed Sep 23, 2022
1 parent 3b438fa commit 66eb59c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ https://github.com/quicken/filefocus
- Add a setting that automatically adds opened files to the pinned focus group.
- Add experimental setting that shows all known editors in special "Editors" group.
- All settings changes are now applied without requiring a restart of VSCode.
- Add icon that opens all files in a group for editing.

### 1.4.2

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ For bug reports and code contributions head on over to:

## What is New

- Open all files in a file group with one-click.
- Setting that automatically adds opened files to the pinned group.
- Setting that shows all known editors in a special "Editor Group".
- Setting that allows turning off Project Groups.
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
"title": "Pin Group",
"icon": "$(pin)"
},
{
"command": "fileFocusExtension.openGroup",
"title": "Open All Files",
"icon": "$(folder)"
},
{
"command": "fileFocusExtension.removeGroup",
"title": "Delete Focus Group",
Expand Down Expand Up @@ -162,6 +167,11 @@
"command": "fileFocusExtension.removeGroupResource",
"when": "view == fileFocusTree && viewItem == FocusRootItem",
"group": "inline"
},
{
"command": "fileFocusExtension.openGroup",
"when": "view == fileFocusTree && viewItem =~ /GroupItem/",
"group": "inline"
}
],
"view/title": [
Expand Down
19 changes: 19 additions & 0 deletions src/GroupFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ export class GroupFacade {
vscode.commands.executeCommand("fileFocusTree.refreshEntry");
}

async openGroup(groupId: string): Promise<void> {
const group = this.groupManager.root.get(groupId);
if (group) {
let i = 1;
for (const resource of group.resources) {
await vscode.commands.executeCommand(
"vscode.open",
resource,
{
viewColumn: vscode.ViewColumn.Active,
preview: false,
preserveFocus: true,
},
group.name
);
}
}
}

async removeGroup(groupId: string): Promise<void> {
const action = await vscode.window.showInformationMessage(
"Discard this focus group?",
Expand Down
7 changes: 7 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ function registerCommands(
}
);

vscode.commands.registerCommand(
"fileFocusExtension.openGroup",
(groupItem: GroupItem) => {
groupFacade.openGroup(groupItem.groupId);
}
);

vscode.commands.registerCommand(
"fileFocusExtension.renameGroup",
(groupItem: GroupItem) => {
Expand Down

0 comments on commit 66eb59c

Please sign in to comment.