Skip to content

Commit 508a96e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into client
2 parents b68ebb9 + 7087f28 commit 508a96e

File tree

45 files changed

+1126
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1126
-501
lines changed

.changes/3.54.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"date" : "2025-02-11",
3+
"version" : "3.54",
4+
"entries" : [ {
5+
"type" : "bugfix",
6+
"description" : "Amazon Q: Reverting the behavior of making JetBrains suggestions(IntelliSense) and Q suggestions co-exist"
7+
} ]
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Enable syntax highlighting when viewing diff for /test"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Amazon Q /test: Truncating user input to 4096 characters for unit test generation."
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Amazon Q /test: Q identify active test file and infer source file for test generation."
4+
}

.github/workflows/prerelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
generate_artifact_toolkit_standalone:
1818
strategy:
1919
matrix:
20-
supported_versions: [ '2024.1', '2024.2', '2024.3' ]
20+
supported_versions: [ '2024.1', '2024.2', '2024.3', '2025.1' ]
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# _3.54_ (2025-02-11)
2+
- **(Bug Fix)** Amazon Q: Reverting the behavior of making JetBrains suggestions(IntelliSense) and Q suggestions co-exist
3+
14
# _3.53_ (2025-02-07)
25
- **(Bug Fix)** Amazon Q: Fixed an issue where in a specific scenario when receiving multiple suggestions with JetBrains suggestions visible, users are not able to accept the suggestion.
36

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.54-SNAPSHOT
5+
toolkitVersion=3.55-SNAPSHOT
66

77
# Publish Settings
88
publishToken=

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/common/clients/AmazonQCodeGenerateClient.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import software.amazon.awssdk.services.codewhispererruntime.model.ContentChecksu
1313
import software.amazon.awssdk.services.codewhispererruntime.model.CreateTaskAssistConversationRequest
1414
import software.amazon.awssdk.services.codewhispererruntime.model.CreateTaskAssistConversationResponse
1515
import software.amazon.awssdk.services.codewhispererruntime.model.CreateUploadUrlResponse
16-
import software.amazon.awssdk.services.codewhispererruntime.model.DocGenerationEvent
16+
import software.amazon.awssdk.services.codewhispererruntime.model.DocV2AcceptanceEvent
17+
import software.amazon.awssdk.services.codewhispererruntime.model.DocV2GenerationEvent
1718
import software.amazon.awssdk.services.codewhispererruntime.model.GetTaskAssistCodeGenerationResponse
1819
import software.amazon.awssdk.services.codewhispererruntime.model.IdeCategory
1920
import software.amazon.awssdk.services.codewhispererruntime.model.OperatingSystem
@@ -49,7 +50,7 @@ class AmazonQCodeGenerateClient(private val project: Project) {
4950
OptOutPreference.OPTOUT
5051
}
5152

