Skip to content

Commit 6d1a095

Browse files
committed
fix(cloudformation): suppress noisy LSP logMessage notifications from surfacing as balloon popups (aws#6259)
1 parent 4ccaeba commit 6d1a095

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

plugins/toolkit/jetbrains-core/src-253+/software/aws/toolkits/jetbrains/services/cfnlsp/server/CfnLspServerSupportProvider.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import com.intellij.notification.NotificationAction
88
import com.intellij.openapi.options.ShowSettingsUtil
99
import com.intellij.openapi.project.Project
1010
import com.intellij.openapi.vfs.VirtualFile
11+
import com.intellij.platform.lsp.api.Lsp4jClient
12+
import com.intellij.platform.lsp.api.LspServerNotificationsHandler
1113
import com.intellij.platform.lsp.api.LspServerSupportProvider
1214
import com.intellij.platform.lsp.api.ProjectWideLspServerDescriptor
1315
import org.eclipse.lsp4j.ConfigurationItem
16+
import org.eclipse.lsp4j.MessageParams
1417
import org.eclipse.lsp4j.services.LanguageServer
1518
import software.aws.toolkit.core.utils.getLogger
1619
import software.aws.toolkit.core.utils.info
@@ -51,6 +54,9 @@ class CfnLspServerDescriptor private constructor(project: Project) :
5154

5255
override fun isSupportedFile(file: VirtualFile) = file.isCfnTemplate()
5356

57+
override fun createLsp4jClient(handler: LspServerNotificationsHandler): Lsp4jClient =
58+
Lsp4jClient(CfnLspNotificationsHandler(handler))
59+
5460
override fun createCommandLine(): GeneralCommandLine {
5561
val serverPath = try {
5662
installer.getServerPath()
@@ -204,3 +210,15 @@ class CfnLspServerDescriptor private constructor(project: Project) :
204210
instances.getOrPut(project) { CfnLspServerDescriptor(project) }
205211
}
206212
}
213+
214+
private class CfnLspNotificationsHandler(
215+
private val delegate: LspServerNotificationsHandler,
216+
) : LspServerNotificationsHandler by delegate {
217+
override fun logMessage(params: MessageParams) {
218+
LOG.info { "CloudFormation language server [${params.type}]: ${params.message}" }
219+
}
220+
221+
companion object {
222+
private val LOG = getLogger<CfnLspNotificationsHandler>()
223+
}
224+
}

0 commit comments

Comments
 (0)