Skip to content

Commit 01704dc

Browse files
authored
Merge branch 'main' into openChat
2 parents 38c32e7 + 53302d9 commit 01704dc

File tree

21 files changed

+914
-296
lines changed

21 files changed

+914
-296
lines changed

.changes/3.38.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"date" : "2024-11-07",
3+
"version" : "3.38",
4+
"entries" : [ {
5+
"type" : "bugfix",
6+
"description" : "Improve the position that inline chat shortcut hint is shown in editor"
7+
}, {
8+
"type" : "bugfix",
9+
"description" : "Improve `@workspace` index start stop strategy"
10+
}, {
11+
"type" : "bugfix",
12+
"description" : "Fixed an issue where Q inline won't appear in JetBrains remote 2024.2+"
13+
} ]
14+
}

.changes/next-release/bugfix-4fee3628-1445-40f3-b164-2b0d3c12bd19.json

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

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# _3.38_ (2024-11-07)
2+
- **(Bug Fix)** Improve the position that inline chat shortcut hint is shown in editor
3+
- **(Bug Fix)** Improve `@workspace` index start stop strategy
4+
- **(Bug Fix)** Fixed an issue where Q inline won't appear in JetBrains remote 2024.2+
5+
16
# _3.37_ (2024-10-31)
27
- **(Bug Fix)** Amazon Q /dev: Fix the issue resulting in the first request per conversation to /dev failing
38
- **(Bug Fix)** Fix inline chat shortcut hint breaking text selection on remote editors

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.38-SNAPSHOT
5+
toolkitVersion=3.39-SNAPSHOT
66

77
# Publish Settings
88
publishToken=

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/chat/telemetry/TelemetryHelper.kt

Lines changed: 109 additions & 116 deletions
Large diffs are not rendered by default.

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/inline/InlineChatEditorHint.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,26 @@ import javax.swing.JPanel
1919

2020
class InlineChatEditorHint {
2121
private val hint = createHint()
22+
private val hintXOffset = 20
2223

2324
private fun getHintLocation(editor: Editor): Point {
2425
val range = editor.calculateVisibleRange()
2526
val document = editor.document
2627
val selectionEnd = editor.selectionModel.selectionEnd
2728
val isOneLineSelection = isOneLineSelection(editor)
28-
val isBelow = editor.offsetToXY(selectionEnd) !in editor.scrollingModel.visibleArea
29+
val offset = document.getLineEndOffset(document.getLineNumber(selectionEnd))
30+
val offsetXy = editor.offsetToXY(offset)
31+
val potentialXy = Point(offsetXy.x + hintXOffset, offsetXy.y)
32+
val isBelow = potentialXy !in editor.scrollingModel.visibleArea
2933
val areEdgesOutsideOfVisibleArea = editor.selectionModel.selectionStart !in range && editor.selectionModel.selectionEnd !in range
3034
val offsetForHint = when {
31-
isOneLineSelection -> selectionEnd
3235
areEdgesOutsideOfVisibleArea -> document.getLineEndOffset(getLineByVisualStart(editor, editor.caretModel.offset, true))
3336
isBelow -> document.getLineEndOffset(getLineByVisualStart(editor, selectionEnd, true))
3437
else -> document.getLineEndOffset(getLineByVisualStart(editor, selectionEnd, false))
3538
}
3639
val visualPosition = editor.offsetToVisualPosition(offsetForHint)
37-
val hintPoint = HintManagerImpl.getHintPosition(hint, editor, visualPosition, HintManager.RIGHT)
38-
hintPoint.translate(0, if (isBelow) editor.lineHeight else 0)
40+
val hintPoint = HintManagerImpl.getHintPosition(hint, editor, visualPosition, HintManager.RIGHT_UNDER)
41+
hintPoint.translate(if (!isBelow) hintXOffset else 0, if (!isOneLineSelection || isBelow) editor.lineHeight else 0)
3942
return hintPoint
4043
}
4144

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/messages/CwcMessage.kt

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,60 +24,68 @@ sealed interface CwcMessage : AmazonQMessage
2424

2525
// === UI -> App Messages ===
2626
sealed interface IncomingCwcMessage : CwcMessage {
27+
interface TabId {
28+
val tabId: String?
29+
}
30+
31+
interface MessageId {
32+
val messageId: String?
33+
}
34+
2735
data class ClearChat(
28-
@JsonProperty("tabID") val tabId: String,
29-
) : IncomingCwcMessage
36+
@JsonProperty("tabID") override val tabId: String,
37+
) : IncomingCwcMessage, TabId
3038

3139
data class Help(
32-
@JsonProperty("tabID") val tabId: String,
33-
) : IncomingCwcMessage
40+
@JsonProperty("tabID") override val tabId: String,
41+
) : IncomingCwcMessage, TabId
3442

