Skip to content

Commit 8b0445e

Browse files
authored
Merge branch 'main' into review
2 parents b599f67 + aa98252 commit 8b0445e

File tree

10 files changed

+43
-11
lines changed

10 files changed

+43
-11
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" : "Amazon Q /doc: fix open diff in a tab when another modal is open"
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(amazonq): For security reasons, disabled auto linkify for link texts coming in markdown other than [TEXT](URL) format"
4+
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/startup/AmazonQStartupActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import software.aws.toolkits.core.utils.warn
1717
import software.aws.toolkits.jetbrains.core.credentials.AwsBearerTokenConnection
1818
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnectionManager
1919
import software.aws.toolkits.jetbrains.core.credentials.pinning.QConnection
20-
import software.aws.toolkits.jetbrains.core.credentials.sono.isInternalUser
2120
import software.aws.toolkits.jetbrains.core.gettingstarted.emitUserState
21+
import software.aws.toolkits.jetbrains.services.amazonq.CodeWhispererFeatureConfigService
2222
import software.aws.toolkits.jetbrains.services.amazonq.project.ProjectContextController
2323
import software.aws.toolkits.jetbrains.services.amazonq.toolwindow.AmazonQToolWindow
2424
import software.aws.toolkits.jetbrains.services.amazonq.toolwindow.AmazonQToolWindowFactory
@@ -36,7 +36,7 @@ class AmazonQStartupActivity : ProjectActivity {
3636
if (ApplicationManager.getApplication().isUnitTestMode) return
3737

3838
ToolkitConnectionManager.getInstance(project).activeConnectionForFeature(QConnection.getInstance())?.let {
39-
if (it is AwsBearerTokenConnection && isInternalUser(it.startUrl)) {
39+
if (it is AwsBearerTokenConnection && CodeWhispererFeatureConfigService.getInstance().getChatWSContext()) {
4040
CodeWhispererSettings.getInstance().toggleProjectContextEnabled(value = true, passive = true)
4141
}
4242
}

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqDoc/controller/DocController.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
package software.aws.toolkits.jetbrains.services.amazonqDoc.controller
55

66
import com.intellij.diff.DiffContentFactory
7-
import com.intellij.diff.DiffManager
7+
import com.intellij.diff.chains.SimpleDiffRequestChain
88
import com.intellij.diff.contents.EmptyContent
9+
import com.intellij.diff.editor.ChainDiffVirtualFile
10+
import com.intellij.diff.editor.DiffEditorTabFilesManager
911
import com.intellij.diff.requests.SimpleDiffRequest
1012
import com.intellij.diff.util.DiffUserDataKeys
1113
import com.intellij.ide.BrowserUtil
@@ -398,7 +400,8 @@ class DocController(
398400
val request = SimpleDiffRequest(message.filePath, leftDiffContent, rightDiffContent, null, null)
399401
request.putUserData(DiffUserDataKeys.FORCE_READ_ONLY, true)
400402

401-
DiffManager.getInstance().showDiff(project, request)
403+
val newDiff = ChainDiffVirtualFile(SimpleDiffRequestChain(request), message.filePath)
404+
DiffEditorTabFilesManager.getInstance(context.project).showDiffFile(newDiff, true)
402405
}
403406
}
404407

plugins/amazonq/mynah-ui/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/amazonq/mynah-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"lintfix": "eslint -c .eslintrc.js --fix --ext .ts ."
1313
},
1414
"dependencies": {
15-
"@aws/mynah-ui-chat": "npm:@aws/[email protected].5",
15+
"@aws/mynah-ui-chat": "npm:@aws/[email protected].6",
1616
"@types/node": "^14.18.5",
1717
"fs-extra": "^10.0.1",
1818
"sanitize-html": "^2.12.1",

plugins/amazonq/shared/jetbrains-community/resources/software/aws/toolkits/resources/AmazonQBundle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ amazonqInlineChat.popup.generating = Generating...
88
amazonqInlineChat.popup.reject=Reject \u238B
99
amazonqInlineChat.popup.title=Enter Instructions for Q
1010
amazonq.refresh.panel=Refresh Chat Session
11+
amazonq.title=Amazon Q
12+
amazonq.workspace.settings.open.prompt=Workspace index is now enabled. You can disable it from Amazon Q settings.
1113
q.hello=Hello

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/CodeWhispererFeatureConfigService.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class CodeWhispererFeatureConfigService {
117117

118118
fun getInlineCompletion(): Boolean = getFeatureValueForKey(INLINE_COMPLETION).stringValue() == "TREATMENT"
119119

120+
fun getChatWSContext(): Boolean = getFeatureValueForKey(CHAT_WS_CONTEXT).stringValue() == "TREATMENT"
121+
120122
// Get the feature value for the given key.
121123
// In case of a misconfiguration, it will return a default feature value of Boolean false.
122124
private fun getFeatureValueForKey(name: String): FeatureValue =
@@ -136,6 +138,7 @@ class CodeWhispererFeatureConfigService {
136138
private const val CUSTOMIZATION_ARN_OVERRIDE_NAME = "customizationArnOverride"
137139
private const val HIGHLIGHT_COMMAND_NAME = "highlightCommand"
138140
private const val NEW_AUTO_TRIGGER_UX = "newAutoTriggerUX"
141+
private const val CHAT_WS_CONTEXT = "WorkspaceContext"
139142
private val LOG = getLogger<CodeWhispererFeatureConfigService>()
140143

141144
// Also serve as default values in case server-side config isn't there yet
@@ -160,7 +163,12 @@ class CodeWhispererFeatureConfigService {
160163
INLINE_COMPLETION,
161164
"CONTROL",
162165
FeatureValue.builder().stringValue("CONTROL").build()
163-
)
166+
),
167+
CHAT_WS_CONTEXT to FeatureContext(
168+
CHAT_WS_CONTEXT,
169+
"CONTROL",
170+
FeatureValue.builder().stringValue("CONTROL").build()
171+
),
164172
)
165173
}
166174
}

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/settings/CodeWhispererSettings.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33

