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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@file:Suppress("BannedImports")
package software.aws.toolkits.jetbrains.services.cwc.commands

import com.google.gson.Gson
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import kotlinx.coroutines.flow.MutableSharedFlow
Expand All @@ -16,6 +17,7 @@
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SendToPromptParams
import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.TriggerType
import software.aws.toolkits.jetbrains.services.amazonq.messages.AmazonQMessage
import software.aws.toolkits.jetbrains.services.amazonqCodeTest.controller.TestCommandMessage
import software.aws.toolkits.jetbrains.services.cwc.editor.context.ActiveFileContextExtractor
import software.aws.toolkits.jetbrains.services.cwc.editor.context.ExtractionTriggerType

Expand All @@ -26,21 +28,25 @@
val flow = _messages.asSharedFlow()

fun reportMessageClick(command: EditorContextCommand, project: Project) {
// new agentic chat route
ApplicationManager.getApplication().executeOnPooledThread {
runBlocking {
val contextExtractor = ActiveFileContextExtractor.create(fqnWebviewAdapter = null, project = project)
val fileContext = contextExtractor.extractContextForTrigger(ExtractionTriggerType.ContextMenu)
val codeSelection = "\n```\n${fileContext.focusAreaContext?.codeSelection?.trimIndent()?.trim()}\n```\n"
var uiMessage: FlareUiMessage? = null
if (command.verb != SEND_TO_PROMPT) {
val params = GenericCommandParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU, genericCommand = command.name)
uiMessage = FlareUiMessage(command = GENERIC_COMMAND, params = params)
} else {
val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU)
uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params)
if (command == EditorContextCommand.GenerateUnitTests) {
AsyncChatUiListener.notifyPartialMessageUpdate(project, Gson().toJson(TestCommandMessage()))
} else {

Check warning on line 33 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt#L32-L33

Added lines #L32 - L33 were not covered by tests
// new agentic chat route
ApplicationManager.getApplication().executeOnPooledThread {
runBlocking {
val contextExtractor = ActiveFileContextExtractor.create(fqnWebviewAdapter = null, project = project)
val fileContext = contextExtractor.extractContextForTrigger(ExtractionTriggerType.ContextMenu)

Check warning on line 38 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt#L35-L38

Added lines #L35 - L38 were not covered by tests
val codeSelection = "\n```\n${fileContext.focusAreaContext?.codeSelection?.trimIndent()?.trim()}\n```\n"
var uiMessage: FlareUiMessage? = null

Check warning on line 40 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt#L40

Added line #L40 was not covered by tests
if (command.verb != SEND_TO_PROMPT) {
val params = GenericCommandParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU, genericCommand = command.name)
uiMessage = FlareUiMessage(command = GENERIC_COMMAND, params = params)

Check warning on line 43 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt#L42-L43

Added lines #L42 - L43 were not covered by tests
} else {
val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU)
uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params)

Check warning on line 46 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt#L45-L46

Added lines #L45 - L46 were not covered by tests
}
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)

Check warning on line 48 in plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt#L48

Added line #L48 was not covered by tests
}
AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class QuickActionGenerator {

const quickActionCommands = [
{
groupName: `Q Developer Agent for <b>Software Development</b>`,
commands: [
...(this.isFeatureDevEnabled
? [
Expand Down Expand Up @@ -77,6 +78,11 @@ export class QuickActionGenerator {
},
]
: []),
],
},
{
groupName: `Q Developer Agent for <b>Code Transformation</b>`,
commands:[
...(this.isCodeTransformEnabled
? [
{
Expand All @@ -87,7 +93,22 @@ export class QuickActionGenerator {
]
: []),
],
}
},
{
groupName: 'Quick Actions',
commands: [
{
command: '/help',
icon: MynahIcons.HELP,
description: 'Learn more about Amazon Q',
},
{
command: '/clear',
icon: MynahIcons.TRASH,
description: 'Clear this session',
},
],
},
].filter((section) => section.commands.length > 0)

const commandUnavailability: Record<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,14 @@ private handleDocCommand(chatPrompt: ChatPrompt, tabID: string, taskName: string
this.connector.startTestGen(testTabId, realPromptText)
return
}

/**
* right click -> generate test has no tab id
* we have to manually create one if a testgen tab
* wasn't previously created
*/
if (!tabID) {
tabID = this.mynahUI?.updateStore('', {})
}
const affectedTabId: string | undefined = this.addTab(tabID)

// if there is no test tab, open a new one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
),
history = true,
export = true,
mcpServers = true,
// Seems like this is the only way to bounce reroute back to the LSP?
reroute = true,
mcpServers = true

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

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AwsServerCapabilitiesProvider.kt#L37

Added line #L37 was not covered by tests
)
}
}
Expand All @@ -50,7 +48,6 @@
val history: Boolean,
val export: Boolean,
val mcpServers: Boolean,
val reroute: Boolean,
)

data class QuickActions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ data class DeveloperProfiles(
val developerProfiles: Boolean,
val mcp: Boolean,
val pinnedContextEnabled: Boolean,
val imageContextEnabled: Boolean,
val reroute: Boolean,
val workspaceFilePath: String?,
)
Expand Down Expand Up @@ -68,7 +67,6 @@ fun createExtendedClientMetadata(project: Project): ExtendedClientMetadata {
developerProfiles = true,
mcp = true,
pinnedContextEnabled = true,
imageContextEnabled = true,
reroute = true,
workspaceFilePath = project.workspaceFile?.path,
),
Expand Down
Loading