Skip to content

Commit f63ee4f

Browse files
author
Vandita Patidar
committed
quickPick changes
1 parent d226d31 commit f63ee4f

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

packages/core/src/awsService/appBuilder/serverlessLand/main.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ async function openReadmeFile(config: CreateServerlessLandWizardForm): Promise<v
115115
getLogger().warn('README.md file not found in the project directory')
116116
return
117117
}
118-
await new Promise((resolve) => setTimeout(resolve, 2000))
119-
120118
await vscode.commands.executeCommand('workbench.action.focusFirstEditorGroup')
121119
await vscode.commands.executeCommand('markdown.showPreview', readmeUri)
122120
} catch (err) {

packages/core/src/awsService/appBuilder/serverlessLand/metadataManager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55
import * as nodefs from 'fs' // eslint-disable-line no-restricted-imports
66
import { ToolkitError } from '../../../shared/errors'
7-
import path from 'path'
87
import globals from '../../../shared/extensionGlobals'
98

109
interface Implementation {
@@ -49,7 +48,7 @@ export class MetadataManager {
4948
}
5049

5150
public getMetadataPath(): string {
52-
return globals.context.asAbsolutePath(path.join('dist', 'src', 'serverlessLand', 'metadata.json'))
51+
return globals.context.asAbsolutePath('dist/src/serverlessLand/metadata.json')
5352
}
5453

5554
/**

packages/core/src/awsService/appBuilder/serverlessLand/wizard.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function promptRuntime(metadataManager: MetadataManager, pattern: string | undef
7171
{
7272
title: localize('AWS.serverlessLand.initWizard.runtime.prompt', 'Select Runtime'),
7373
placeholder: 'Choose a runtime for your project',
74-
buttons: [vscode.QuickInputButtons.Back],
74+
buttons: createCommonButtons(),
7575
}
7676
)
7777
}
@@ -94,24 +94,25 @@ function promptIac(metadataManager: MetadataManager, pattern: string | undefined
9494
{
9595
title: localize('AWS.serverlessLand.initWizard.iac.prompt', 'Select IaC'),
9696
placeholder: 'Choose an IaC option for your project',
97-
buttons: [vscode.QuickInputButtons.Back],
97+
buttons: createCommonButtons(),
9898
}
9999
)
100100
}
101101

102102
function promptLocation() {
103103
return createFolderPrompt(vscode.workspace.workspaceFolders ?? [], {
104104
title: localize('AWS.serverlessLand.initWizard.location.prompt', 'Select Project Location'),
105-
buttons: [vscode.QuickInputButtons.Back],
106-
browseFolderDetail: 'Select a folder for your project',
105+
buttons: createCommonButtons(),
106+
browseFolderDetail: 'Select a parent folder for your project',
107107
})
108108
}
109109

110-
function promptName() {
110+
function promptName(location: vscode.Uri | undefined) {
111+
const folderName = location ? path.basename(location.fsPath) : ''
111112
return createInputBox({
112113
title: localize('AWS.serverlessLand.initWizard.name.prompt', 'Enter Project Name'),
113-
placeholder: 'Enter a name for your new application',
114-
buttons: [vscode.QuickInputButtons.Back],
114+
placeholder: ` ${folderName}/: Enter a name for your new application`,
115+
buttons: createCommonButtons(),
115116
validateInput: (value: string): string | undefined => {
116117
if (!value) {
117118
return 'Application name cannot be empty'
@@ -140,6 +141,6 @@ export class CreateServerlessLandWizard extends Wizard<CreateServerlessLandWizar
140141
this.form.runtime.bindPrompter((state) => promptRuntime(this.metadataManager, state.pattern))
141142
this.form.iac.bindPrompter((state) => promptIac(this.metadataManager, state.pattern))
142143
this.form.location.bindPrompter(() => promptLocation())
143-
this.form.name.bindPrompter(() => promptName())
144+
this.form.name.bindPrompter((state) => promptName(state.location))
144145
}
145146
}

packages/core/src/shared/ui/pickerPrompter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Prompter, PromptResult, Transform } from './prompter'
1212
import { assign, isAsyncIterable } from '../utilities/collectionUtils'
1313
import { recentlyUsed } from '../localizedText'
1414
import { getLogger } from '../logger/logger'
15+
import { openUrl } from '../utilities/vsCodeUtils'
1516
import { MetadataManager } from '../../awsService/appBuilder/serverlessLand/metadataManager'
1617

1718
const localize = nls.loadMessageBundle()
@@ -157,7 +158,7 @@ export function createQuickPick<T>(
157158
if (!patternUrl) {
158159
return
159160
}
160-
await vscode.env.openExternal(vscode.Uri.parse(patternUrl))
161+
await openUrl(vscode.Uri.parse(patternUrl))
161162
})
162163

163164
const prompter =

0 commit comments

Comments
 (0)