44
package software.aws.toolkits.jetbrains.settings
55

6+
import com.intellij.openapi.actionSystem.ActionManager
67
import com.intellij.openapi.components.BaseState
78
import com.intellij.openapi.components.PersistentStateComponent
89
import com.intellij.openapi.components.Service
910
import com.intellij.openapi.components.State
1011
import com.intellij.openapi.components.Storage
1112
import com.intellij.openapi.components.service
1213
import com.intellij.util.xmlb.annotations.Property
14+
import software.aws.toolkits.jetbrains.utils.notifyInfo
15+
import software.aws.toolkits.resources.AmazonQBundle
1316

1417
@Service
1518
@State(name = "codewhispererSettings", storages = [Storage("aws.xml")])
@@ -48,6 +51,14 @@ class CodeWhispererSettings : PersistentStateComponent<CodeWhispererConfiguratio
4851
if (!hasEnabledProjectContextOnce()) {
4952
toggleEnabledProjectContextOnce(true)
5053
state.value[CodeWhispererConfigurationType.IsProjectContextEnabled] = value
54+
// todo: hack to bypass module dependency issue (codewhisperer -> shared), should pass [CodeWhispererShowSettingsAction] instead when it's resolved
55+
val actions = ActionManager.getInstance().getAction("codewhisperer.settings")?.let { listOf(it) }.orEmpty()
56+
57+
notifyInfo(
58+
AmazonQBundle.message("amazonq.title"),
59+
AmazonQBundle.message("amazonq.workspace.settings.open.prompt"),
60+
notificationActions = actions
61+
)
5162
}
5263
} else {
5364
state.value[CodeWhispererConfigurationType.IsProjectContextEnabled] = value

ui-tests-starter/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ tasks.test {
5353

5454
// hack to disable ui tests in ./gradlew check
5555
val action = Action<TaskExecutionGraph> {
56-
if (hasTask(tasks.test.get())) {
56+
if (hasTask(tasks.check.get())) {
5757
tasks.test.get().enabled = false
5858
}
5959
}

0 commit comments

Comments
 (0)