Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
const val LSP_ENABLE_TELEMETRY_EVENTS_CONFIGURATION_KEY = "enableTelemetryEventsToDestination"
const val LSP_CUSTOMIZATION_CONFIGURATION_KEY = "customization"
const val LSP_WORKSPACE_CONTEXT_ENABLED_KEY = "workspaceContext"
const val LSP_PROJECT_CONTEXT_KEY = "projectContext"

Check warning on line 16 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspConstants.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused symbol

Property "LSP_PROJECT_CONTEXT_KEY" is never used

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Property "LSP_PROJECT_CONTEXT_KEY" is never used
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

@file:Suppress("BannedImports")
package software.aws.toolkits.jetbrains.services.amazonq.lsp

import com.google.gson.Gson
import com.google.gson.ToNumberPolicy
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.execution.impl.ExecutionManagerImpl
Expand Down Expand Up @@ -43,7 +44,7 @@
import org.eclipse.lsp4j.jsonrpc.Launcher
import org.eclipse.lsp4j.jsonrpc.Launcher.Builder
import org.eclipse.lsp4j.jsonrpc.MessageConsumer
import org.eclipse.lsp4j.jsonrpc.messages.Message
import org.eclipse.lsp4j.jsonrpc.messages.NotificationMessage
import org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage
import org.eclipse.lsp4j.launch.LSPLauncher
import org.slf4j.event.Level
Expand All @@ -56,6 +57,7 @@
import software.aws.toolkits.jetbrains.services.amazonq.lsp.dependencies.DefaultModuleDependenciesService
import software.aws.toolkits.jetbrains.services.amazonq.lsp.encryption.JwtEncryptionManager
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AmazonQLspTypeAdapterFactory
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AsyncChatUiListener
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AwsExtendedInitializeResult
import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AwsServerCapabilitiesProvider
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.createExtendedClientMetadata
Expand Down Expand Up @@ -287,6 +289,16 @@
AwsServerCapabilitiesProvider.getInstance(project).setAwsServerCapabilities(result.getAwsServerCapabilities())
AmazonQLspService.getInstance(project).notifyInitializeMessageReceived()
}
if (message is NotificationMessage && message.method == "aws/chat/sendContextCommands") {
val showContextCommands = """

Check warning on line 293 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L293

Added line #L293 was not covered by tests
{
"command":"aws/chat/sendContextCommands",
"params": ${Gson().toJson(message.params)}

Check warning on line 296 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L296

Added line #L296 was not covered by tests
}
""".trimIndent()

Check warning on line 298 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L298

Added line #L298 was not covered by tests

AsyncChatUiListener.notifyPartialMessageUpdate(showContextCommands)

Check warning on line 300 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt#L300

Added line #L300 was not covered by tests
}
consumer?.consume(message)
}
}
Expand Down Expand Up @@ -373,18 +385,6 @@
}
}

class MessageTracer {
private val traceLogger = LOG.atLevel(if (isDeveloperMode()) Level.INFO else Level.DEBUG)

fun trace(direction: String, message: Message) {
traceLogger.log {
buildString {
append("$direction: ")
append(message.toString())
}
}
}
}
companion object {
private val LOG = getLogger<AmazonQServerInstance>()
}
Expand Down
Loading