Add "Open Containing Folder" to project context menu (#11187)

* add command to open the folder the project is in

* move commands to constants
This commit is contained in:
Kim Santiago
2020-07-06 11:42:25 -07:00
committed by GitHub
parent 2d989e1180
commit ac71c6f06d
5 changed files with 34 additions and 3 deletions

View File

@@ -96,7 +96,7 @@ export class ProjectsController {
public async focusProject(project?: Project): Promise<void> {
if (project && this.projects.includes(project)) {
await this.apiWrapper.executeCommand('sqlDatabaseProjectsView.focus');
await this.apiWrapper.executeCommand(constants.sqlDatabaseProjectsViewFocusCommand);
await this.projectTreeViewProvider.focus(project);
}
}
@@ -261,7 +261,7 @@ export class ProjectsController {
// check that dacpac exists
if (await utils.exists(dacpacPath)) {
this.apiWrapper.executeCommand('schemaCompare.start', dacpacPath);
this.apiWrapper.executeCommand(constants.schemaCompareStartCommand, dacpacPath);
} else {
this.apiWrapper.showErrorMessage(constants.buildDacpacNotFound);
}
@@ -346,7 +346,7 @@ export class ProjectsController {
const newEntry = await project.addScriptItem(relativeFilePath, newFileText);
this.apiWrapper.executeCommand('vscode.open', newEntry.fsUri);
this.apiWrapper.executeCommand(constants.vscodeOpenCommand, newEntry.fsUri);
this.refreshProjectsTree();
} catch (err) {
@@ -400,6 +400,15 @@ export class ProjectsController {
return project.files.find(x => utils.getPlatformSafeFileEntryPath(x.relativePath) === utils.getPlatformSafeFileEntryPath(utils.trimUri(context.root.uri, context.uri)));
}
/**
* Opens the folder containing the project
* @param context a treeItem in a project's hierarchy, to be used to obtain a Project
*/
public async openContainingFolder(context: BaseProjectTreeItem): Promise<void> {
const project = this.getProjectFromContext(context);
await this.apiWrapper.executeCommand(constants.revealFileInOsCommand, Uri.file(project.projectFilePath));
}
/**
* Adds a database reference to the project
* @param context a treeItem in a project's hierarchy, to be used to obtain a Project