Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import software.amazon.awssdk.services.codewhispererruntime.model.GetCodeFixJobR
import software.amazon.awssdk.services.codewhispererruntime.model.GetTestGenerationResponse
import software.amazon.awssdk.services.codewhispererruntime.model.IdeCategory
import software.amazon.awssdk.services.codewhispererruntime.model.InlineChatUserDecision
import software.amazon.awssdk.services.codewhispererruntime.model.ListAvailableCustomizationsRequest
import software.amazon.awssdk.services.codewhispererruntime.model.ListCodeAnalysisFindingsRequest
import software.amazon.awssdk.services.codewhispererruntime.model.ListCodeAnalysisFindingsResponse
import software.amazon.awssdk.services.codewhispererruntime.model.ListFeatureEvaluationsResponse
Expand All @@ -35,8 +34,6 @@ import software.amazon.awssdk.services.codewhispererruntime.model.StartTestGener
import software.amazon.awssdk.services.codewhispererruntime.model.SuggestionState
import software.amazon.awssdk.services.codewhispererruntime.model.TargetCode
import software.amazon.awssdk.services.codewhispererruntime.model.UserIntent
import software.aws.toolkits.core.utils.debug
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.jetbrains.services.amazonq.codeWhispererUserContext
import software.aws.toolkits.jetbrains.services.amazonq.profile.QRegionProfileManager
import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererCustomization
Expand Down Expand Up @@ -78,8 +75,6 @@ interface CodeWhispererClientAdaptor {

fun getCodeFixJob(request: GetCodeFixJobRequest): GetCodeFixJobResponse

fun listAvailableCustomizations(): List<CodeWhispererCustomization>

fun startTestGeneration(uploadId: String, targetCode: List<TargetCode>, userInput: String): StartTestGenerationResponse

fun getTestGeneration(jobId: String, jobGroupName: String): GetTestGenerationResponse
Expand Down Expand Up @@ -281,28 +276,6 @@ open class CodeWhispererClientAdaptorImpl(override val project: Project) : CodeW

override fun getCodeFixJob(request: GetCodeFixJobRequest): GetCodeFixJobResponse = bearerClient().getCodeFixJob(request)

// DO NOT directly use this method to fetch customizations, use wrapper [CodeWhispererModelConfigurator.listCustomization()] instead
override fun listAvailableCustomizations(): List<CodeWhispererCustomization> =
bearerClient().listAvailableCustomizationsPaginator(
ListAvailableCustomizationsRequest.builder().profileArn(QRegionProfileManager.getInstance().activeProfile(project)?.arn).build()
)
.stream()
.toList()
.flatMap { resp ->
LOG.debug {
"listAvailableCustomizations: requestId: ${resp.responseMetadata().requestId()}, customizations: ${
resp.customizations().map { it.name() }
}"
}
resp.customizations().map {
CodeWhispererCustomization(
arn = it.arn(),
name = it.name(),
description = it.description()
)
}
}

override fun startTestGeneration(uploadId: String, targetCode: List<TargetCode>, userInput: String): StartTestGenerationResponse =
bearerClient().startTestGeneration { builder ->
builder.uploadId(uploadId)
Expand Down Expand Up @@ -799,10 +772,6 @@ open class CodeWhispererClientAdaptorImpl(override val project: Project) : CodeW
requestBuilder.userContext(codeWhispererUserContext())
requestBuilder.profileArn(QRegionProfileManager.getInstance().activeProfile(project)?.arn)
}

companion object {
private val LOG = getLogger<CodeWhispererClientAdaptorImpl>()
}
}

