Skip to content

fix(amazonq): move window/showMessage log output to idea.log #5708

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 3 commits into from
May 13, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.intellij.diff.DiffContentFactory
import com.intellij.diff.DiffManager
import com.intellij.diff.DiffManagerEx
import com.intellij.diff.requests.SimpleDiffRequest
import com.intellij.notification.NotificationType
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.fileChooser.FileChooserFactory
import com.intellij.openapi.fileChooser.FileSaverDescriptor
Expand All @@ -25,8 +24,10 @@ import org.eclipse.lsp4j.PublishDiagnosticsParams
import org.eclipse.lsp4j.ShowDocumentParams
import org.eclipse.lsp4j.ShowDocumentResult
import org.eclipse.lsp4j.ShowMessageRequestParams
import org.slf4j.event.Level
import software.aws.toolkits.core.utils.error
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.info
import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.jetbrains.core.credentials.AwsBearerTokenConnection
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnectionManager
Expand Down Expand Up @@ -70,11 +71,17 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC

override fun showMessage(messageParams: MessageParams) {
val type = when (messageParams.type) {
MessageType.Error -> NotificationType.ERROR
MessageType.Warning -> NotificationType.WARNING
MessageType.Info, MessageType.Log -> NotificationType.INFORMATION
MessageType.Error -> Level.ERROR
MessageType.Warning -> Level.WARN
MessageType.Info, MessageType.Log -> Level.INFO
}
println("$type: ${messageParams.message}")

if (type == Level.ERROR && messageParams.message.lineSequence().firstOrNull()?.contains("NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode.") == true) {
LOG.info { "Suppressed Flare AWS JS SDK v2 EoL error message" }
return
}

LOG.atLevel(type).log(messageParams.message)
}

override fun showMessageRequest(requestParams: ShowMessageRequestParams): CompletableFuture<MessageActionItem?>? {
Expand Down
Loading