Other files ignored by Codecov
src/test/techdebt.test.ts
has changed.
11 | 11 | // |
|
12 | 12 | // Based on the multiStepInput code in the QuickInput VSCode extension sample. |
|
13 | 13 | ||
14 | + | import * as vscode from 'vscode' |
|
14 | 15 | import * as nls from 'vscode-nls' |
|
15 | 16 | const localize = nls.loadMessageBundle() |
|
16 | 17 | ||
17 | - | import { ExtensionContext, QuickPickItem } from 'vscode' |
|
18 | 18 | import { asString } from '../../credentials/providers/credentials' |
|
19 | 19 | import { SharedCredentialsProvider } from '../../credentials/providers/sharedCredentialsProvider' |
|
20 | 20 | import { MultiStepInputFlowController } from '../multiStepInputFlowController' |
25 | 25 | import { credentialHelpUrl } from '../constants' |
|
26 | 26 | import { createHelpButton } from '../ui/buttons' |
|
27 | 27 | import { recentlyUsed } from '../localizedText' |
|
28 | + | import { getIcon, codicon } from '../icons' |
|
28 | 29 | ||
29 | 30 | interface ProfileEntry { |
|
30 | 31 | profileName: string |
40 | 41 | private readonly _credentialsMru: CredentialsProfileMru |
|
41 | 42 | private readonly helpButton = createHelpButton(credentialHelpUrl) |
|
42 | 43 | ||
43 | - | public constructor(public readonly existingProfileNames: string[], protected context: ExtensionContext) { |
|
44 | + | public constructor(public readonly existingProfileNames: string[], protected context: vscode.ExtensionContext) { |
|
44 | 45 | this._credentialsMru = new CredentialsProfileMru(context) |
|
45 | 46 | } |
|
46 | 47 | ||
47 | 48 | public async pickCredentialProfile( |
|
48 | 49 | input: MultiStepInputFlowController, |
|
50 | + | actions: vscode.QuickPickItem[], |
|
49 | 51 | state: Partial<CredentialSelectionState> |
|
50 | - | ): Promise<QuickPickItem> { |
|
52 | + | ): Promise<vscode.QuickPickItem> { |
|
53 | + | // Remove this stub after we bump minimum to vscode 1.64 |
|
54 | + | const QuickPickItemKind = (vscode as any).QuickPickItemKind |
|
55 | + | const menuTop: vscode.QuickPickItem[] = [ |
|
56 | + | // vscode 1.64 supports QuickPickItemKind.Separator. |
|
57 | + | // https://github.com/microsoft/vscode/commit/eb416b4f9ebfda1c798aa7c8b2f4e81c6ce1984f |
|
58 | + | ...(!QuickPickItemKind |
|
59 | + | ? [] |
|
60 | + | : [ |
|
61 | + | { |
|
62 | + | label: localize('AWS.menu.actions', 'Actions'), |
|
63 | + | kind: QuickPickItemKind.Separator, |
|
64 | + | } as vscode.QuickPickItem, |
|
65 | + | ]), |
|
66 | + | ...actions, |
|
67 | + | ...(!QuickPickItemKind |
|
68 | + | ? [] |
|
69 | + | : [ |
|
70 | + | { |
|
71 | + | label: localize('AWS.menu.profiles', 'Profiles'), |
|
72 | + | kind: QuickPickItemKind.Separator, |
|
73 | + | } as vscode.QuickPickItem, |
|
74 | + | ]), |
|
75 | + | ] |
|
76 | + | ||
51 | 77 | return await input.showQuickPick({ |
|
52 | 78 | title: localize( |
|
53 | 79 | 'AWS.title.selectCredentialProfile', |
57 | 83 | step: 1, |
|
58 | 84 | totalSteps: 1, |
|
59 | 85 | placeholder: localize('AWS.placeHolder.selectProfile', 'Select a credential profile'), |
|
60 | - | items: this.getProfileSelectionList(), |
|
86 | + | items: menuTop.concat(this.getProfileSelectionList()), |
|
61 | 87 | activeItem: state.credentialProfile, |
|
62 | 88 | shouldResume: this.shouldResume.bind(this), |
|
63 | 89 | }) |
163 | 189 | /** |
|
164 | 190 | * Builds and returns the list of QuickPickItem objects representing the profile names to select from in the UI |
|
165 | 191 | */ |
|
166 | - | private getProfileSelectionList(): QuickPickItem[] { |
|
192 | + | private getProfileSelectionList(): vscode.QuickPickItem[] { |
|
167 | 193 | const orderedProfiles: ProfileEntry[] = this.getOrderedProfiles() |
|
168 | 194 | ||
169 | - | const selectionList: QuickPickItem[] = [] |
|
195 | + | const selectionList: vscode.QuickPickItem[] = [] |
|
170 | 196 | orderedProfiles.forEach(profile => { |
|
171 | - | const selectionItem: QuickPickItem = { label: profile.profileName } |
|
197 | + | const selectionItem: vscode.QuickPickItem = { label: profile.profileName } |
|
172 | 198 | ||
173 | 199 | if (profile.isRecentlyUsed) { |
|
174 | 200 | selectionItem.description = recentlyUsed |
230 | 256 | input: MultiStepInputFlowController, |
|
231 | 257 | state: Partial<CredentialSelectionState> |
|
232 | 258 | ) { |
|
233 | - | state.credentialProfile = await dataProvider.pickCredentialProfile(input, state) |
|
259 | + | const actions = [ |
|
260 | + | { |
|
261 | + | label: localize('AWS.credentials.edit', '{0} Edit Credentials', codicon`${getIcon('vscode-edit')}`), |
|
262 | + | alwaysShow: true, |
|
263 | + | description: localize('AWS.credentials.edit.desc', 'open ~/.aws/credentials'), |
|
264 | + | }, |
|
265 | + | ] |
|
266 | + | const item = await dataProvider.pickCredentialProfile(input, actions, state) |
|
267 | + | if (item.label === actions[0].label) { |
|
268 | + | vscode.commands.executeCommand('aws.credentials.edit') |
|
269 | + | } else { |
|
270 | + | state.credentialProfile = item |
|
271 | + | } |
|
234 | 272 | } |
|
235 | 273 | ||
236 | 274 | async function collectInputs() { |
|
237 | 275 | const state: Partial<CredentialSelectionState> = {} |
|
238 | 276 | await MultiStepInputFlowController.run(async input => await pickCredentialProfile(input, state)) |
|
239 | - | ||
240 | 277 | return state as CredentialSelectionState |
|
241 | 278 | } |
|
242 | 279 |
Files | Coverage |
---|---|
src | 66.88% |
Project Totals (409 files) | 66.88% |
1 |
# To validate:
|
2 |
# cat codecov.yml | curl --data-binary @- https://codecov.io/validate
|
3 |
|
4 |
codecov: |
5 |
notify: |
6 |
require_ci_to_pass: no |
7 |
|
8 |
coverage: |
9 |
precision: 2 |
10 |
round: down |
11 |
range: '70...100' |
12 |
|
13 |
status: |
14 |
project: |
15 |
default: |
16 |
threshold: 1 |
17 |
informational: true |
18 |
patch: no |
19 |
changes: no |
20 |
|
21 |
comment: off |
22 |
|
23 |
github_checks: |
24 |
annotations: false |