Skip to content

Commit 310ff24

Browse files
committed
Merge remote-tracking branch 'origin/main' into rli/251-profile
2 parents 4d08413 + 325d1d7 commit 310ff24

File tree

39 files changed

+713
-104
lines changed

39 files changed

+713
-104
lines changed

.changes/3.50.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"date" : "2025-01-23",
3+
"version" : "3.50",
4+
"entries" : [ {
5+
"type" : "feature",
6+
"description" : "Amazon Q: Updated `/help` command to include re:invent 2024 features"
7+
}, {
8+
"type" : "feature",
9+
"description" : "Amazon Q: UI improvements through more accurate code syntax highlighting"
10+
}, {
11+
"type" : "bugfix",
12+
"description" : "Fixed an issue where Amazon Q settings did not persist across IDE restarts"
13+
}, {
14+
"type" : "bugfix",
15+
"description" : "Amazon Q: Fix context menu displaying when typing `@`, even though input is disallowed"
16+
}, {
17+
"type" : "bugfix",
18+
"description" : "Amazon Q: Fix up/down history navigation only triggering on first/last line of prompt input"
19+
}, {
20+
"type" : "bugfix",
21+
"description" : "Amazon Q /doc: Ask for user prompt if error occurs while updating documentation"
22+
}, {
23+
"type" : "bugfix",
24+
"description" : "Amazon Q: cursor no longer jumps after navigating prompt history"
25+
}, {
26+
"type" : "bugfix",
27+
"description" : "Improve text description of workspace index settings"
28+
}, {
29+
"type" : "bugfix",
30+
"description" : "Amazon Q /doc: fix for user prompt to change folder in chat"
31+
}, {
32+
"type" : "bugfix",
33+
"description" : "Amazon Q Doc README diff will re-open when the README file is clicked after it has been closed"
34+
}, {
35+
"type" : "bugfix",
36+
"description" : "Amazon Q /test: Fix for test generation payload creation to not filter out target file."
37+
}, {
38+
"type" : "bugfix",
39+
"description" : "Amazon Q: word duplication when pressing tab on context selector fixed"
40+
} ]
41+
}

.changes/next-release/bugfix-f47212d1-8e2b-4c82-9e0d-450ce896e9bc.json

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

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# _3.50_ (2025-01-23)
2+
- **(Feature)** Amazon Q: Updated `/help` command to include re:invent 2024 features
3+
- **(Feature)** Amazon Q: UI improvements through more accurate code syntax highlighting
4+
- **(Bug Fix)** Fixed an issue where Amazon Q settings did not persist across IDE restarts
5+
- **(Bug Fix)** Amazon Q: Fix context menu displaying when typing `@`, even though input is disallowed
6+
- **(Bug Fix)** Amazon Q: Fix up/down history navigation only triggering on first/last line of prompt input
7+
- **(Bug Fix)** Amazon Q /doc: Ask for user prompt if error occurs while updating documentation
8+
- **(Bug Fix)** Amazon Q: cursor no longer jumps after navigating prompt history
9+
- **(Bug Fix)** Improve text description of workspace index settings
10+
- **(Bug Fix)** Amazon Q /doc: fix for user prompt to change folder in chat
11+
- **(Bug Fix)** Amazon Q Doc README diff will re-open when the README file is clicked after it has been closed
12+
- **(Bug Fix)** Amazon Q /test: Fix for test generation payload creation to not filter out target file.
13+
- **(Bug Fix)** Amazon Q: word duplication when pressing tab on context selector fixed
14+
115
# _3.49_ (2025-01-17)
216
- **(Bug Fix)** /review: Improved success rate of code reviews for certain workspace configurations
317

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Toolkit Version
5-
toolkitVersion=3.50-SNAPSHOT
5+
toolkitVersion=3.51-SNAPSHOT
66

77
# Publish Settings
88
publishToken=

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQToolWindowFactory.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware {
5858
}
5959
val contentManager = toolWindow.contentManager
6060

