Skip to content

Commit

Permalink
remove unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
chunyu3 committed Jan 14, 2025
1 parent b12637f commit 94dcc8f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/typespec-vscode/src/vscode-cmd/emit-code/emit-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface EmitQuickPickButton extends QuickInputButton {
uri: string;
}

async function selectEmitter(
async function configureEmitter(
context: vscode.ExtensionContext,
existingEmitters: string[],
): Promise<Emitter | undefined> {
Expand Down Expand Up @@ -129,7 +129,7 @@ async function selectEmitter(
kind: selectedEmitter.emitterKind,
};
}
async function doEmit(context: vscode.ExtensionContext, mainTspFile: string, emitter: Emitter) {
async function doEmit(mainTspFile: string, emitter: Emitter) {
if (!mainTspFile || !(await isFile(mainTspFile))) {
logger.error(
"Invalid typespec project. There is no main tsp file in the project. Generating Cancelled.",
Expand Down Expand Up @@ -466,7 +466,7 @@ export async function emitCode(context: vscode.ExtensionContext, uri: vscode.Uri
logger.error(error);
}

const toQuickPickItem = (e: Emitter): EmitQuickPickItem => {
const toEmitterQuickPickItem = (e: Emitter): EmitQuickPickItem => {
const buttons = e.sourceRepo
? [
{
Expand Down Expand Up @@ -504,7 +504,7 @@ export async function emitCode(context: vscode.ExtensionContext, uri: vscode.Uri
const existingEmitterQuickPickItems = existingEmitters.map((e) => {
const emitter = getRegisterEmittersByPackage(e);
if (emitter) {
return toQuickPickItem(emitter);
return toEmitterQuickPickItem(emitter);
} else {
return {
label: e,
Expand Down Expand Up @@ -553,10 +553,10 @@ export async function emitCode(context: vscode.ExtensionContext, uri: vscode.Uri
existingEmittersSelector.onDidAccept(async () => {
const selectedItem = existingEmittersSelector.selectedItems[0];
if (selectedItem === newEmitterQuickPickItem) {
const newEmitter = await selectEmitter(context, existingEmitters);
const newEmitter = await configureEmitter(context, existingEmitters);
const allPickItems = [];
if (newEmitter) {
allPickItems.push(toQuickPickItem(newEmitter));
allPickItems.push(toEmitterQuickPickItem(newEmitter));
}
allPickItems.push(...existingEmitterQuickPickItems);
allPickItems.push(separatorItem, newEmitterQuickPickItem);
Expand All @@ -573,7 +573,6 @@ export async function emitCode(context: vscode.ExtensionContext, uri: vscode.Uri
return;
}
await doEmit(
context,
tspProjectFile,
getRegisterEmittersByPackage(selectedExistingEmitter.package) ?? {
package: selectedExistingEmitter.package,
Expand All @@ -582,9 +581,9 @@ export async function emitCode(context: vscode.ExtensionContext, uri: vscode.Uri
},
);
} else {
const newEmitter = await selectEmitter(context, existingEmitters ?? []);
const newEmitter = await configureEmitter(context, existingEmitters ?? []);
if (newEmitter) {
await doEmit(context, tspProjectFile, newEmitter);
await doEmit(tspProjectFile, newEmitter);
} else {
logger.info("No emitter selected. Generating Cancelled.");
return;
Expand Down

0 comments on commit 94dcc8f

Please sign in to comment.