@@ -229,7 +229,7 @@ export class GlobalState implements vscode.Memento {
229229 }
230230
231231 /**
232- * Get the codewhisperer customerization . If legacy (map of customizations) store the
232+ * Get the codewhisperer customization . If legacy (map of customizations) store the
233233 * customization with label of profile name
234234 *
235235 * @param profileName name of profile, only used in case legacy customization is found
@@ -249,6 +249,32 @@ export class GlobalState implements vscode.Memento {
249249 }
250250 }
251251
252+ /**
253+ * Get the codewhisperer persisted customizations. If legacy (map of customizations) store the
254+ * customizations with label of profile name
255+ *
256+ * @param profileName name of profile, only used in case legacy customization is found
257+ * @returns array of codewhisperer persisted customizations, or empty array if not found.
258+ * If legacy, return the codewhisperer persisted customizations for the auth profile name
259+ */
260+ getCodewhispererPersistedCCustomization ( profileName : string ) : Customization [ ] {
261+ const result = this . tryGet < Customization [ ] > ( 'CODEWHISPERER_PERSISTED_CUSTOMIZATIONS' , Array , [ ] )
262+
263+ // Legacy migration for old customization map of type { [label: string]: Customization[] }
264+ if ( result . length === 0 ) {
265+ const customizations = this . tryGet < { [ label : string ] : Customization [ ] } > (
266+ 'CODEWHISPERER_PERSISTED_CUSTOMIZATIONS' ,
267+ Object ,
268+ { }
269+ )
270+ const persistedCustomizationsArray = customizations [ profileName ] || [ ]
271+ this . tryUpdate ( 'CODEWHISPERER_PERSISTED_CUSTOMIZATIONS' , persistedCustomizationsArray )
272+ return persistedCustomizationsArray
273+ } else {
274+ return result
275+ }
276+ }
277+
252278 /**
253279 * Sets SSO session creation timestamp for the given session `id`.
254280 *
0 commit comments