Skip to content

Commit 5e4d665

Browse files
committed
Merge branch 'model-selection' of github.com:zuoyaofu/aws-toolkit-jetbrains into model-selection
2 parents d83a405 + 3bdc17c commit 5e4d665

File tree

7 files changed

+53
-7
lines changed

7 files changed

+53
-7
lines changed

.changes/3.73.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"date" : "2025-05-29",
3+
"version" : "3.73",
4+
"entries" : [ {
5+
"type" : "bugfix",
6+
"description" : "/transform: handle InvalidGrantException properly when polling job status"
7+
} ]
8+
}

.changes/next-release/bugfix-ddfb0a9a-529f-4597-8b7a-519d4e838fa4.json

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

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# _3.73_ (2025-05-29)
2+
- **(Bug Fix)** /transform: handle InvalidGrantException properly when polling job status
3+
14
# _3.72_ (2025-05-22)
25
- **(Removal)** /transform: remove option to receive multiple diffs
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.73-SNAPSHOT
5+
toolkitVersion=3.74-SNAPSHOT
66

77
# Publish Settings
88
publishToken=

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
7878
val name = telemetryMap["name"] as? String ?: return
7979

8080
@Suppress("UNCHECKED_CAST")
81-
val data = telemetryMap["data"] as? Map<String, Any> ?: return
81+
val data = telemetryMap["data"] as? Map<String, Any?> ?: return
8282

8383
TelemetryService.getInstance().record(project) {
8484
datum(name) {
@@ -91,7 +91,7 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
9191
}
9292

9393
data.forEach { (key, value) ->
94-
metadata(key, value.toString())
94+
metadata(key, value?.toString() ?: "null")
9595
}
9696
}
9797
}

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/textdocument/TextDocumentServiceHandler.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import org.eclipse.lsp4j.DidChangeTextDocumentParams
2222
import org.eclipse.lsp4j.DidCloseTextDocumentParams
2323
import org.eclipse.lsp4j.DidOpenTextDocumentParams
2424
import org.eclipse.lsp4j.DidSaveTextDocumentParams
25+
import org.eclipse.lsp4j.Position
26+
import org.eclipse.lsp4j.Range
2527
import org.eclipse.lsp4j.TextDocumentContentChangeEvent
2628
import org.eclipse.lsp4j.TextDocumentIdentifier
2729
import org.eclipse.lsp4j.TextDocumentItem
@@ -164,6 +166,9 @@ class TextDocumentServiceHandler(
164166
pluginAwareExecuteOnPooledThread {
165167
val vFile = FileDocumentManager.getInstance().getFile(event.document) ?: return@pluginAwareExecuteOnPooledThread
166168
toUriString(vFile)?.let { uri ->
169+
val editor = FileEditorManager.getInstance(project).selectedTextEditor ?: return@pluginAwareExecuteOnPooledThread
170+
val logicalPosition = editor.offsetToLogicalPosition(event.offset)
171+
val newLogicalPosition = editor.offsetToLogicalPosition(event.offset + event.newLength)
167172
languageServer.textDocumentService.didChange(
168173
DidChangeTextDocumentParams().apply {
169174
textDocument = VersionedTextDocumentIdentifier().apply {
@@ -173,6 +178,10 @@ class TextDocumentServiceHandler(
173178
contentChanges = listOf(
174179
TextDocumentContentChangeEvent().apply {
175180
text = event.newFragment.toString()
181+
range = Range(
182+
Position(logicalPosition.line, logicalPosition.column),
183+
Position(newLogicalPosition.line, newLogicalPosition.column)
184+
)
176185
}
177186
)
178187
}

plugins/amazonq/shared/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImplTest.kt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,36 @@ class AmazonQLanguageClientImplTest {
8181
)
8282
}
8383

84+
@Test
85+
fun `telemetryEvent handles null`() {
86+
val telemetryService = mockk<TelemetryService>(relaxed = true)
87+
mockkObject(TelemetryService)
88+
every { TelemetryService.getInstance() } returns telemetryService
89+
90+
val builderCaptor = slot<MetricEvent.Builder.() -> Unit>()
91+
every { telemetryService.record(project, capture(builderCaptor)) } returns Unit
92+
93+
val event = mapOf(
94+
"name" to "test_event",
95+
"data" to mapOf(
96+
"key1" to null,
97+
)
98+
)
99+
100+
sut.telemetryEvent(event)
101+
102+
val builder = DefaultMetricEvent.builder()
103+
builderCaptor.captured.invoke(builder)
104+
105+
val metricEvent = builder.build()
106+
val datum = metricEvent.data.first()
107+
108+
assertThat(datum.name).isEqualTo("test_event")
109+
assertThat(datum.metadata).contains(
110+
entry("key1", "null"),
111+
)
112+
}
113+
84114
@Test
85115
fun `telemetryEvent handles event with result field`() {
86116
val telemetryService = mockk<TelemetryService>(relaxed = true)

0 commit comments

Comments
 (0)