Skip to content

Commit f7fab94

Browse files
committed
enable syntax highlighting when viewing diff for generated unit tests
changelog remove unused import
1 parent d148b66 commit f7fab94

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
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" : "/test syntax highlighting when viewing diff"
4+
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ class CodeTestChatController(
458458
when (message.actionID) {
459459
"utg_view_diff" -> {
460460
withContext(EDT) {
461+
val virtualFile = Path.of(session.projectRoot, session.testFileRelativePathToProjectRoot).toString().let { Path.of(it).toFile().toVirtualFile() }
462+
461463
(DiffManager.getInstance() as DiffManagerEx).showDiffBuiltin(
462464
context.project,
463465
SimpleDiffRequest(
@@ -466,9 +468,13 @@ class CodeTestChatController(
466468
getFileContentAtTestFilePath(
467469
session.projectRoot,
468470
session.testFileRelativePathToProjectRoot
469-
)
471+
),
472+
virtualFile
473+
),
474+
DiffContentFactory.getInstance().create(
475+
session.generatedTestDiffs.values.first(),
476+
virtualFile
470477
),
471-
DiffContentFactory.getInstance().create(session.generatedTestDiffs.values.first()),
472478
"Before",
473479
"After"
474480
)

0 commit comments

Comments
 (0)