Skip to content

Commit eaa4a00

Browse files
authored
Merge #1166 'remove detectLocalLambdas.ts, detectLocalTemplates.ts'
2 parents e4a60e0 + cf2fdd6 commit eaa4a00

File tree

9 files changed

+11
-435
lines changed

9 files changed

+11
-435
lines changed

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@
7777
"default": "prompt",
7878
"markdownDescription": "%AWS.configuration.description.onDefaultRegionMissing%"
7979
},
80-
"aws.sam.template.depth": {
81-
"type": "number",
82-
"default": 4,
83-
"description": "%AWS.configuration.sam.template.depth%"
84-
},
8580
"aws.samcli.location": {
8681
"type": "string",
8782
"default": "",

package.nls.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"AWS.configuration.description.cdk.explorer.enabled": "Enable the AWS CDK Explorer",
1818
"AWS.configuration.description.logLevel": "The AWS Toolkit's log level (changes reflected on restart)",
1919
"AWS.configuration.description.onDefaultRegionMissing": "Action to take when a Profile's default region is hidden in the Explorer. Possible values:\n* `add` - shows region in the explorer\n* `ignore` - does nothing with the region\n* `prompt` - (default) asks the user what they would like to do.",
20-
"AWS.configuration.sam.template.depth": "The maximum subfolder depth within a workspace that the Toolkit will search for SAM Template files",
2120
"AWS.configuration.description.samcli.debug.attach.retry.maximum": "If the Toolkit is unable to attach a debugger, this is the number of times to retry before giving up.",
2221
"AWS.configuration.description.samcli.debug.attach.timeout": "Maximum time (in milliseconds) to wait for SAM output while starting a Local Lambda session",
2322
"AWS.configuration.description.samcli.location": "Location of SAM CLI. SAM CLI is used to create, build, package, and deploy Serverless Applications. [Learn More](https://aws.amazon.com/serverless/sam/)",

src/integrationTest/codelens.js.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ describe('SAM Local CodeLenses (JS)', async () => {
2121
// tslint:disable-next-line:no-invalid-this
2222
this.timeout(ACTIVATE_EXTENSION_TIMEOUT_MILLIS)
2323
await activateExtension(VSCODE_EXTENSION_ID.awstoolkit)
24-
25-
await vscode.workspace.getConfiguration('aws').update('sam.template.depth', 8, false)
2624
})
2725

2826
it('appear when manifest in subfolder and app is beside manifest', async () => {

src/lambda/local/detectLocalLambdas.ts

Lines changed: 0 additions & 76 deletions
This file was deleted.

src/lambda/local/detectLocalTemplates.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/lambda/wizards/samDeployWizard.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55

66
import * as nls from 'vscode-nls'
7+
import * as _ from 'lodash'
8+
79
const localize = nls.loadMessageBundle()
810

911
import * as path from 'path'
@@ -16,11 +18,11 @@ import { getRegionsForActiveCredentials } from '../../shared/regions/regionUtili
1618
import { createHelpButton } from '../../shared/ui/buttons'
1719
import * as input from '../../shared/ui/input'
1820
import * as picker from '../../shared/ui/picker'
19-
import { difference, filter, toArrayAsync } from '../../shared/utilities/collectionUtils'
21+
import { difference, filter } from '../../shared/utilities/collectionUtils'
2022
import { MultiStepWizard, WizardStep } from '../../shared/wizards/multiStepWizard'
2123
import { configureParameterOverrides } from '../config/configureParameterOverrides'
22-
import { detectLocalTemplates } from '../local/detectLocalTemplates'
2324
import { getOverriddenParameters, getParameters } from '../utilities/parameterUtils'
25+
import { CloudFormationTemplateRegistry } from '../../shared/cloudformation/templateRegistry'
2426

2527
export interface SamDeployWizardResponse {
2628
parameterOverrides: Map<string, string>
@@ -36,8 +38,6 @@ export const enum ParameterPromptResult {
3638
}
3739

3840
export interface SamDeployWizardContext {
39-
readonly onDetectLocalTemplates: typeof detectLocalTemplates
40-
4141
readonly workspaceFolders: vscode.Uri[] | undefined
4242

4343
/**
@@ -120,7 +120,6 @@ function getSingleResponse(responses: vscode.QuickPickItem[] | undefined): strin
120120
}
121121

122122
export class DefaultSamDeployWizardContext implements SamDeployWizardContext {
123-
public readonly onDetectLocalTemplates = detectLocalTemplates
124123
public readonly getParameters = getParameters
125124
public readonly getOverriddenParameters = getOverriddenParameters
126125
private readonly helpButton = createHelpButton(localize('AWS.command.help', 'View Toolkit Documentation'))
@@ -148,7 +147,7 @@ export class DefaultSamDeployWizardContext implements SamDeployWizardContext {
148147
),
149148
},
150149
buttons: [this.helpButton, vscode.QuickInputButtons.Back],
151-
items: await getTemplateChoices(this.onDetectLocalTemplates, ...workspaceFolders),
150+
items: await getTemplateChoices(...workspaceFolders),
152151
})
153152

154153
const choices = await picker.promptUser({
@@ -625,16 +624,13 @@ function validateStackName(value: string): string | undefined {
625624
return undefined
626625
}
627626

628-
async function getTemplateChoices(
629-
onDetectLocalTemplates: typeof detectLocalTemplates = detectLocalTemplates,
630-
...workspaceFolders: vscode.Uri[]
631-
): Promise<SamTemplateQuickPickItem[]> {
632-
const uris = await toArrayAsync(onDetectLocalTemplates({ workspaceUris: workspaceFolders }))
633-
627+
async function getTemplateChoices(...workspaceFolders: vscode.Uri[]): Promise<SamTemplateQuickPickItem[]> {
628+
const cfnRegistry = CloudFormationTemplateRegistry.getRegistry()
629+
const templateUris = cfnRegistry.registeredTemplates.map(o => vscode.Uri.file(o.path))
634630
const uriToLabel: Map<vscode.Uri, string> = new Map<vscode.Uri, string>()
635631
const labelCounts: Map<string, number> = new Map()
636632

637-
uris.forEach(uri => {
633+
templateUris.forEach(uri => {
638634
const label = SamTemplateQuickPickItem.getLabel(uri)
639635
uriToLabel.set(uri, label)
640636
labelCounts.set(label, 1 + (labelCounts.get(label) || 0))

src/test/lambda/local/detectLocalLambdas.test.ts

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)