@@ -8,9 +8,12 @@ import com.intellij.notification.NotificationAction
88import com.intellij.openapi.options.ShowSettingsUtil
99import com.intellij.openapi.project.Project
1010import com.intellij.openapi.vfs.VirtualFile
11+ import com.intellij.platform.lsp.api.Lsp4jClient
12+ import com.intellij.platform.lsp.api.LspServerNotificationsHandler
1113import com.intellij.platform.lsp.api.LspServerSupportProvider
1214import com.intellij.platform.lsp.api.ProjectWideLspServerDescriptor
1315import org.eclipse.lsp4j.ConfigurationItem
16+ import org.eclipse.lsp4j.MessageParams
1417import org.eclipse.lsp4j.services.LanguageServer
1518import software.aws.toolkit.core.utils.getLogger
1619import 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