@@ -7,6 +7,8 @@ import com.intellij.diff.DiffContentFactory
77import com.intellij.diff.DiffManager
88import com.intellij.diff.DiffManagerEx
99import com.intellij.diff.requests.SimpleDiffRequest
10+ import com.intellij.ide.BrowserUtil
11+ import com.intellij.notification.NotificationType
1012import com.intellij.openapi.application.ApplicationManager
1113import com.intellij.openapi.fileChooser.FileChooserFactory
1214import com.intellij.openapi.fileChooser.FileSaverDescriptor
@@ -48,6 +50,8 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.credential
4850import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.credentials.SsoProfileData
4951import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
5052import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
53+ import software.aws.toolkits.jetbrains.utils.getCleanedContent
54+ import software.aws.toolkits.jetbrains.utils.notify
5155import software.aws.toolkits.resources.message
5256import java.io.File
5357import java.nio.file.Files
@@ -70,19 +74,12 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
7074
7175 override fun showMessage (messageParams : MessageParams ) {
7276 val type = when (messageParams.type) {
73- MessageType .Error -> Level .ERROR
74- MessageType .Warning -> Level . WARN
75- MessageType .Info , MessageType .Log -> Level . INFO
77+ MessageType .Error -> NotificationType .ERROR
78+ MessageType .Warning -> NotificationType . WARNING
79+ MessageType .Info , MessageType .Log -> NotificationType . INFORMATION
7680 }
7781
78- if (type == Level .ERROR &&
79- messageParams.message.lineSequence().firstOrNull()?.contains(" NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode." ) == true
80- ) {
81- LOG .info { " Suppressed Flare AWS JS SDK v2 EoL error message" }
82- return
83- }
84-
85- LOG .atLevel(type).log(messageParams.message)
82+ notify(type, message(" q.window.title" ), getCleanedContent(messageParams.message, true ), project, emptyList())
8683 }
8784
8885 override fun showMessageRequest (requestParams : ShowMessageRequestParams ): CompletableFuture <MessageActionItem ?>? {
@@ -92,15 +89,33 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
9289 }
9390
9491 override fun logMessage (message : MessageParams ) {
95- showMessage(message)
92+ val type = when (message.type) {
93+ MessageType .Error -> Level .ERROR
94+ MessageType .Warning -> Level .WARN
95+ MessageType .Info , MessageType .Log -> Level .INFO
96+ }
97+
98+ if (type == Level .ERROR &&
99+ message.message.lineSequence().firstOrNull()?.contains(" NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode." ) == true
100+ ) {
101+ LOG .info { " Suppressed Flare AWS JS SDK v2 EoL error message" }
102+ return
103+ }
104+
105+ LOG .atLevel(type).log(message.message)
96106 }
97107
98- override fun showDocument (params : ShowDocumentParams ? ): CompletableFuture <ShowDocumentResult > {
108+ override fun showDocument (params : ShowDocumentParams ): CompletableFuture <ShowDocumentResult > {
99109 try {
100- if (params == null || params .uri.isNullOrEmpty()) {
110+ if (params.uri.isNullOrEmpty()) {
101111 return CompletableFuture .completedFuture(ShowDocumentResult (false ))
102112 }
103113
114+ if (params.external == true ) {
115+ BrowserUtil .open(params.uri)
116+ return CompletableFuture .completedFuture(ShowDocumentResult (true ))
117+ }
118+
104119 ApplicationManager .getApplication().invokeLater {
105120 try {
106121 val virtualFile = VirtualFileManager .getInstance().findFileByUrl(params.uri)
0 commit comments