adds close workspace to data workspace view menu (#13809)

* adds close workspace to data workspace view menu

* moving vscode command out to main

* update context menu groups
This commit is contained in:
Drew Skwiers-Koballa
2020-12-20 13:14:26 -08:00
committed by GitHub
parent c7303803ba
commit 786d526e9c
3 changed files with 22 additions and 3 deletions

View File

@@ -57,6 +57,12 @@
"category": "", "category": "",
"icon": "$(refresh)" "icon": "$(refresh)"
}, },
{
"command": "dataworkspace.close",
"title": "%close-workspace-command%",
"category": "",
"icon": "$(close)"
},
{ {
"command": "projects.removeProject", "command": "projects.removeProject",
"title": "%remove-project-command%" "title": "%remove-project-command%"
@@ -67,17 +73,22 @@
{ {
"command": "dataworkspace.refresh", "command": "dataworkspace.refresh",
"when": "view == dataworkspace.views.main", "when": "view == dataworkspace.views.main",
"group": "secondary" "group": "2_currentWorkspace"
},
{
"command": "dataworkspace.close",
"when": "view == dataworkspace.views.main && workbenchState == workspace",
"group": "3_commands"
}, },
{ {
"command": "projects.new", "command": "projects.new",
"when": "view == dataworkspace.views.main", "when": "view == dataworkspace.views.main",
"group": "navigation" "group": "1_navigation"
}, },
{ {
"command": "projects.openExisting", "command": "projects.openExisting",
"when": "view == dataworkspace.views.main", "when": "view == dataworkspace.views.main",
"group": "navigation" "group": "1_navigation"
} }
], ],
"commandPalette": [ "commandPalette": [
@@ -88,6 +99,10 @@
"command": "dataworkspace.refresh", "command": "dataworkspace.refresh",
"when": "false" "when": "false"
}, },
{
"command": "dataworkspace.close",
"when": "false"
},
{ {
"command": "projects.removeProject", "command": "projects.removeProject",
"when": "false" "when": "false"

View File

@@ -5,6 +5,7 @@
"main-view-name": "Projects", "main-view-name": "Projects",
"new-command": "New", "new-command": "New",
"refresh-workspace-command": "Refresh", "refresh-workspace-command": "Refresh",
"close-workspace-command": "Close Workspace",
"remove-project-command": "Remove Project", "remove-project-command": "Remove Project",
"projects-view-no-workspace-content": "No workspace open, create new or open existing to get started.\n[Create new](command:projects.new)\n[Open existing](command:projects.openExisting)\nTo learn more about SQL Database projects [read our docs](https://aka.ms/azuredatastudio-sqlprojects)", "projects-view-no-workspace-content": "No workspace open, create new or open existing to get started.\n[Create new](command:projects.new)\n[Open existing](command:projects.openExisting)\nTo learn more about SQL Database projects [read our docs](https://aka.ms/azuredatastudio-sqlprojects)",
"projects-view-no-project-content": "No projects found in current workspace.\n[Create new](command:projects.new)\n[Open existing](command:projects.openExisting)\nTo learn more about SQL Database projects [read our docs](https://aka.ms/azuredatastudio-sqlprojects).\n", "projects-view-no-project-content": "No projects found in current workspace.\n[Create new](command:projects.new)\n[Open existing](command:projects.openExisting)\nTo learn more about SQL Database projects [read our docs](https://aka.ms/azuredatastudio-sqlprojects).\n",

View File

@@ -35,6 +35,9 @@ export function activate(context: vscode.ExtensionContext): Promise<IExtension>
context.subscriptions.push(vscode.commands.registerCommand('dataworkspace.refresh', () => { context.subscriptions.push(vscode.commands.registerCommand('dataworkspace.refresh', () => {
workspaceTreeDataProvider.refresh(); workspaceTreeDataProvider.refresh();
})); }));
context.subscriptions.push(vscode.commands.registerCommand('dataworkspace.close', () => {
vscode.commands.executeCommand('workbench.action.closeFolder');
}));
context.subscriptions.push(vscode.commands.registerCommand('projects.removeProject', async (treeItem: WorkspaceTreeItem) => { context.subscriptions.push(vscode.commands.registerCommand('projects.removeProject', async (treeItem: WorkspaceTreeItem) => {
await workspaceService.removeProject(vscode.Uri.file(treeItem.element.project.projectFilePath)); await workspaceService.removeProject(vscode.Uri.file(treeItem.element.project.projectFilePath));
})); }));