Skip to content

Commit

Permalink
Fix "Create Project" flow losing options (#3116)
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles-Gagnon authored Apr 19, 2022
1 parent fe1f344 commit f68e470
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/commands/createFunction/createFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getContainingWorkspace } from '../../utils/workspace';
import * as api from '../../vscode-azurefunctions.api';
import { getWorkspaceSetting } from '../../vsCodeConfig/settings';
import { verifyInitForVSCode } from '../../vsCodeConfig/verifyInitForVSCode';
import { createNewProjectInternal } from '../createNewProject/createNewProject';
import { verifyAndPromptToCreateProject } from '../createNewProject/verifyIsProject';
import { FunctionListStep } from './FunctionListStep';
import { IFunctionWizardContext } from './IFunctionWizardContext';
Expand Down Expand Up @@ -44,7 +45,7 @@ export async function createFunctionInternal(context: IActionContext, options: a
let workspaceFolder: WorkspaceFolder | undefined;
let workspacePath: string | undefined = options.folderPath;
if (workspacePath === undefined) {
workspaceFolder = await getWorkspaceFolder(context);
workspaceFolder = await getWorkspaceFolder(context, options);
workspacePath = workspaceFolder.uri.fsPath;
} else {
workspaceFolder = getContainingWorkspace(workspacePath);
Expand All @@ -67,7 +68,7 @@ export async function createFunctionInternal(context: IActionContext, options: a
await wizard.execute();
}

async function getWorkspaceFolder(context: IActionContext): Promise<WorkspaceFolder> {
async function getWorkspaceFolder(context: IActionContext, options: api.ICreateFunctionOptions): Promise<WorkspaceFolder> {
let folder: WorkspaceFolder | undefined;
if (!workspace.workspaceFolders || workspace.workspaceFolders.length === 0) {
const message: string = localize('noWorkspaceWarning', 'You must have a project open to create a function.');
Expand All @@ -77,7 +78,7 @@ async function getWorkspaceFolder(context: IActionContext): Promise<WorkspaceFol

if (result === newProject) {
// don't wait
void commands.executeCommand('azureFunctions.createNewProject');
void createNewProjectInternal(context, options);
context.telemetry.properties.noWorkspaceResult = 'createNewProject';
} else {
const uri: Uri[] = await context.ui.showOpenDialog({
Expand Down

0 comments on commit f68e470

Please sign in to comment.