Skip to content

Commit ae35e39

Browse files
authored
Merge branch 'feature/ideNotifs' into manodnyb/updateAndRestartAction
2 parents 5c8f131 + 2fdb1d8 commit ae35e39

File tree

7 files changed

+28
-15
lines changed

7 files changed

+28
-15
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Correct search text for Amazon Q inline suggestion keybindings"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix(Amazon Q Code Transformation): always show user latest/correct transformation results"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Amazon Q /dev: Fix error when accepting changes if leading slash is present."
4+
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/session/CodeGenerationState.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ private suspend fun CodeGenerationState.generateCode(
258258
fun registerNewFiles(newFileContents: Map<String, String>): List<NewFileZipInfo> =
259259
newFileContents.map {
260260
NewFileZipInfo(
261-
zipFilePath = it.key,
261+
// Note: When managing file state, we normalize file paths returned from the agent in order to ensure they are handled as relative paths.
262+
zipFilePath = it.key.removePrefix("/"),
262263
fileContent = it.value,
263264
rejected = false,
264265
changeApplied = false
@@ -268,7 +269,8 @@ fun registerNewFiles(newFileContents: Map<String, String>): List<NewFileZipInfo>
268269
fun registerDeletedFiles(deletedFiles: List<String>): List<DeletedFileInfo> =
269270
deletedFiles.map {
270271
DeletedFileInfo(
271-
zipFilePath = it,
272+
// Note: When managing file state, we normalize file paths returned from the agent in order to ensure they are handled as relative paths.
273+
zipFilePath = it.removePrefix("/"),
272274
rejected = false,
273275
changeApplied = false
274276
)

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/ChatController.kt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ import kotlinx.coroutines.job
3232
import kotlinx.coroutines.withContext
3333
import migration.software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
3434
import software.amazon.awssdk.services.codewhispererstreaming.model.UserIntent
35+
import software.aws.toolkits.core.utils.debug
3536
import software.aws.toolkits.core.utils.getLogger
3637
import software.aws.toolkits.core.utils.info
3738
import software.aws.toolkits.core.utils.warn
3839
import software.aws.toolkits.jetbrains.core.coroutines.EDT
39-
import software.aws.toolkits.jetbrains.core.credentials.sono.isInternalUser
4040
import software.aws.toolkits.jetbrains.services.amazonq.CHAT_IMPLICIT_PROJECT_CONTEXT_TIMEOUT
4141
import software.aws.toolkits.jetbrains.services.amazonq.apps.AmazonQAppInitContext
4242
import software.aws.toolkits.jetbrains.services.amazonq.auth.AuthController
@@ -132,7 +132,6 @@ class ChatController private constructor(
132132
var shouldAddIndexInProgressMessage: Boolean = false
133133
var shouldUseWorkspaceContext: Boolean = false
134134
val startUrl = getStartUrl(context.project)
135-
val isInternalUser = isInternalUser(startUrl)
136135

137136
if (prompt.contains("@workspace")) {
138137
if (CodeWhispererSettings.getInstance().isProjectContextEnabled()) {
@@ -145,15 +144,13 @@ class ChatController private constructor(
145144
} else {
146145
sendOpenSettingsMessage(message.tabId)
147146
}
148-
} else if (
149-
CodeWhispererSettings.getInstance().isProjectContextEnabled() &&
150-
isInternalUser &&
151-
ProjectContextController.getInstance(context.project).getProjectContextIndexComplete()
152-
) {
153-
// if user does not have @workspace in the prompt, but user is Amazon internal
154-
// add project context by default
155-
val projectContextController = ProjectContextController.getInstance(context.project)
156-
queryResult = projectContextController.query(prompt, timeout = CHAT_IMPLICIT_PROJECT_CONTEXT_TIMEOUT)
147+
} else if (CodeWhispererSettings.getInstance().isProjectContextEnabled()) {
148+
if (ProjectContextController.getInstance(context.project).getProjectContextIndexComplete()) {
149+
val projectContextController = ProjectContextController.getInstance(context.project)
150+
queryResult = projectContextController.query(prompt, timeout = CHAT_IMPLICIT_PROJECT_CONTEXT_TIMEOUT)
151+
} else {
152+
logger.debug { "skipping implicit workspace context as index is not ready" }
153+
}
157154
}
158155

159156
handleChat(

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerArtifact.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import software.aws.toolkits.core.utils.warn
1919
import software.aws.toolkits.jetbrains.services.codemodernizer.TransformationSummary
2020
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.unzipFile
2121
import java.io.File
22+
import java.util.UUID
2223
import kotlin.io.path.ExperimentalPathApi
2324
import kotlin.io.path.Path
2425
import kotlin.io.path.isDirectory
@@ -39,7 +40,7 @@ open class CodeModernizerArtifact(
3940

4041
companion object {
4142
private const val MAX_SUPPORTED_VERSION = 1.0
42-
private val tempDir = createTempDirectory("codeTransformArtifacts", null)
43+
private var tempDir = createTempDirectory("codeTransformArtifacts", null)
4344
private const val MANIFEST_FILE_NAME = "manifest.json"
4445
private const val SUMMARY_FILE_NAME = "summary.md"
4546
private const val METRICS_FILE_NAME = "metrics.json"
@@ -52,6 +53,7 @@ open class CodeModernizerArtifact(
5253
* If anything goes wrong during this process an exception is thrown.
5354
*/
5455
fun create(zipPath: String): CodeModernizerArtifact {
56+
tempDir = createTempDirectory("codeTransformArtifacts-", UUID.randomUUID().toString())
5557
val path = Path(zipPath)
5658
if (path.exists()) {
5759
if (!unzipFile(path, tempDir.toPath())) {

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/settings/CodeWhispererConfigurable.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,6 @@ class CodeWhispererConfigurable(private val project: Project) :
209209
}
210210

211211
companion object {
212-
private const val Q_INLINE_KEYBINDING_SEARCH_TEXT = "inline suggestion"
212+
private const val Q_INLINE_KEYBINDING_SEARCH_TEXT = "Amazon Q inline suggestion"
213213
}
214214
}

0 commit comments

Comments
 (0)