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 @@ -9,7 +9,7 @@ amazonqInlineChat.popup.title=Enter Instructions for Q
amazonq.refresh.panel=Refresh Chat Session
amazonq.title=Amazon Q
amazonq.workspace.settings.open.prompt=Workspace index is now enabled. You can disable it from Amazon Q settings.
action.q.manage.subscription.text=Manage Subscription
action.q.manage.subscription.text=Manage Q Developer Pro Subscription
action.q.profile.usage.text=You changed your profile
action.q.profile.usage=You''re using the ''<b>{0}</b>'' profile for Amazon Q.
action.q.switchProfiles.text=Change Profile
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// 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.intellij.diff.DiffContentFactory
import com.intellij.diff.requests.SimpleDiffRequest
import com.intellij.ide.BrowserUtil
import com.intellij.notification.NotificationAction
import com.intellij.notification.NotificationType
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.fileChooser.FileChooserFactory
Expand Down Expand Up @@ -112,19 +114,28 @@
}

override fun showMessage(messageParams: MessageParams) {
val type = when (messageParams.type) {
MessageType.Error -> NotificationType.ERROR
MessageType.Warning -> NotificationType.WARNING
MessageType.Info, MessageType.Log -> NotificationType.INFORMATION
}

notify(type, message("q.window.title"), getCleanedContent(messageParams.message, true), project, emptyList())
notify(messageParams.type.toNotificationType(), message("q.window.title"), getCleanedContent(messageParams.message, true), project, emptyList())

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L117 was not covered by tests
}

override fun showMessageRequest(requestParams: ShowMessageRequestParams): CompletableFuture<MessageActionItem?>? {
println(requestParams)
override fun showMessageRequest(requestParams: ShowMessageRequestParams): CompletableFuture<MessageActionItem?> {
val future = CompletableFuture<MessageActionItem?>()

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L121 was not covered by tests
if (requestParams.actions.isNullOrEmpty()) {
future.complete(null)

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L123 was not covered by tests
}

notify(
requestParams.type.toNotificationType(),
message("q.window.title"),
getCleanedContent(requestParams.message, true),
project,
requestParams.actions.map { item ->
NotificationAction.createSimple(item.title) {
future.complete(item)
}

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

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt#L126-L134

Added lines #L126 - L134 were not covered by tests
}
)

return CompletableFuture.completedFuture(null)
return future

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L138 was not covered by tests
}

override fun logMessage(message: MessageParams) {
Expand Down Expand Up @@ -280,6 +291,7 @@
)
)
}

AmazonQLspConstants.LSP_Q_CONFIGURATION_KEY -> {
add(
AmazonQLspConfiguration(
Expand Down Expand Up @@ -327,6 +339,12 @@

private fun File.toVirtualFile() = LocalFileSystem.getInstance().findFileByIoFile(this)

private fun MessageType.toNotificationType() = when (this) {
MessageType.Error -> NotificationType.ERROR
MessageType.Warning -> NotificationType.WARNING
MessageType.Info, MessageType.Log -> NotificationType.INFORMATION
}

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

View check run for this annotation

Codecov / codecov/patch

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt#L343-L346

Added lines #L343 - L346 were not covered by tests

override fun openFileDiff(params: OpenFileDiffParams): CompletableFuture<Unit> =
CompletableFuture.supplyAsync(
{
Expand All @@ -352,6 +370,7 @@
contentFactory.create(project, originalContent, virtualFile) to
contentFactory.createEmpty()
}

else -> {
val newContent = params.fileContent.orEmpty()
isNewFile = newContent == originalContent
Expand All @@ -360,6 +379,7 @@
contentFactory.createEmpty() to
contentFactory.create(project, newContent, virtualFile)
}

else -> {
contentFactory.create(project, originalContent, virtualFile) to
contentFactory.create(project, newContent, virtualFile)
Expand Down
Loading