Skip to content

feat(amazonq): Add quick actions to Flare chat #5561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 21, 2025

Conversation

manodnyab
Copy link
Contributor

Description

Ability to add quick actions
Added /help and /clear actions

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@manodnyab manodnyab requested review from a team as code owners April 11, 2025 07:52
Copy link

github-actions bot commented Apr 11, 2025

Qodana Community for JVM

7 new problems were found

Inspection name Severity Problems
Unused import directive 🔶 Warning 3
Unused symbol 🔶 Warning 3
Function or property has platform type ◽️ Notice 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@@ -17,6 +17,7 @@
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.future.await

Check warning

Code scanning / QDJVMC

Unused import directive Warning

Unused import directive
Base automatically changed from manodnyb/setupChatComponentsWithFlare to feature/q-lsp-chat April 11, 2025 20:05

fun getAwsServerCapabilities(): AwsServerCapabilities? = awsServerCapabilities

fun setAwsServerCapabilities(awsServerCapabilities: AwsServerCapabilities?) {

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Function "setAwsServerCapabilities" is never used
@manodnyab
Copy link
Contributor Author

/retryBuilds

}
}

class AwsExtendedInitializeResult : InitializeResult() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data class

Comment on lines 110 to 112
private val serverStartedListener = mutableListOf<AmazonQServerStartedListener>()
fun addServerStartedListener(listener: AmazonQServerStartedListener) = serverStartedListener.add(listener)
fun notifyServerStarted() = serverStartedListener.forEach { it() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer to have a flag that can be queried by consumers to handle the case where the server exits unexpectedly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been renamed incorrectly. This listens to when we receive an initialize message and is separate from starting servers. Monitoring server state will be executed separately

encryptionManager: JwtEncryptionManager?,
browser: Browser,
) {
result.whenComplete { value, error ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to handle error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customMessageTracer.trace("INCOMING", message)
if (message is ResponseMessage && message.result is AwsExtendedInitializeResult) {
val result = message.result as AwsExtendedInitializeResult
AwsServerCapabilitiesProvider.getInstance(project).setAwsServerCapabilities(result.getAwsServerCapabilities())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already expose capabilities on the service

AmazonQLspServer.getInstance(project).capabilities.serverCapabilities

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to keep this in place to be able to access other agents potentially from this map

val partialResultToken = chatCommunicationManager.addPartialChatMessage(tabId)
var encryptionManager: JwtEncryptionManager? = null
val result = AmazonQLspService.executeIfRunning(project) { server ->
encryptionManager = this.encryptionManager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are extracting the encryptionManager, we might as well capture the server instance so that we don't need to fetch it on every invocation

}
}

class AwsExtendedInitializeResult(awsServerCapabilities: AwsServerCapabilities? = null) : InitializeResult() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data class

@@ -20,7 +20,7 @@

class MessageSerializer @VisibleForTesting constructor() {

private val objectMapper = jacksonObjectMapper()
val objectMapper = jacksonObjectMapper()

Check notice

Code scanning / QDJVMC

Function or property has platform type Note

Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable.
@@ -19,6 +19,7 @@
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.Key
import com.intellij.openapi.util.SystemInfo
import com.intellij.util.animation.consumer

Check warning

Code scanning / QDJVMC

Unused import directive Warning

Unused import directive
@@ -40,6 +41,10 @@
import org.eclipse.lsp4j.TextDocumentClientCapabilities
import org.eclipse.lsp4j.WorkspaceClientCapabilities
import org.eclipse.lsp4j.jsonrpc.Launcher
import org.eclipse.lsp4j.jsonrpc.Launcher.Builder

Check warning

Code scanning / QDJVMC

Unused import directive Warning

Unused import directive
@@ -348,7 +373,21 @@
}
}

class MessageTracer {

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Class "MessageTracer" is never used
class MessageTracer {
private val traceLogger = LOG.atLevel(if (isDeveloperMode()) Level.INFO else Level.DEBUG)

fun trace(direction: String, message: Message) {

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Function "trace" is never used
@manodnyab
Copy link
Contributor Author

manodnyab commented Apr 21, 2025

/retryBuilds

@manodnyab manodnyab merged commit b85d204 into feature/q-lsp-chat Apr 21, 2025
14 of 16 checks passed
@manodnyab manodnyab deleted the manodnyb/addQuickActions branch April 21, 2025 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants