-
Notifications
You must be signed in to change notification settings - Fork 273
fix(amazonq): do not model types that are directly passthrough to chat ui #5702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4af9d17
fix(amazonq): do not model types that are directly passthrough to cha…
rli bfad5e1
Merge remote-tracking branch 'origin/feature/q-lsp-chat' into rli/fix…
rli 855afd6
lint
rli 4d99a80
tst
rli 34efb26
Merge branch 'feature/q-lsp-chat' into rli/fix-history-restore
rli ebf94f9
tst
rli 3661d25
Merge branch 'feature/q-lsp-chat' into rli/fix-history-restore
rli 1ed1c5e
tst
rli c488f60
Merge remote-tracking branch 'origin/feature/q-lsp-chat' into rli/fix…
rli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ty/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/EnumJsonValueAdapter.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package software.aws.toolkits.jetbrains.services.amazonq.lsp.model | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonValue | ||
| import com.google.gson.Gson | ||
| import com.google.gson.TypeAdapter | ||
| import com.google.gson.TypeAdapterFactory | ||
| import com.google.gson.reflect.TypeToken | ||
|
|
||
| /** | ||
| * A [Gson] [TypeAdapterFactory] that uses Jackson @[JsonValue] instead of [Enum.name] for de/serialization | ||
| */ | ||
| class EnumJsonValueAdapter : TypeAdapterFactory { | ||
| override fun <T> create( | ||
| gson: Gson, | ||
| type: TypeToken<T> | ||
| ): TypeAdapter<T>? { | ||
| val rawType = type.getRawType() | ||
| if (!rawType.isEnum) { | ||
| return null | ||
| } | ||
|
|
||
| val jsonField = rawType.declaredFields.firstOrNull { it.isAnnotationPresent(JsonValue::class.java) } | ||
| ?: return null | ||
|
|
||
| jsonField.isAccessible = true | ||
|
|
||
| return object : TypeAdapter<T>() { | ||
| override fun write(out: com.google.gson.stream.JsonWriter, value: T) { | ||
| val result = jsonField.get(value) as Any | ||
| (gson.getAdapter(result::class.java) as TypeAdapter<Any>).write(out, result) | ||
| } | ||
|
|
||
| override fun read(`in`: com.google.gson.stream.JsonReader): T { | ||
| val jsonValue = `in`.nextString() | ||
| return rawType.enumConstants.first { jsonField.get(it).toString() == jsonValue } as T | ||
| } | ||
| } as TypeAdapter<T> | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,4 +14,4 @@ data class UpdateConfigurationParams( | |
| val settings: LSPAny, | ||
| ) | ||
|
|
||
| typealias LSPAny = Any? | ||
| typealias LSPAny = Any | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
...c/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/aws/chat/ChatUpdateParams.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / QDJVMC
Unused symbol Warning