private fun CodewhispererSuggestionState.toCodeWhispererSdkType() = when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhisperer
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererUtil.getTelemetryOptOutPreference
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererUtil.notifyErrorCodeWhispererUsageLimit
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererUtil.promptReAuth
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CustomizationConstants
import software.aws.toolkits.jetbrains.services.codewhisperer.util.FileContextProvider
import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
import software.aws.toolkits.jetbrains.utils.isInjectedText
Expand Down Expand Up @@ -333,7 +334,7 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable {
val displayMessage: String

if (
CodeWhispererConstants.Customization.invalidCustomizationExceptionPredicate(e) ||
CustomizationConstants.invalidCustomizationExceptionPredicate(e) ||
e is ResourceNotFoundException
) {
(e as CodeWhispererRuntimeException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhisperer
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererUtil.getTelemetryOptOutPreference
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererUtil.notifyErrorCodeWhispererUsageLimit
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererUtil.promptReAuth
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CustomizationConstants
import software.aws.toolkits.jetbrains.services.codewhisperer.util.FileContextProvider
import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
import software.aws.toolkits.jetbrains.utils.isInjectedText
Expand Down Expand Up @@ -360,7 +361,7 @@ class CodeWhispererServiceNew(private val cs: CoroutineScope) : Disposable {
val displayMessage: String

if (
CodeWhispererConstants.Customization.invalidCustomizationExceptionPredicate(e) ||
CustomizationConstants.invalidCustomizationExceptionPredicate(e) ||
e is ResourceNotFoundException
) {
(e as CodeWhispererRuntimeException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import com.intellij.openapi.editor.markup.EffectType
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.ui.JBColor
import software.amazon.awssdk.regions.Region
import software.amazon.awssdk.services.codewhispererruntime.model.AccessDeniedException
import software.amazon.awssdk.services.codewhispererruntime.model.CodeWhispererRuntimeException
import software.aws.toolkits.jetbrains.services.codewhisperer.codescan.CodeScanResponse
import software.aws.toolkits.jetbrains.services.codewhisperer.language.languages.CodeWhispererJava
import software.aws.toolkits.telemetry.CodewhispererGettingStartedTask
Expand Down Expand Up @@ -59,7 +57,6 @@ object CodeWhispererConstants {
val scanResultsKey = DataKey.create<CodeScanResponse>("amazonq.codescan.result")
val scanScopeKey = DataKey.create<CodeAnalysisScope>("amazonq.codescan.scope")

const val Q_CUSTOM_LEARN_MORE_URI = "https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/customizations.html"
const val Q_SUPPORTED_LANG_URI = "https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/q-language-ide-support.html"
const val CODEWHISPERER_CODE_SCAN_LEARN_MORE_URI = "https://docs.aws.amazon.com/codewhisperer/latest/userguide/security-scans.html"
const val CODEWHISPERER_ONBOARDING_DOCUMENTATION_URI = "https://docs.aws.amazon.com/codewhisperer/latest/userguide/features.html"
Expand Down Expand Up @@ -157,27 +154,6 @@ object CodeWhispererConstants {
val Sigv4ClientRegion = Region.US_EAST_1
}

object Customization {
private const val noAccessToCustomizationMessage = "Your account is not authorized to use CodeWhisperer Enterprise."
private const val invalidCustomizationMessage = "You are not authorized to access"

val noAccessToCustomizationExceptionPredicate: (e: Exception) -> Boolean = { e ->
if (e !is CodeWhispererRuntimeException) {
false
} else {
e is AccessDeniedException && (e.message?.contains(noAccessToCustomizationMessage, ignoreCase = true) ?: false)
}
}

val invalidCustomizationExceptionPredicate: (e: Exception) -> Boolean = { e ->
if (e !is CodeWhispererRuntimeException) {
false
} else {
e is AccessDeniedException && (e.message?.contains(invalidCustomizationMessage, ignoreCase = true) ?: false)
}
}
}

object CrossFile {
const val CHUNK_SIZE = 60
const val NUMBER_OF_LINE_IN_CHUNK = 50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@ import software.amazon.awssdk.services.codewhispererruntime.model.CodeAnalysisSt
import software.amazon.awssdk.services.codewhispererruntime.model.CompletionType
import software.amazon.awssdk.services.codewhispererruntime.model.CreateUploadUrlRequest
import software.amazon.awssdk.services.codewhispererruntime.model.CreateUploadUrlResponse
import software.amazon.awssdk.services.codewhispererruntime.model.Customization
import software.amazon.awssdk.services.codewhispererruntime.model.GenerateCompletionsRequest
import software.amazon.awssdk.services.codewhispererruntime.model.GetCodeAnalysisRequest
import software.amazon.awssdk.services.codewhispererruntime.model.GetCodeAnalysisResponse
import software.amazon.awssdk.services.codewhispererruntime.model.IdeCategory
import software.amazon.awssdk.services.codewhispererruntime.model.ListAvailableCustomizationsRequest
import software.amazon.awssdk.services.codewhispererruntime.model.ListAvailableCustomizationsResponse
import software.amazon.awssdk.services.codewhispererruntime.model.ListCodeAnalysisFindingsRequest
import software.amazon.awssdk.services.codewhispererruntime.model.ListCodeAnalysisFindingsResponse
import software.amazon.awssdk.services.codewhispererruntime.model.ListFeatureEvaluationsRequest
Expand All @@ -51,7 +48,6 @@ import software.amazon.awssdk.services.codewhispererruntime.model.StartCodeAnaly
import software.amazon.awssdk.services.codewhispererruntime.model.StartCodeAnalysisResponse
import software.amazon.awssdk.services.codewhispererruntime.model.SuggestionState
import software.amazon.awssdk.services.codewhispererruntime.paginators.GenerateCompletionsIterable
import software.amazon.awssdk.services.codewhispererruntime.paginators.ListAvailableCustomizationsIterable
import software.amazon.awssdk.services.ssooidc.SsoOidcClient
import software.aws.toolkits.core.utils.test.aString
import software.aws.toolkits.jetbrains.core.MockClientManagerRule
Expand Down Expand Up @@ -158,48 +154,6 @@ class CodeWhispererClientAdaptorTest {
.isInstanceOf(CodeWhispererRuntimeClient::class.java)
}

@Test
fun `listCustomizations`() {
val sdkIterable = ListAvailableCustomizationsIterable(bearerClient, ListAvailableCustomizationsRequest.builder().build())
val mockResponse1 = ListAvailableCustomizationsResponse.builder()
.customizations(
listOf(
Customization.builder().name("custom-1").arn("arn-1").build(),
Customization.builder().name("custom-2").arn("arn-2").build()
)
)
.nextToken("token-1")
.responseMetadata(metadata)
.sdkHttpResponse(sdkHttpResponse)
.build() as ListAvailableCustomizationsResponse

val mockResponse2 = ListAvailableCustomizationsResponse.builder()
.customizations(
listOf(
Customization.builder().name("custom-3").arn("arn-3").build(),
)
)
.nextToken("")
.responseMetadata(metadata)
.sdkHttpResponse(sdkHttpResponse)
.build() as ListAvailableCustomizationsResponse

bearerClient.stub { client ->
on { client.listAvailableCustomizations(any<ListAvailableCustomizationsRequest>()) } doReturnConsecutively listOf(mockResponse1, mockResponse2)
on { client.listAvailableCustomizationsPaginator(any<ListAvailableCustomizationsRequest>()) } doReturn sdkIterable
}

val actual = sut.listAvailableCustomizations()
assertThat(actual).hasSize(3)
assertThat(actual).isEqualTo(
listOf(
CodeWhispererCustomization(name = "custom-1", arn = "arn-1"),
CodeWhispererCustomization(name = "custom-2", arn = "arn-2"),
CodeWhispererCustomization(name = "custom-3", arn = "arn-3")
)
)
}

@Test
fun `generateCompletionsPaginator - bearer`() {
val request = pythonRequest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package migration.software.aws.toolkits.jetbrains.services.codewhisperer.customization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package software.aws.toolkits.jetbrains.services.amazonq.lsp

import com.intellij.notification.NotificationType
import com.intellij.openapi.project.Project
import migration.software.aws.toolkits.jetbrains.settings.AwsSettings
import org.eclipse.lsp4j.ConfigurationParams
import org.eclipse.lsp4j.MessageActionItem
import org.eclipse.lsp4j.MessageParams
Expand All @@ -18,6 +19,7 @@ import software.aws.toolkits.jetbrains.core.credentials.pinning.QConnection
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.ChatCommunicationManager
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.credentials.ConnectionMetadata
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.credentials.SsoProfileData
import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
import java.util.concurrent.CompletableFuture

Expand Down Expand Up @@ -79,14 +81,31 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC

return CompletableFuture.completedFuture(
buildList {
val qSettings = CodeWhispererSettings.getInstance()
params.items.forEach {
when (it.section) {
AmazonQLspConstants.LSP_CW_CONFIGURATION_KEY -> {
add(
CodeWhispererLspConfiguration(
shouldShareData = CodeWhispererSettings.getInstance().isMetricOptIn(),
shouldShareCodeReferences = CodeWhispererSettings.getInstance().isIncludeCodeWithReference(),
shouldEnableWorkspaceContext = CodeWhispererSettings.getInstance().isWorkspaceContextEnabled()
shouldShareData = qSettings.isMetricOptIn(),
shouldShareCodeReferences = qSettings.isIncludeCodeWithReference(),
// server context
shouldEnableWorkspaceContext = qSettings.isWorkspaceContextEnabled()
)
)
}
AmazonQLspConstants.LSP_Q_CONFIGURATION_KEY -> {
add(
AmazonQLspConfiguration(
optOutTelemetry = AwsSettings.getInstance().isTelemetryEnabled,
customization = CodeWhispererModelConfigurator.getInstance().activeCustomization(project)?.arn,
// local context
enableLocalIndexing = qSettings.isProjectContextEnabled(),
indexWorkerThreads = qSettings.getProjectContextIndexThreadCount(),
enableGpuAcceleration = qSettings.isProjectContextGpu(),
localIndexing = LocalIndexingConfiguration(
maxIndexSizeMB = qSettings.getProjectContextIndexMaxSize()
)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package software.aws.toolkits.jetbrains.services.amazonq.lsp

import com.google.gson.annotations.SerializedName

data class AmazonQLspConfiguration(
@SerializedName(AmazonQLspConstants.LSP_OPT_OUT_TELEMETRY_CONFIGURATION_KEY)
val optOutTelemetry: Boolean? = null,

@SerializedName(AmazonQLspConstants.LSP_ENABLE_TELEMETRY_EVENTS_CONFIGURATION_KEY)
Copy link
Contributor Author

@samgst-amazon samgst-amazon Mar 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag enableTelemetryEventsToDestination is set to true temporarily. It's value will be determined through destination configuration post all events migration to STE. It'll be replaced by qConfig['enableTelemetryEventsToDestination'] === true

This is not currently being used but will be in future migrations. not exactly sure what it should be pointing to in current codebase

val enableTelemetryEvents: Boolean? = null,

@SerializedName(AmazonQLspConstants.LSP_CUSTOMIZATION_CONFIGURATION_KEY)
val customization: String? = null,

val enableLocalIndexing: Boolean? = null,

val enableGpuAcceleration: Boolean? = null,

val indexWorkerThreads: Int? = null,

val localIndexing: LocalIndexingConfiguration? = null,
)

data class LocalIndexingConfiguration(
val ignoreFilePatterns: List<String>? = null,
val maxFileSizeMB: Int? = null,
val maxIndexSizeMB: Int? = null,
val indexCacheDirPath: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ object AmazonQLspConstants {
const val LSP_CW_CONFIGURATION_KEY = "aws.codeWhisperer"
const val LSP_CW_OPT_OUT_KEY = "shareCodeWhispererContentWithAWS"
const val LSP_CODE_REFERENCES_OPT_OUT_KEY = "includeSuggestionsWithCodeReferences"
const val LSP_Q_CONFIGURATION_KEY = "aws.q"
const val LSP_OPT_OUT_TELEMETRY_CONFIGURATION_KEY = "optOutTelemetry"
const val LSP_ENABLE_TELEMETRY_EVENTS_CONFIGURATION_KEY = "enableTelemetryEventsToDestination"
const val LSP_CUSTOMIZATION_CONFIGURATION_KEY = "customization"
const val LSP_WORKSPACE_CONTEXT_ENABLED_KEY = "workspaceContext"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ package software.aws.toolkits.jetbrains.services.codewhisperer.customization

data class CodeWhispererCustomization(
@JvmField
var arn: String = "",
val arn: String = "",

@JvmField
var name: String = "",
val name: String = "",

@JvmField
var description: String? = null,
val description: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,31 @@
import software.aws.toolkits.core.utils.debug
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.tryOrNull
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.Q_CUSTOM_LEARN_MORE_URI
import software.aws.toolkits.jetbrains.ui.AsyncComboBox
import software.aws.toolkits.jetbrains.utils.notifyInfo
import software.aws.toolkits.resources.message

Check warning on line 31 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

Remove deprecated symbol import
import javax.swing.JComponent
import javax.swing.JList

private val NoDataToDisplay = CustomizationUiItem(
CodeWhispererCustomization("", message("codewhisperer.custom.dialog.option.no_data"), ""),

Check warning on line 36 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
false,

Check notice on line 37 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Boolean literal argument without parameter name

Boolean literal argument without a parameter name
false

Check notice on line 38 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Boolean literal argument without parameter name

Boolean literal argument without a parameter name
)

private fun notifyCustomizationIsSelected(project: Project, customizationUiItem: CustomizationUiItem?) {
// TODO: localize
val content = customizationUiItem?.let {
"Amazon Q inline suggestions are now coming from the ${it.customization.name} customization"
} ?: "Amazon Q inline suggestions are now coming from the ${message("codewhisperer.custom.dialog.option.default")}"

Check warning on line 45 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead

notifyInfo(
title = message("codewhisperer.custom.dialog.title"),

Check warning on line 48 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
content = content,
project = project,
notificationActions = listOf(
NotificationAction.create(
message("codewhisperer.notification.custom.simple.button.got_it")

Check warning on line 53 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
) { _, notification -> notification.expire() }
)
)
Expand Down Expand Up @@ -81,8 +80,8 @@
private val panel: DialogPanel by lazy { drawPanel() }

init {
title = message("codewhisperer.custom.dialog.title")

Check warning on line 83 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
setOKButtonText(message("codewhisperer.custom.dialog.ok_button.text"))

Check warning on line 84 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead

val selectedOption = CodeWhispererModelConfigurator.getInstance().activeCustomization(project)?.let {
RadioButtonOption.Customization
Expand Down Expand Up @@ -128,7 +127,7 @@
// TODO: check if we can render a multi-line combo box
private fun drawPanel() = panel {
row {
label(message("codewhisperer.custom.dialog.panel.title")).bold()

Check warning on line 130 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
}

lateinit var customizationButton: Cell<JBRadioButton>
Expand All @@ -137,8 +136,8 @@

buttonsGroup {
row {
defaultButton = radioButton(message("codewhisperer.custom.dialog.option.default"), RadioButtonOption.Default)

Check warning on line 139 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
.comment(message("codewhisperer.custom.dialog.model.default.comment"))

Check warning on line 140 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
.actionListener { _, component ->
if (component.isSelected) {
isOKActionEnabled = CodeWhispererModelConfigurator.getInstance().activeCustomization(project) != null
Expand All @@ -147,7 +146,7 @@
}.topGap(TopGap.MEDIUM)

row {
customizationButton = radioButton(message("codewhisperer.custom.dialog.option.customization"), RadioButtonOption.Customization)

Check warning on line 149 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
.actionListener { _, component ->
if (component.isSelected) {
isOKActionEnabled =
Expand All @@ -162,11 +161,16 @@
lateinit var customizationComment: Row
indent {
noCustomizationComment = row("") {
rowComment(message("codewhisperer.custom.dialog.option.customization.description.no_customization", Q_CUSTOM_LEARN_MORE_URI))
rowComment(
message(

Check warning on line 165 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
"codewhisperer.custom.dialog.option.customization.description.no_customization",
"https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/customizations.html"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a const or do we expect this value to be updated?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly it should probably just be in the localization bundle

)
)
}.visible(false)

customizationComment = row("") {
rowComment(message("codewhisperer.custom.dialog.option.customization.description"))

Check warning on line 173 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
}.visible(false)
}

Expand Down Expand Up @@ -242,7 +246,7 @@
}
}

private object CustomizationRenderer : ColoredListCellRenderer<CustomizationUiItem>() {

Check warning on line 249 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Serializable object must implement 'readResolve'

Serializable object must implement 'readResolve'
override fun customizeCellRenderer(
list: JList<out CustomizationUiItem>,
value: CustomizationUiItem?,
Expand All @@ -265,7 +269,7 @@

if (it != NoDataToDisplay) {
val description = if (it.customization.description.isNullOrBlank()) {
message("codewhisperer.custom.dialog.customization.no_description")

Check warning on line 272 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererCustomizationDialog.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
} else {
it.customization.description
}
Expand Down
Loading
Loading