3543
data class ChatPrompt(
3644
val chatMessage: String,
3745
val command: String,
38-
@JsonProperty("tabID") val tabId: String,
46+
@JsonProperty("tabID") override val tabId: String,
3947
val userIntent: String?,
40-
) : IncomingCwcMessage
48+
) : IncomingCwcMessage, TabId
4149

4250
data class TabAdded(
43-
@JsonProperty("tabID") val tabId: String,
51+
@JsonProperty("tabID") override val tabId: String,
4452
val tabType: String,
45-
) : IncomingCwcMessage
53+
) : IncomingCwcMessage, TabId
4654

4755
data class TabRemoved(
48-
@JsonProperty("tabID") val tabId: String,
56+
@JsonProperty("tabID") override val tabId: String,
4957
val tabType: String,
50-
) : IncomingCwcMessage
58+
) : IncomingCwcMessage, TabId
5159

5260
data class TabChanged(
53-
@JsonProperty("tabID") val tabId: String,
61+
@JsonProperty("tabID") override val tabId: String,
5462
@JsonProperty("prevTabID") val prevTabId: String?,
55-
) : IncomingCwcMessage
63+
) : IncomingCwcMessage, TabId
5664

5765
data class FollowupClicked(
5866
val followUp: FollowUp,
59-
@JsonProperty("tabID") val tabId: String,
60-
val messageId: String?,
67+
@JsonProperty("tabID") override val tabId: String,
68+
override val messageId: String?,
6169
val command: String,
6270
val tabType: String,
63-
) : IncomingCwcMessage
71+
) : IncomingCwcMessage, TabId, MessageId
6472

6573
data class CopyCodeToClipboard(
6674
val command: String?,
67-
@JsonProperty("tabID") val tabId: String,
68-
val messageId: String,
75+
@JsonProperty("tabID") override val tabId: String,
76+
override val messageId: String,
6977
val userIntent: UserIntent?,
7078
val code: String,
7179
val insertionTargetType: String?,
7280
val eventId: String?,
7381
val codeBlockIndex: Int?,
7482
val totalCodeBlocks: Int?,
7583
val codeBlockLanguage: String?,
76-
) : IncomingCwcMessage
84+
) : IncomingCwcMessage, TabId, MessageId
7785

7886
data class InsertCodeAtCursorPosition(
79-
@JsonProperty("tabID") val tabId: String,
80-
val messageId: String,
87+
@JsonProperty("tabID") override val tabId: String,
88+
override val messageId: String,
8189
val userIntent: UserIntent?,
8290
val code: String,
8391
val insertionTargetType: String?,
@@ -86,29 +94,29 @@ sealed interface IncomingCwcMessage : CwcMessage {
8694
val codeBlockIndex: Int?,
8795
val totalCodeBlocks: Int?,
8896
val codeBlockLanguage: String?,
89-
) : IncomingCwcMessage
97+
) : IncomingCwcMessage, TabId, MessageId
9098

9199
data class TriggerTabIdReceived(
92100
@JsonProperty("triggerID") val triggerId: String,
93-
@JsonProperty("tabID") val tabId: String,
94-
) : IncomingCwcMessage
101+
@JsonProperty("tabID") override val tabId: String,
102+
) : IncomingCwcMessage, TabId
95103

96104
data class StopResponse(
97-
@JsonProperty("tabID") val tabId: String,
98-
) : IncomingCwcMessage
105+
@JsonProperty("tabID") override val tabId: String,
106+
) : IncomingCwcMessage, TabId
99107

100108
data class ChatItemVoted(
101-
@JsonProperty("tabID") val tabId: String,
102-
val messageId: String,
109+
@JsonProperty("tabID") override val tabId: String,
110+
override val messageId: String,
103111
val vote: String, // upvote / downvote
104-
) : IncomingCwcMessage
112+
) : IncomingCwcMessage, TabId, MessageId
105113

106114
data class ChatItemFeedback(
107-
@JsonProperty("tabID") val tabId: String,
115+
@JsonProperty("tabID") override val tabId: String,
108116
val selectedOption: String,
109117
val comment: String?,
110-
val messageId: String,
111-
) : IncomingCwcMessage
118+
override val messageId: String,
119+
) : IncomingCwcMessage, TabId, MessageId
112120

