Skip to content

Commit

Permalink
Changed buildoption name & added .NET SDK discoveribility on other .N…
Browse files Browse the repository at this point in the history
…ET files (#4003)
  • Loading branch information
alexyaang authored Jul 12, 2023
1 parent f6de6c4 commit fd9ca17
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,9 @@
"languages": [
"csharp",
"razor",
"aspnetcorerazor"
"aspnetcorerazor",
"vb",
"fsharp"
],
"configurationAttributes": {
"launch": {
Expand Down
2 changes: 1 addition & 1 deletion src/debugging/netSdk/NetSdkDebugHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class NetSdkDebugHelper extends NetCoreDebugHelper {
};

await netContainerBuild(netCoreBuildContext); // prompt user whether to use .NET container SDK build
if (netCoreBuildContext?.containerBuildOptions === AllNetContainerBuildOptions[1]) {
if (netCoreBuildContext?.containerBuildOption === AllNetContainerBuildOptions[1]) {
options = options || {};
options.appProject = options.appProject || await NetCoreTaskHelper.inferAppProject(context); // This method internally checks the user-defined input first

Expand Down
4 changes: 2 additions & 2 deletions src/scaffolding/wizard/net/NetContainerBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import { AzureWizard, AzureWizardPromptStep, UserCancelledError } from '@microsoft/vscode-azext-utils';
import * as vscode from 'vscode';
import { ScaffoldingWizardContext } from '../ScaffoldingWizardContext';
import { NetContainerBuildOptions, NetSdkChooseBuildStep } from './NetSdkChooseBuildStep';
import { NetContainerBuildOption, NetSdkChooseBuildStep } from './NetSdkChooseBuildStep';

export interface NetChooseBuildTypeContext extends ScaffoldingWizardContext {
containerBuildOptions?: NetContainerBuildOptions;
containerBuildOption?: NetContainerBuildOption;
}

export async function netContainerBuild(wizardContext: Partial<NetChooseBuildTypeContext>, apiInput?: NetChooseBuildTypeContext): Promise<void> {
Expand Down
20 changes: 10 additions & 10 deletions src/scaffolding/wizard/net/NetSdkChooseBuildStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ export const AllNetContainerBuildOptions = [
] as const;

type NetContainerBuildOptionsTuple = typeof AllNetContainerBuildOptions;
export type NetContainerBuildOptions = NetContainerBuildOptionsTuple[number];
export type NetContainerBuildOption = NetContainerBuildOptionsTuple[number];

export class NetSdkChooseBuildStep extends TelemetryPromptStep<NetChooseBuildTypeContext> {
public async prompt(wizardContext: NetChooseBuildTypeContext): Promise<void> {
await this.ensureCSharpExtension(wizardContext);

// get workspace momento storage
const containerBuildOptions = await ext.context.workspaceState.get<NetContainerBuildOptions>(NetContainerBuildOptionsKey);
const containerBuildOption = await ext.context.workspaceState.get<NetContainerBuildOption>(NetContainerBuildOptionsKey);

// only remember if it was 'Use .NET SDK', otherwise prompt again
if (containerBuildOptions === AllNetContainerBuildOptions[1]) {
wizardContext.containerBuildOptions = containerBuildOptions;
if (containerBuildOption === AllNetContainerBuildOptions[1]) {
wizardContext.containerBuildOption = containerBuildOption;
return;
}

Expand All @@ -40,22 +40,22 @@ export class NetSdkChooseBuildStep extends TelemetryPromptStep<NetChooseBuildTyp
placeHolder: vscode.l10n.t('How would you like to build your container image?'),
};

const buildOptions = AllNetContainerBuildOptions as readonly NetContainerBuildOptions[];
const items = buildOptions.map(p => <IAzureQuickPickItem<NetContainerBuildOptions>>{ label: p, data: p });
const buildOptions = AllNetContainerBuildOptions as readonly NetContainerBuildOption[];
const items = buildOptions.map(p => <IAzureQuickPickItem<NetContainerBuildOption>>{ label: p, data: p });

const response = await wizardContext.ui.showQuickPick(items, opt);
wizardContext.containerBuildOptions = response.data;
wizardContext.containerBuildOption = response.data;

// update workspace momento storage
await ext.context.workspaceState.update(NetContainerBuildOptionsKey, wizardContext.containerBuildOptions);
await ext.context.workspaceState.update(NetContainerBuildOptionsKey, wizardContext.containerBuildOption);
}

public shouldPrompt(wizardContext: NetChooseBuildTypeContext): boolean {
return !wizardContext.containerBuildOptions;
return !wizardContext.containerBuildOption;
}

protected setTelemetry(wizardContext: NetChooseBuildTypeContext): void {
wizardContext.telemetry.properties.netSdkBuildStep = wizardContext.containerBuildOptions;
wizardContext.telemetry.properties.netSdkBuildStep = wizardContext.containerBuildOption;
}

private async ensureCSharpExtension(wizardContext: NetChooseBuildTypeContext): Promise<void> {
Expand Down

0 comments on commit fd9ca17

Please sign in to comment.