Skip to content

Commit

Permalink
Merge branch 'features/support-profiles' (Closes #281)
Browse files Browse the repository at this point in the history
  • Loading branch information
alefragnani committed May 2, 2024
2 parents b7e84c3 + 27b24cc commit 1f4c0ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 5 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,20 @@ export async function activate(context: vscode.ExtensionContext) {
const hideGitWelcome = context.globalState.get<boolean>("hideGitWelcome", false);
vscode.commands.executeCommand("setContext", "projectManager.hiddenGitWelcome", hideGitWelcome);

vscode.commands.registerCommand("_projectManager.open", async (node: string | any) => {
const uri = typeof node === "string"
? buildProjectUri(node)
: buildProjectUri(node.command.arguments[0]);
vscode.commands.registerCommand("_projectManager.open", async (projectPath: string, projectName: string, profile: string) => {
const uri = buildProjectUri(projectPath);
if (!await canSwitchOnActiveWindow(CommandLocation.SideBar)) {
return;
}
vscode.commands.executeCommand("vscode.openFolder", uri, false)
vscode.commands.executeCommand("vscode.openFolder", uri, { forceProfile: profile , forceNewWindow: false } )
.then(
value => ({}), // done
value => vscode.window.showInformationMessage(l10n.t("Could not open the project!")));
});
vscode.commands.registerCommand("_projectManager.openInNewWindow", node => {
vscode.commands.registerCommand("_projectManager.openInNewWindow", (node) => {
const uri = buildProjectUri(node.command.arguments[0]);
const openInNewWindow = shouldOpenInNewWindow(true, CommandLocation.SideBar);
vscode.commands.executeCommand("vscode.openFolder", uri, openInNewWindow)
vscode.commands.executeCommand("vscode.openFolder", uri, { forceProfile: node.command.arguments[2] , forceNewWindow: openInNewWindow } )
.then(
value => ({}), // done
value => vscode.window.showInformationMessage(l10n.t("Could not open the project!")));
Expand Down
8 changes: 5 additions & 3 deletions src/quickpick/projectsPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export async function pickProjects(projectStorage: ProjectStorage, locators: Loc
return {
label: folder.label,
description: folder.description,
profile: folder.profile,
buttons: showOpenInNewWindowButton ? [openInNewWindowButton] : []
}
});
Expand All @@ -148,7 +149,7 @@ export async function pickProjects(projectStorage: ProjectStorage, locators: Loc
input.matchOnDetail = false;
input.items = <any[]> folders;
input.onDidChangeSelection(items => {
const item = items[0];
const item = <any>items[0];
if (item) {
if (!canPickSelectedProject(item, projectStorage)) {
resolve(undefined);
Expand All @@ -159,7 +160,8 @@ export async function pickProjects(projectStorage: ProjectStorage, locators: Loc
resolve(<Picked<Project>>{
item: {
name: item.label,
rootPath: PathUtils.normalizePath(item.description)
rootPath: PathUtils.normalizePath(item.description),
profile: item.profile,
}, button: undefined
});
input.hide();
Expand Down Expand Up @@ -287,7 +289,7 @@ export async function openPickedProject(picked: Picked<Project>, forceNewWindow:

const openInNewWindow = shouldOpenInNewWindow(forceNewWindow || !!picked.button, calledFrom);
const uri = buildProjectUri(picked.item.rootPath);
commands.executeCommand("vscode.openFolder", uri, openInNewWindow)
commands.executeCommand("vscode.openFolder", uri, { forceProfile: picked.item.profile, forceNewWindow: openInNewWindow })
.then(
() => ({}), // done
() => window.showInformationMessage(l10n.t("Could not open the project!")));
Expand Down

0 comments on commit 1f4c0ec

Please sign in to comment.