113121
data class UIFocus(
114122
val command: String,
@@ -119,19 +127,19 @@ sealed interface IncomingCwcMessage : CwcMessage {
119127

120128
data class ClickedLink(
121129
@JsonProperty("command") val type: LinkType,
122-
@JsonProperty("tabID") val tabId: String,
123-
val messageId: String?,
130+
@JsonProperty("tabID") override val tabId: String,
131+
override val messageId: String?,
124132
val link: String,
125-
) : IncomingCwcMessage
133+
) : IncomingCwcMessage, TabId, MessageId
126134

127135
data class AuthFollowUpWasClicked(
128-
@JsonProperty("tabID") val tabId: String,
136+
@JsonProperty("tabID") override val tabId: String,
129137
val authType: AuthFollowUpType,
130-
) : IncomingCwcMessage
138+
) : IncomingCwcMessage, TabId
131139

132140
data class OpenSettings(
133-
@JsonProperty("tabID") val tabId: String? = null,
134-
) : IncomingCwcMessage
141+
@JsonProperty("tabID") override val tabId: String? = null,
142+
) : IncomingCwcMessage, TabId
135143
}
136144

137145
enum class FocusType {

plugins/amazonq/chat/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/amazonq/TelemetryHelperTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.mockito.kotlin.doReturn
2222
import org.mockito.kotlin.eq
2323
import org.mockito.kotlin.mock
2424
import org.mockito.kotlin.stub
25+
import org.mockito.kotlin.times
2526
import org.mockito.kotlin.verify
2627
import software.amazon.awssdk.awscore.DefaultAwsResponseMetadata
2728
import software.amazon.awssdk.awscore.util.AwsHeader.AWS_REQUEST_ID
@@ -608,7 +609,7 @@ class TelemetryHelperTest {
608609

609610
// Toolkit telemetry
610611
argumentCaptor<MetricEvent> {
611-
verify(mockBatcher).enqueue(capture())
612+
verify(mockBatcher, times(2)).enqueue(capture())
612613
val event = firstValue.data.find { it.name == "feedback_result" }
613614
assertNotNull(event)
614615
assertThat(event).matches { it.metadata["result"] == "Succeeded" }

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/service/CodeWhispererService.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import software.aws.toolkits.core.utils.debug
4646
import software.aws.toolkits.core.utils.getLogger
4747
import software.aws.toolkits.core.utils.info
4848
import software.aws.toolkits.core.utils.warn
49+
import software.aws.toolkits.jetbrains.core.coroutines.EDT
4950
import software.aws.toolkits.jetbrains.core.coroutines.disposableCoroutineScope
5051
import software.aws.toolkits.jetbrains.core.coroutines.getCoroutineBgContext
5152
import software.aws.toolkits.jetbrains.core.coroutines.projectCoroutineScope
@@ -206,9 +207,12 @@ class CodeWhispererService(private val cs: CoroutineScope) : Disposable {
206207
invokeCodeWhispererInBackground(requestContext)
207208
}
208209

209-
internal fun invokeCodeWhispererInBackground(requestContext: RequestContext): Job {
210-
val popup = CodeWhispererPopupManager.getInstance().initPopup()
211-
Disposer.register(popup) { CodeWhispererInvocationStatus.getInstance().finishInvocation() }
210+
internal suspend fun invokeCodeWhispererInBackground(requestContext: RequestContext): Job {
211+
val popup = withContext(EDT) {
212+
CodeWhispererPopupManager.getInstance().initPopup().also {
213+
Disposer.register(it) { CodeWhispererInvocationStatus.getInstance().finishInvocation() }
214+
}
215+
}
212216

213217
val workerContexts = mutableListOf<WorkerContext>()
214218
// When popup is disposed we will cancel this coroutine. The only places popup can get disposed should be

plugins/core/jetbrains-community/resources/telemetryOverride.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -755,25 +755,6 @@
755755
],
756756
"passive": true
757757
},
758-
{
759-
"name": "auth_userState",
760-
"description": "The state of the user's authentication.",
761-
"metadata": [
762-
{
763-
"type": "source",
764-
"required": true
765-
},
766-
{
767-
"type": "authStatus",
768-
"required": true
769-
},
770-
{
771-
"type": "authEnabledConnections",
772-
"required": true
773-
}
774-
],
775-
"passive": true
776-
},
777758
{
778759
"name": "webview_amazonqSignInOpened",
779760
"description": "Called when a Amazon Q sign in webview is opened.",

0 commit comments

Comments
 (0)