@@ -5,6 +5,8 @@ package software.aws.toolkits.jetbrains.services.amazonq.lsp
5
5
6
6
import com.intellij.diff.DiffContentFactory
7
7
import com.intellij.diff.requests.SimpleDiffRequest
8
+ import com.intellij.ide.BrowserUtil
9
+ import com.intellij.notification.NotificationType
8
10
import com.intellij.openapi.application.ApplicationManager
9
11
import com.intellij.openapi.fileChooser.FileChooserFactory
10
12
import com.intellij.openapi.fileChooser.FileSaverDescriptor
@@ -48,6 +50,8 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.util.TelemetryParsin
48
50
import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
49
51
import software.aws.toolkits.jetbrains.services.telemetry.TelemetryService
50
52
import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
53
+ import software.aws.toolkits.jetbrains.utils.getCleanedContent
54
+ import software.aws.toolkits.jetbrains.utils.notify
51
55
import software.aws.toolkits.resources.message
52
56
import java.io.File
53
57
import java.nio.file.Files
@@ -101,19 +105,12 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
101
105
102
106
override fun showMessage (messageParams : MessageParams ) {
103
107
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
107
111
}
108
112
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())
117
114
}
118
115
119
116
override fun showMessageRequest (requestParams : ShowMessageRequestParams ): CompletableFuture <MessageActionItem ?>? {
@@ -123,15 +120,33 @@ class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageC
123
120
}
124
121
125
122
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)
127
137
}
128
138
129
- override fun showDocument (params : ShowDocumentParams ? ): CompletableFuture <ShowDocumentResult > {
139
+ override fun showDocument (params : ShowDocumentParams ): CompletableFuture <ShowDocumentResult > {
130
140
try {
131
- if (params == null || params .uri.isNullOrEmpty()) {
141
+ if (params.uri.isNullOrEmpty()) {
132
142
return CompletableFuture .completedFuture(ShowDocumentResult (false ))
133
143
}
134
144
145
+ if (params.external == true ) {
146
+ BrowserUtil .open(params.uri)
147
+ return CompletableFuture .completedFuture(ShowDocumentResult (true ))
148
+ }
149
+
135
150
ApplicationManager .getApplication().invokeLater {
136
151
try {
137
152
val virtualFile = VirtualFileManager .getInstance().findFileByUrl(params.uri)
0 commit comments