61-
project.messageBus.connect().subscribe(
61+
project.messageBus.connect(toolWindow.disposable).subscribe(
6262
ToolkitConnectionManagerListener.TOPIC,
6363
object : ToolkitConnectionManagerListener {
6464
override fun activeConnectionChanged(newConnection: ToolkitConnection?) {
@@ -67,7 +67,7 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware {
6767
}
6868
)
6969

70-
project.messageBus.connect().subscribe(
70+
project.messageBus.connect(toolWindow.disposable).subscribe(
7171
RefreshQChatPanelButtonPressedListener.TOPIC,
7272
object : RefreshQChatPanelButtonPressedListener {
7373
override fun onRefresh() {
@@ -78,7 +78,7 @@ class AmazonQToolWindowFactory : ToolWindowFactory, DumbAware {
7878
}
7979
)
8080

81-
project.messageBus.connect().subscribe(
81+
project.messageBus.connect(toolWindow.disposable).subscribe(
8282
BearerTokenProviderListener.TOPIC,
8383
object : BearerTokenProviderListener {
8484
override fun onChange(providerId: String, newScopes: List<String>?) {

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeScan/controller/CodeScanChatHelper.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import software.aws.toolkits.jetbrains.services.amazonqCodeScan.messages.CodeSca
1111
import software.aws.toolkits.jetbrains.services.amazonqCodeScan.messages.CodeScanChatMessageContent
1212
import software.aws.toolkits.jetbrains.services.amazonqCodeScan.messages.UpdatePlaceholderMessage
1313
import software.aws.toolkits.jetbrains.services.amazonqCodeScan.storage.ChatSessionStorage
14+
import software.aws.toolkits.jetbrains.services.codewhisperer.telemetry.QFeatureEvent
15+
import software.aws.toolkits.jetbrains.services.codewhisperer.telemetry.broadcastQEvent
1416
import software.aws.toolkits.jetbrains.services.cwc.messages.ChatMessageType
1517
import java.util.UUID
1618

@@ -34,7 +36,7 @@ class CodeScanChatHelper(
3436
clearPreviousItemButtons: Boolean? = false,
3537
) {
3638
if (isInValidSession()) return
37-
39+
broadcastQEvent(QFeatureEvent.INVOCATION)
3840
messagePublisher.publish(
3941
CodeScanChatMessage(
4042
tabId = activeCodeScanTabId as String,

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/controller/CodeTestChatController.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendA
7171
import software.aws.toolkits.jetbrains.services.codewhisperer.credentials.CodeWhispererClientAdaptor
7272
import software.aws.toolkits.jetbrains.services.codewhisperer.language.CodeWhispererProgrammingLanguage
7373
import software.aws.toolkits.jetbrains.services.codewhisperer.language.programmingLanguage
74+
import software.aws.toolkits.jetbrains.services.codewhisperer.telemetry.QFeatureEvent
75+
import software.aws.toolkits.jetbrains.services.codewhisperer.telemetry.broadcastQEvent
7476
import software.aws.toolkits.jetbrains.services.codewhisperer.toolwindow.CodeWhispererCodeReferenceManager
7577
import software.aws.toolkits.jetbrains.services.codewhisperer.util.isWithin
7678
import software.aws.toolkits.jetbrains.services.cwc.ChatConstants
@@ -1205,6 +1207,7 @@ class CodeTestChatController(
12051207
"Processing message: $message " +
12061208
"tabId: $tabId"
12071209
}
1210+
broadcastQEvent(QFeatureEvent.INVOCATION)
12081211
when (session.conversationState) {
12091212
ConversationState.WAITING_FOR_BUILD_COMMAND_INPUT -> handleBuildCommandInput(session, message)
12101213
ConversationState.WAITING_FOR_REGENERATE_INPUT -> handleRegenerateInput(session, message)

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqDoc/DocConstants.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
package software.aws.toolkits.jetbrains.services.amazonqDoc
55

6+
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.FollowUp
7+
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.FollowUpStatusType
8+
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.FollowUpTypes
9+
import software.aws.toolkits.resources.message
10+
611
const val FEATURE_EVALUATION_PRODUCT_NAME = "DocGeneration"
712

813
const val FEATURE_NAME = "Amazon Q Documentation Generation"
@@ -25,3 +30,16 @@ enum class ModifySourceFolderErrorReason(
2530

2631
override fun toString(): String = reasonText
2732
}
33+
34+
val NEW_SESSION_FOLLOWUPS: List<FollowUp> = listOf(
35+
FollowUp(
36+
pillText = message("amazonqDoc.prompt.reject.new_task"),
37+
type = FollowUpTypes.NEW_TASK,
38+
status = FollowUpStatusType.Info
39+
),
40+
FollowUp(
41+
pillText = message("amazonqDoc.prompt.reject.close_session"),
42+
type = FollowUpTypes.CLOSE_SESSION,
43+
status = FollowUpStatusType.Info
44+
)
45+
)

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqDoc/DocExceptions.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ package software.aws.toolkits.jetbrains.services.amazonqDoc
55

66
import software.aws.toolkits.resources.message
77

8-
open class DocException(override val message: String?, override val cause: Throwable? = null) : RuntimeException()
8+
open class DocException(
9+
override val message: String?,
10+
override val cause: Throwable? = null,
11+
val remainingIterations: Int? = null,
12+
) : RuntimeException()
913

1014
class ZipFileError(override val message: String, override val cause: Throwable?) : RuntimeException()
1115

1216
class CodeIterationLimitError(override val message: String, override val cause: Throwable?) : RuntimeException()
1317

14-
internal fun docServiceError(message: String?): Nothing =
15-
throw DocException(message)
16-
17-
internal fun codeGenerationFailedError(): Nothing =
18-
throw DocException(message("amazonqFeatureDev.code_generation.failed_generation"))
18+
internal fun docServiceError(message: String?, cause: Throwable? = null, remainingIterations: Int? = null): Nothing =
19+
throw DocException(message, cause, remainingIterations)
1920

2021
internal fun conversationIdNotFound(): Nothing =
2122
throw DocException(message("amazonqFeatureDev.exception.conversation_not_found"))

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqDoc/controller/DocController.kt

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendAuthenti
5353
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendChatInputEnabledMessage
5454
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendCodeResult
5555
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendError
56+
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendErrorToUser
5657
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendFolderConfirmationMessage
5758
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendMonthlyLimitError
59+
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendRetryChangeFolderMessage
5860
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendSystemPrompt
5961
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendUpdatePlaceholder
6062
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendUpdatePromptProgress
@@ -70,6 +72,8 @@ import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.Delete
7072
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.NewFileZipInfo
7173
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.SessionStatePhase
7274
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.util.CancellationTokenSource
75+
import software.aws.toolkits.jetbrains.services.codewhisperer.telemetry.QFeatureEvent
76+
import software.aws.toolkits.jetbrains.services.codewhisperer.telemetry.broadcastQEvent
7377
import software.aws.toolkits.resources.message
7478
import java.nio.file.Paths
7579
import java.util.UUID
@@ -337,6 +341,31 @@ class DocController(
337341
}
338342
}
339343

344+
private suspend fun promptForRetryFolderSelection(tabId: String, message: String) {
345+
messenger.sendRetryChangeFolderMessage(
346+
tabId = tabId,
347+
message = message,
348+
followUps = listOf(
349+
FollowUp(
350+
icon = FollowUpIcons.Refresh,
351+
pillText = message("amazonqDoc.prompt.folder.change"),
352+
prompt = message("amazonqDoc.prompt.folder.change"),
353+
status = FollowUpStatusType.Info,
354+
type = FollowUpTypes.MODIFY_DEFAULT_SOURCE_FOLDER
355+
),
356+
FollowUp(
357+
icon = FollowUpIcons.Cancel,
358+
pillText = message("general.cancel"),
359+
prompt = message("general.cancel"),
360+
status = FollowUpStatusType.Error,
361+
type = FollowUpTypes.CANCEL_FOLDER_SELECTION
362+
),
363+
)
364+
)
365+
366+
messenger.sendChatInputEnabledMessage(tabId, false)
367+
}
368+
340369
override suspend fun processLinkClick(message: IncomingDocMessage.ClickedLink) {
341370
BrowserUtil.browse(message.link)
342371
}
@@ -427,11 +456,10 @@ class DocController(
427456
messenger.sendUpdatePlaceholder(tabId, message("amazonqDoc.prompt.placeholder"))
428457
} catch (err: Exception) {
429458
val message = createUserFacingErrorMessage(err.message)
430-
messenger.sendError(
459+
messenger.sendErrorToUser(
431460
tabId = tabId,
432461
errMessage = message ?: message("amazonqFeatureDev.exception.request_failed"),
433-
retries = retriesRemaining(session),
434-
conversationId = session?.conversationIdUnsafe
462+
conversationId = session?.conversationIdUnsafe,
435463
)
436464
}
437465
}
@@ -553,7 +581,7 @@ class DocController(
553581
messenger.sendUpdatePlaceholder(tabId, message("amazonqFeatureDev.placeholder.provide_code_feedback"))
554582
}
555583

556-
private suspend fun processErrorChatMessage(err: Exception, session: DocSession?, tabId: String) {
584+
private suspend fun processErrorChatMessage(err: Exception, session: DocSession?, tabId: String, isEnableChatInput: Boolean) {
557585
logger.warn(err) { "Encountered ${err.message} for tabId: $tabId" }
558586
messenger.sendUpdatePromptProgress(tabId, null)
559587

@@ -593,23 +621,21 @@ class DocController(
593621
}
594622

595623
is DocException -> {
596-
messenger.sendError(
624+
messenger.sendErrorToUser(
597625
tabId = tabId,
598626
errMessage = err.message,
599-
retries = retriesRemaining(session),
600-
conversationId = session?.conversationIdUnsafe
627+
conversationId = session?.conversationIdUnsafe,
628+
isEnableChatInput
601629
)
602630
}
603631

604632
is CodeIterationLimitException -> {
605633
messenger.sendUpdatePlaceholder(tabId, newPlaceholder = message("amazonqFeatureDev.placeholder.after_monthly_limit"))
606634
messenger.sendChatInputEnabledMessage(tabId, enabled = true)
607-
messenger.sendError(
635+
messenger.sendErrorToUser(
608636
tabId = tabId,
609637
errMessage = err.message,
610-
retries = retriesRemaining(session),
611-
conversationId = session?.conversationIdUnsafe,
612-
showDefaultMessage = true,
638+
conversationId = session?.conversationIdUnsafe
613639
)
614640

615641
val filePaths: List<NewFileZipInfo> = when (val state = session?.sessionState) {
@@ -718,17 +744,21 @@ class DocController(
718744
is PrepareDocGenerationState -> state.filePaths
719745
else -> emptyList()
720746
}
747+
broadcastQEvent(QFeatureEvent.INVOCATION)
721748

722749
if (filePaths.isNotEmpty()) {
723750
processOpenDiff(
724751
message = IncomingDocMessage.OpenDiff(tabId = tabId, filePath = filePaths[0].zipFilePath, deleted = false)
725752
)
726753
}
727754
} catch (err: Exception) {
728-
processErrorChatMessage(err, session, tabId)
755+
// For non edit mode lock the chat input until they explicitly click one of the follow-ups
756+
var isEnableChatInput = false
757+
if (err is DocException && Mode.EDIT == mode) {
758+
isEnableChatInput = err.remainingIterations != null && err.remainingIterations > 0
759+
}
729760

730-
// Lock the chat input until they explicitly click one of the follow-ups
731-
messenger.sendChatInputEnabledMessage(tabId, enabled = false)
761+
processErrorChatMessage(err, session, tabId, isEnableChatInput)
732762
}
733763
}
734764

@@ -808,10 +838,7 @@ class DocController(
808838
message = IncomingDocMessage.OpenDiff(tabId = followUpMessage.tabId, filePath = filePaths[0].zipFilePath, deleted = false)
809839
)
810840
} catch (err: Exception) {
811-
processErrorChatMessage(err, session, tabId = followUpMessage.tabId)
812-
813-
// Lock the chat input until they explicitly click one of the follow-ups
814-
messenger.sendChatInputEnabledMessage(tabId = followUpMessage.tabId, enabled = false)
841+
processErrorChatMessage(err, session, tabId = followUpMessage.tabId, false)
815842
} finally {
816843
messenger.sendUpdatePlaceholder(
817844
tabId = followUpMessage.tabId,
@@ -914,11 +941,22 @@ class DocController(
914941
val projectRoot = session.context.projectRoot
915942

916943
withContext(EDT) {
944+
messenger.sendAnswer(
945+
tabId = tabId,
946+
messageType = DocMessageType.Answer,
947+
message = message("amazonqDoc.prompt.choose_folder_to_continue")
948+
)
949+
917950
val selectedFolder = selectFolder(context.project, currentSourceFolder)
918951

919952
// No folder was selected
920953
if (selectedFolder == null) {
921954
logger.info { "Cancelled dialog and not selected any folder" }
955+
promptForRetryFolderSelection(
956+
tabId,
957+
message("amazonqDoc.prompt.canceled_source_folder_selection")
958+
)
959+
922960
return@withContext
923961
}
924962

0 commit comments

Comments
 (0)