@@ -5,6 +5,8 @@ package software.aws.toolkits.jetbrains.services.amazonq.lsp
55
66import com.intellij.diff.DiffContentFactory
77import com.intellij.diff.requests.SimpleDiffRequest
8+ import com.intellij.ide.BrowserUtil
9+ import com.intellij.notification.NotificationType
810import com.intellij.openapi.application.ApplicationManager
911import com.intellij.openapi.fileChooser.FileChooserFactory
1012import com.intellij.openapi.fileChooser.FileSaverDescriptor
@@ -48,6 +50,8 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.util.TelemetryParsin
4850import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
4951import software.aws.toolkits.jetbrains.services.telemetry.TelemetryService
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
@@ -101,19 +105,12 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
101105
102106 override fun showMessage (messageParams : MessageParams ) {
103107 val type = when (messageParams.type) {
104- MessageType .Error -> Level .ERROR
105- MessageType .Warning -> Level . WARN
106- MessageType .Info , MessageType .Log -> Level . INFO
108+ MessageType .Error -> NotificationType .ERROR
109+ MessageType .Warning -> NotificationType . WARNING
110+ MessageType .Info , MessageType .Log -> NotificationType . INFORMATION
107111 }
108112
109- if (type == Level .ERROR &&
110- messageParams.message.lineSequence().firstOrNull()?.contains(" NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode." ) == true
111- ) {
112- LOG .info { " Suppressed Flare AWS JS SDK v2 EoL error message" }
113- return
114- }
115-
116- LOG .atLevel(type).log(messageParams.message)
113+ notify(type, message(" q.window.title" ), getCleanedContent(messageParams.message, true ), project, emptyList())
117114 }
118115
119116 override fun showMessageRequest (requestParams : ShowMessageRequestParams ): CompletableFuture <MessageActionItem ?>? {
@@ -123,15 +120,33 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
123120 }
124121
125122 override fun logMessage (message : MessageParams ) {
126- showMessage(message)
123+ val type = when (message.type) {
124+ MessageType .Error -> Level .ERROR
125+ MessageType .Warning -> Level .WARN
126+ MessageType .Info , MessageType .Log -> Level .INFO
127+ }
128+
129+ if (type == Level .ERROR &&
130+ message.message.lineSequence().firstOrNull()?.contains(" NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode." ) == true
131+ ) {
132+ LOG .info { " Suppressed Flare AWS JS SDK v2 EoL error message" }
133+ return
134+ }
135+
136+ LOG .atLevel(type).log(message.message)
127137 }
128138
129- override fun showDocument (params : ShowDocumentParams ? ): CompletableFuture <ShowDocumentResult > {
139+ override fun showDocument (params : ShowDocumentParams ): CompletableFuture <ShowDocumentResult > {
130140 try {
131- if (params == null || params .uri.isNullOrEmpty()) {
141+ if (params.uri.isNullOrEmpty()) {
132142 return CompletableFuture .completedFuture(ShowDocumentResult (false ))
133143 }
134144
145+ if (params.external == true ) {
146+ BrowserUtil .open(params.uri)
147+ return CompletableFuture .completedFuture(ShowDocumentResult (true ))
148+ }
149+
135150 ApplicationManager .getApplication().invokeLater {
136151 try {
137152 val virtualFile = VirtualFileManager .getInstance().findFileByUrl(params.uri)
0 commit comments