Skip to content

Commit

Permalink
Add project to Workspace (Closes #161)
Browse files Browse the repository at this point in the history
  • Loading branch information
alefragnani committed Jun 2, 2018
1 parent 4f76b1b commit 8120181
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 17 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@
{
"command": "projectManager.openInNewWindow",
"title": "Open in New Window"
},
{
"command": "projectManager.addToWorkspace",
"title": "Add to Workspace"
}
],
"menus": {
Expand All @@ -120,16 +124,27 @@
{
"command": "projectManager.openInNewWindow",
"when": "false"
},
{
"command": "projectManager.addToWorkspace",
"when": "false"
}
],
"view/item/context": [
{
"command": "projectManager.open",
"when": "view =~ /projectsExplorer(Favorites|VSCode|Git|SVN|Mercurial)/"
"when": "view =~ /projectsExplorer(Favorites|VSCode|Git|SVN|Mercurial)/",
"group": "navigation"
},
{
"command": "projectManager.openInNewWindow",
"when": "view =~ /projectsExplorer(Favorites|VSCode|Git|SVN|Mercurial)/"
"when": "view =~ /projectsExplorer(Favorites|VSCode|Git|SVN|Mercurial)/",
"group": "navigation"
},
{
"command": "projectManager.addToWorkspace",
"when": "view =~ /projectsExplorer(Favorites|VSCode|Git|SVN|Mercurial)/",
"group": "workspace"
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export function activate(context: vscode.ExtensionContext) {
value => vscode.window.showInformationMessage("Could not open the project!"));
});

vscode.commands.registerCommand("projectManager.addToWorkspace", node => {
vscode.workspace.updateWorkspaceFolders(vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders.length : 0, null, { uri: vscode.Uri.file(node.command.arguments[ 0 ]) });
});

// register commands (here, because it needs to be used right below if an invalid JSON is present)
vscode.commands.registerCommand("projectManager.saveProject", () => saveProject());
vscode.commands.registerCommand("projectManager.refreshProjects", () => refreshProjects(true, true));
Expand Down

0 comments on commit 8120181

Please sign in to comment.