Skip to content

Commit 9acd026

Browse files
committed
rename variables
1 parent f2b56ea commit 9acd026

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
109109
override fun listCustomizations(project: Project, passive: Boolean): List<CustomizationUiItem>? =
110110
calculateIfIamIdentityCenterConnection(project) {
111111
// 1. fetch all profiles, invoke fetch customizations API and get result for each profile and aggregate all the results
112-
val listAvailableProfilesResult = QRegionProfileManager.getInstance().listRegionProfiles(project)
112+
val profiles = QRegionProfileManager.getInstance().listRegionProfiles(project)
113113
?: error("Attempted to fetch profiles while there does not exist")
114114

115-
val aggregatedCustomizations = listAvailableProfilesResult.flatMap { profile ->
115+
val customizations = profiles.flatMap { profile ->
116116
runCatching {
117117
CodeWhispererClientAdaptor.getInstance(project).listAvailableCustomizations(profile)
118118
}.onFailure { e ->
@@ -125,7 +125,7 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
125125

126126
// 2. get diff
127127
val previousCustomizationsShapshot = connectionToCustomizationsShownLastTime.getOrElse(it.id) { emptyList() }
128-
val diff = aggregatedCustomizations.filterNot { customization -> previousCustomizationsShapshot.contains(customization.arn) }.toSet()
128+
val diff = customizations.filterNot { customization -> previousCustomizationsShapshot.contains(customization.arn) }.toSet()
129129

130130
// 3 if passive,
131131
// (1) update allowlisting
@@ -134,31 +134,31 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
134134
// if not passive,
135135
// (1) update the customization list snapshot (seen by users last time) if it will be displayed
136136
if (passive) {
137-
connectionIdToIsAllowlisted[it.id] = aggregatedCustomizations.isNotEmpty()
137+
connectionIdToIsAllowlisted[it.id] = customizations.isNotEmpty()
138138
if (diff.isNotEmpty() && !hasShownNewCustomizationNotification.getAndSet(true)) {
139139
notifyNewCustomization(project)
140140
}
141141
} else {
142-
connectionToCustomizationsShownLastTime[it.id] = aggregatedCustomizations.map { customization -> customization.arn }.toMutableList()
142+
connectionToCustomizationsShownLastTime[it.id] = customizations.map { customization -> customization.arn }.toMutableList()
143143
}
144144

145145
// 4. invalidate selected customization if
146146
// (1) the API call failed
147147
// (2) the selected customization is not in the resultset of API call
148148
// (3) the existing q region profile associated with the selected customization does not match the currently active profile
149149
activeCustomization(project)?.let { activeCustom ->
150-
if (aggregatedCustomizations.isEmpty()) {
150+
if (customizations.isEmpty()) {
151151
invalidateSelectedAndNotify(project)
152-
} else if (!aggregatedCustomizations.any { latestCustom -> latestCustom.arn == activeCustom.arn } ||
152+
} else if (!customizations.any { latestCustom -> latestCustom.arn == activeCustom.arn } ||
153153
(activeCustom.profile != null && activeCustom.profile != QRegionProfileManager.getInstance().activeProfile(project))
154154
) {
155155
invalidateSelectedAndNotify(project)
156156
}
157157
}
158158

159159
// 5. transform result to UI items and return
160-
val nameToCount = aggregatedCustomizations.groupingBy { customization -> customization.name }.eachCount()
161-
val customizationUiItems = aggregatedCustomizations.map { customization ->
160+
val nameToCount = customizations.groupingBy { customization -> customization.name }.eachCount()
161+
val customizationUiItems = customizations.map { customization ->
162162
CustomizationUiItem(
163163
customization,
164164
isNew = diff.contains(customization),

0 commit comments

Comments
 (0)