52-
private val docGenerationUserContext = ClientMetadata.getDefault().let {
53+
private val docUserContext = ClientMetadata.getDefault().let {
5354
val osForFeatureDev: OperatingSystem =
5455
when {
5556
SystemInfo.isWindows -> OperatingSystem.WINDOWS
@@ -75,15 +76,17 @@ class AmazonQCodeGenerateClient(private val project: Project) {
7576
private val amazonQStreamingClient
7677
get() = AmazonQStreamingClient.getInstance(project)
7778

78-
fun sendDocGenerationTelemetryEvent(
79-
docGenerationEvent: DocGenerationEvent,
79+
fun sendDocTelemetryEvent(
80+
generationEvent: DocV2GenerationEvent? = null,
81+
acceptanceEvent: DocV2AcceptanceEvent? = null,
8082
): SendTelemetryEventResponse =
8183
bearerClient().sendTelemetryEvent { requestBuilder ->
8284
requestBuilder.telemetryEvent { telemetryEventBuilder ->
83-
telemetryEventBuilder.docGenerationEvent(docGenerationEvent)
85+
generationEvent?.let { telemetryEventBuilder.docV2GenerationEvent(it) }
86+
acceptanceEvent?.let { telemetryEventBuilder.docV2AcceptanceEvent(it) }
8487
}
8588
requestBuilder.optOutPreference(getTelemetryOptOutPreference())
86-
requestBuilder.userContext(docGenerationUserContext)
89+
requestBuilder.userContext(docUserContext)
8790
}
8891

8992
fun createTaskAssistConversation(): CreateTaskAssistConversationResponse = bearerClient().createTaskAssistConversation(

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import java.io.ByteArrayInputStream
5959
import java.io.ByteArrayOutputStream
6060
import java.io.File
6161
import java.io.IOException
62+
import java.nio.file.Path
6263
import java.nio.file.Paths
6364
import java.time.Duration
6465
import java.time.Instant
@@ -249,9 +250,10 @@ class CodeWhispererUTGChatManager(val project: Project, private val cs: Coroutin
249250
if (shortAnswer.stopIteration == "true") {
250251
throw CodeTestException("TestGenFailedError: ${shortAnswer.planSummary}", "TestGenFailedError", shortAnswer.planSummary)
251252
}
253+
val fileName = shortAnswer.sourceFilePath?.let { Path.of(it).fileName.toString() } ?: path.fileName.toString()
252254
codeTestChatHelper.updateAnswer(
253255
CodeTestChatMessageContent(
254-
message = generateSummaryMessage(path.fileName.toString()) + shortAnswer.planSummary,
256+
message = generateSummaryMessage(fileName) + shortAnswer.planSummary,
255257
type = ChatMessageType.Answer
256258
),
257259
messageIdOverride = codeTestResponseContext.testSummaryMessageId

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,11 @@ class CodeTestChatController(
201201

202202
session.isCodeBlockSelected = selectionRange !== null
203203

204-
// This check is added to remove /test if user accidentally added while doing Regenerate unit tests.
205-
val userPrompt = if (message.prompt.startsWith("/test")) {
206-
message.prompt.substringAfter("/test ").trim()
207-
} else {
208-
message.prompt
209-
}
204+
// This removes /test if user accidentally added while doing Regenerate unit tests and truncates the user response to 4096 characters.
205+
val userPrompt = message.prompt
206+
.let { if (it.startsWith("/test")) it.substringAfter("/test ").trim() else it }
207+
.take(4096)
208+
210209
CodeWhispererUTGChatManager.getInstance(project).generateTests(userPrompt, codeTestChatHelper, null, selectionRange)
211210
} else {
212211
// Not adding a progress bar to unsupported language cases
@@ -458,6 +457,10 @@ class CodeTestChatController(
458457
when (message.actionID) {
459458
"utg_view_diff" -> {
460459
withContext(EDT) {
460+
// virtual file only needed for syntax highlighting when viewing diff
461+
val tempPath = Files.createTempFile(null, ".${session.testFileName.substringAfterLast('.')}")
462+
val virtualFile = tempPath.toFile().toVirtualFile()
463+
461464
(DiffManager.getInstance() as DiffManagerEx).showDiffBuiltin(
462465
context.project,
463466
SimpleDiffRequest(
@@ -466,13 +469,18 @@ class CodeTestChatController(
466469
getFileContentAtTestFilePath(
467470
session.projectRoot,
468471
session.testFileRelativePathToProjectRoot
469-
)
472+
),
473+
virtualFile
474+
),
475+
DiffContentFactory.getInstance().create(
476+
session.generatedTestDiffs.values.first(),
477+
virtualFile
470478
),
471-
DiffContentFactory.getInstance().create(session.generatedTestDiffs.values.first()),
472479
"Before",
473480
"After"
474481
)
475482
)
483+
Files.deleteIfExists(tempPath)
476484
session.openedDiffFile = FileEditorManager.getInstance(context.project).selectedEditor?.file
477485
ApplicationManager.getApplication().runReadAction {
478486
generatedFileContent = getGeneratedFileContent(session)

0 commit comments

Comments
 (0)