Skip to content

Commit a9decbe

Browse files
authored
Merge branch 'main' into fix-telemetry-generate-fix
2 parents cf996f3 + 6551d8a commit a9decbe

File tree

18 files changed

+94
-61
lines changed

18 files changed

+94
-61
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix chat not retaining history when interaction is through onboarding tab type (#5189)"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "/review: Code fix automatically scrolls into view after generation."
4+
}

.github/workflows/ssm-integ.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
branches: [ main, feature/* ]
1010
# PRs only need to run this if the SSM plugin logic has changed
1111
paths:
12+
- '.github/workflows/ssm-integ.yml'
1213
- 'jetbrains-core/src/software/aws/toolkits/jetbrains/services/ssm/SsmPlugin.kt'
1314
- 'jetbrains-core/it/software/aws/toolkits/jetbrains/services/ssm/SsmPluginTest.kt'
1415

@@ -28,10 +29,10 @@ jobs:
2829
run: git config --system core.longpaths true
2930
if: ${{ matrix.os == 'windows-latest' }}
3031
- uses: actions/checkout@v2
31-
- name: Set up JDK 17
32-
uses: actions/setup-java@v1
32+
- uses: actions/setup-java@v4
3333
with:
34-
java-version: 17
34+
distribution: 'corretto'
35+
java-version: '21'
3536
- name: Grant execute permission for gradlew
3637
run: chmod +x gradlew
3738
- name: Build with Gradle

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
apache-commons-collections = "4.4"
3-
apache-commons-io = "2.16.0"
3+
apache-commons-io = "2.16.1"
44
apache-commons-text = "1.12.0"
55
assertJ = "3.26.3"
66
# match with <root>/settings.gradle.kts

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

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.updateFileCo
6666
import software.aws.toolkits.jetbrains.services.amazonqDoc.session.DocSession
6767
import software.aws.toolkits.jetbrains.services.amazonqDoc.session.PrepareDocGenerationState
6868
import software.aws.toolkits.jetbrains.services.amazonqDoc.storage.ChatSessionStorage
69+
import software.aws.toolkits.jetbrains.services.amazonqDoc.util.getFollowUpOptions
6970
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.CodeIterationLimitException
7071
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.MonthlyConversationLimitError
7172
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.CodeReferenceGenerated
@@ -813,7 +814,6 @@ class DocController(
813814

814815
when (session.sessionState.phase) {
815816
SessionStatePhase.CODEGEN -> {
816-
messenger.sendUpdatePromptProgress(tabId, inProgress(progress = 10))
817817
onCodeGeneration(session, message, tabId, mode)
818818
}
819819
else -> null
@@ -904,29 +904,7 @@ class DocController(
904904
messenger.sendAnswer(
905905
messageType = DocMessageType.SystemPrompt,
906906
tabId = followUpMessage.tabId,
907-
followUp = listOf(
908-
FollowUp(
909-
pillText = message("amazonqDoc.prompt.review.accept"),
910-
prompt = message("amazonqDoc.prompt.review.accept"),
911-
status = FollowUpStatusType.Success,
912-
type = FollowUpTypes.ACCEPT_CHANGES,
913-
icon = FollowUpIcons.Ok,
914-
),
915-
FollowUp(
916-
pillText = message("amazonqDoc.prompt.review.changes"),
917-
prompt = message("amazonqDoc.prompt.review.changes"),
918-
status = FollowUpStatusType.Info,
919-
type = FollowUpTypes.MAKE_CHANGES,
920-
icon = FollowUpIcons.Info,
921-
),
922-
FollowUp(
923-
pillText = message("general.reject"),
924-
prompt = message("general.reject"),
925-
status = FollowUpStatusType.Error,
926-
type = FollowUpTypes.REJECT_CHANGES,
927-
icon = FollowUpIcons.Cancel,
928-
)
929-
)
907+
followUp = getFollowUpOptions(session.sessionState.phase)
930908
)
931909

932910
processOpenDiff(

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

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package software.aws.toolkits.jetbrains.services.amazonqDoc.controller
55

66
import com.intellij.notification.NotificationAction
7+
import software.aws.toolkits.jetbrains.services.amazonqDoc.inProgress
78
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.DocMessageType
89
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.FollowUp
910
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.FollowUpStatusType
@@ -14,19 +15,27 @@ import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendChatInpu
1415
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendCodeResult
1516
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendSystemPrompt
1617
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendUpdatePlaceholder
18+
import software.aws.toolkits.jetbrains.services.amazonqDoc.messages.sendUpdatePromptProgress
1719
import software.aws.toolkits.jetbrains.services.amazonqDoc.session.DocSession
1820
import software.aws.toolkits.jetbrains.services.amazonqDoc.session.PrepareDocGenerationState
21+
import software.aws.toolkits.jetbrains.services.amazonqDoc.util.getFollowUpOptions
1922
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.messages.sendSystemPrompt
2023
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.CodeReferenceGenerated
2124
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.DeletedFileInfo
2225
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.session.NewFileZipInfo
23-
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.util.InsertAction
24-
import software.aws.toolkits.jetbrains.services.amazonqFeatureDev.util.getFollowUpOptions
2526
import software.aws.toolkits.jetbrains.utils.notifyInfo
2627
import software.aws.toolkits.resources.message
2728

2829
suspend fun DocController.onCodeGeneration(session: DocSession, message: String, tabId: String, mode: Mode) {
2930
try {
31+
messenger.sendAsyncEventProgress(tabId, inProgress = true)
32+
messenger.sendUpdatePromptProgress(tabId, inProgress(progress = 10, message("amazonqDoc.progress_message.scanning")))
33+
messenger.sendAnswer(
34+
message = docGenerationProgressMessage(DocGenerationStep.UPLOAD_TO_S3, this.mode),
35+
messageType = DocMessageType.AnswerPart,
36+
tabId = tabId,
37+
)
38+
3039
val sessionMessage = if (mode == Mode.CREATE) {
3140
message(
3241
"amazonqDoc.session.create"
@@ -80,25 +89,27 @@ suspend fun DocController.onCodeGeneration(session: DocSession, message: String,
8089
return
8190
}
8291

92+
messenger.sendAnswer(
93+
message = docGenerationProgressMessage(DocGenerationStep.COMPLETE, mode),
94+
messageType = DocMessageType.AnswerPart,
95+
tabId = tabId,
96+
)
97+
8398
messenger.sendCodeResult(tabId = tabId, uploadId = uploadId, filePaths = filePaths, deletedFiles = deletedFiles, references = references)
8499

85100
if (remainingIterations != null && totalIterations != null) {
86101
messenger.sendAnswer(
87102
tabId = tabId,
88103
messageType = DocMessageType.Answer,
89-
message = if (remainingIterations == 0) {
90-
message("amazonqFeatureDev.code_generation.iteration_zero")
104+
message = if (this.mode === Mode.CREATE) {
105+
message("amazonqDoc.answer.readmeCreated")
91106
} else {
92-
message(
93-
"amazonqFeatureDev.code_generation.iteration_counts",
94-
remainingIterations,
95-
totalIterations
96-
)
107+
"${message("amazonqDoc.answer.readmeUpdated")} ${message("amazonqDoc.answer.codeResult")}"
97108
}
98109
)
99110
}
100111

101-
messenger.sendSystemPrompt(tabId = tabId, followUp = getFollowUpOptions(session.sessionState.phase, InsertAction.ALL))
112+
messenger.sendSystemPrompt(tabId = tabId, followUp = getFollowUpOptions(session.sessionState.phase))
102113

103114
messenger.sendUpdatePlaceholder(tabId = tabId, newPlaceholder = message("amazonqFeatureDev.placeholder.after_code_generation"))
104115
} finally {

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,29 @@ fun getFollowUpOptions(phase: SessionStatePhase?): List<FollowUp> {
1515
SessionStatePhase.CODEGEN -> {
1616
return listOf(
1717
FollowUp(
18-
pillText = message("amazonqDoc.follow_up.insert_code"),
19-
type = FollowUpTypes.INSERT_CODE,
18+
pillText = message("amazonqDoc.prompt.review.accept"),
19+
prompt = message("amazonqDoc.prompt.review.accept"),
20+
status = FollowUpStatusType.Success,
21+
type = FollowUpTypes.ACCEPT_CHANGES,
2022
icon = FollowUpIcons.Ok,
21-
status = FollowUpStatusType.Success
2223
),
2324
FollowUp(
24-
pillText = message("amazonqDoc.follow_up.provide_feedback_and_regenerate"),
25-
type = FollowUpTypes.PROVIDE_FEEDBACK_AND_REGENERATE_CODE,
26-
icon = FollowUpIcons.Refresh,
27-
status = FollowUpStatusType.Info
25+
pillText = message("amazonqDoc.prompt.review.changes"),
26+
prompt = message("amazonqDoc.prompt.review.changes"),
27+
status = FollowUpStatusType.Info,
28+
type = FollowUpTypes.MAKE_CHANGES,
29+
icon = FollowUpIcons.Info,
30+
),
31+
FollowUp(
32+
pillText = message("general.reject"),
33+
prompt = message("general.reject"),
34+
status = FollowUpStatusType.Error,
35+
type = FollowUpTypes.REJECT_CHANGES,
36+
icon = FollowUpIcons.Cancel,
2837
)
2938
)
3039
}
40+
3141
else -> return emptyList()
3242
}
3343
}

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/codescan/CodeWhispererCodeScanIssueDetailsPanel.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ internal class CodeWhispererCodeScanIssueDetailsPanel(
7272
)
7373
editorPane.revalidate()
7474
editorPane.repaint()
75+
runInEdt {
76+
editorPane.scrollToReference("fixLoadingSection")
77+
}
7578

7679
val codeFixResponse: AmazonQCodeFixSession.CodeFixResponse = amazonQCodeFixSession.runCodeFixWorkflow(issue)
7780
if (codeFixResponse.failureResponse != null) {
@@ -82,6 +85,9 @@ internal class CodeWhispererCodeScanIssueDetailsPanel(
8285
)
8386
revalidate()
8487
repaint()
88+
runInEdt {
89+
scrollToReference("fixFailureSection")
90+
}
8591
}
8692
CodeWhispererTelemetryService.getInstance().sendCodeScanIssueGenerateFix(
8793
Component.Webview,
@@ -123,6 +129,9 @@ internal class CodeWhispererCodeScanIssueDetailsPanel(
123129
)
124130
revalidate()
125131
repaint()
132+
runInEdt {
133+
scrollToReference("codeFixActions")
134+
}
126135
}
127136

128137
buttonPane.apply {

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/codescan/CodeWhispererCodeScanResultsView.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,14 @@ internal class CodeWhispererCodeScanResultsView(private val project: Project, pr
358358
cell.icon = obj.fileType.icon
359359
}
360360
is CodeWhispererCodeScanIssue -> {
361-
val cellText = "${obj.title.trimEnd('.')}: ${obj.file.name} "
361+
val cellText = obj.title.trimEnd('.')
362+
val cellDescription = "${obj.file.name} ${obj.displayTextRange()}"
362363
if (obj.isInvalid) {
363-
cell.text = message("codewhisperer.codescan.scan_recommendation_invalid", obj.title, obj.displayTextRange(), INACTIVE_TEXT_COLOR)
364+
cell.text = message("codewhisperer.codescan.scan_recommendation_invalid", obj.title, cellDescription, INACTIVE_TEXT_COLOR)
364365
cell.toolTipText = message("codewhisperer.codescan.scan_recommendation_invalid.tooltip_text")
365366
cell.icon = AllIcons.General.Information
366367
} else {
367-
cell.text = message("codewhisperer.codescan.scan_recommendation", cellText, obj.displayTextRange(), INACTIVE_TEXT_COLOR)
368+
cell.text = message("codewhisperer.codescan.scan_recommendation", cellText, cellDescription, INACTIVE_TEXT_COLOR)
368369
cell.toolTipText = cellText
369370
cell.icon = obj.issueSeverity.icon
370371
}

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/codescan/utils/CodeWhispererCodeScanIssueUtils.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fun getCodeScanIssueDetailsHtml(
137137
}
138138

139139
val fixLoadingSection = """
140+
<a name="fixLoadingSection"></a>
140141
<div align="center" bgcolor="#2b2b2b" style="margin: 20px;">
141142
<font size="7" color="#ffffff" face="Arial">
142143
&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;
@@ -145,6 +146,7 @@ fun getCodeScanIssueDetailsHtml(
145146
""".trimIndent()
146147

147148
val fixFailureSection = """
149+
<a name="fixFailureSection"></a>
148150
<div align="center" bgcolor="#2b2b2b" style="margin: 20px;">
149151
<font size="4" color="#e6e6e6" face="Arial">
150152
<br>Amazon Q failed to generate fix. Please try again<br>
@@ -192,6 +194,7 @@ private fun createSuggestedFixSection(issue: CodeWhispererCodeScanIssue, suggest
192194
|${it.code.trim()}
193195
|```
194196
|</div>
197+
|<a name="codeFixActions"></a>
195198
|<div>
196199
| <a href="amazonq://issue/openDiff-${issue.findingId}">
197200
| <font size="+1"><i>&#x2194;</i></font> <b>Open Diff</b>

0 commit comments

Comments
 (0)