Skip to content

Commit b428855

Browse files
rliabhikuhikarAndrew Yuleigaolcrossrac
committed
CodeWhisperer release for April 13, 2023
Co-authored-by: Abhilash Kuhikar <[email protected]> Co-authored-by: Andrew Yu <[email protected]> Co-authored-by: Lei Gao <[email protected]> Co-authored-by: Rachel Cross <[email protected]> Co-authored-by: Tianxing Cheng <[email protected]> Co-authored-by: Will Lo <[email protected]> Co-authored-by: Zoe Lin <[email protected]>
1 parent d65cff5 commit b428855

File tree

152 files changed

+5362
-2222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+5362
-2222
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" : "[CodeWhisperer]: Multiple bug fixes to improve user experience"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "[CodeWhisperer]: Introducing \"Stop code scan\" feature where users will be able to stop the ongoing code scan and immediately start a new one. "
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "[CodeWhisperer]: Automatic import recommendations"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "[CodeWhisperer]: Now supports cross region calls."
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "[CodeWhisperer]: New supported programming languages: C, C++, Go, Kotlin, Php, Ruby, Rust, Scala, Shell, Sql."
4+
}

core/src/software/aws/toolkits/core/credentials/ToolkitCredentialsProvider.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ interface ToolkitBearerTokenProviderDelegate : SdkTokenProvider, ToolkitAuthenti
117117
class ToolkitBearerTokenProvider(val delegate: ToolkitBearerTokenProviderDelegate) : SdkTokenProvider by delegate, ToolkitAuthenticationProvider by delegate {
118118
companion object {
119119
// TODO: is there a better place for this
120-
fun ssoIdentifier(startUrl: String) = "sso;$startUrl"
120+
fun ssoIdentifier(startUrl: String, region: String = DEFAULT_SSO_REGION) = "sso;$region;$startUrl"
121121

122122
// TODO: For AWS Builder ID, we only have startUrl for now instead of each users' metadata data i.e. Email address
123123
fun ssoDisplayName(startUrl: String) = if (startUrl == SONO_URL) {
@@ -133,4 +133,6 @@ class ToolkitBearerTokenProvider(val delegate: ToolkitBearerTokenProviderDelegat
133133

134134
private const val SONO_URL = "https://view.awsapps.com/start"
135135

136+
const val DEFAULT_SSO_REGION = "us-east-1"
137+
136138
private fun extractOrgID(startUrl: String) = startUrl.removePrefix("https://").removeSuffix(".awsapps.com/start")

core/src/software/aws/toolkits/core/credentials/ToolkitCredentialsProviderManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface ToolkitCredentialsChangeListener {
1010
fun providerAdded(identifier: CredentialIdentifier) {}
1111
fun providerModified(identifier: CredentialIdentifier) {}
1212
fun providerRemoved(identifier: CredentialIdentifier) {}
13+
fun providerRemoved(providerId: String) {}
1314
}
1415

1516
class CredentialProviderNotFoundException : RuntimeException {

jetbrains-core/assets/WelcomeToCodeWhisperer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Using Amazon CodeWhisperer
22

33
CodeWhisperer uses machine learning to generate code suggestions from the existing code and comments in your IDE.
4-
Supported languages include: **Java, Python, JavaScript, C# and TypeScript**.
4+
Supported languages include: **Java, Python, JavaScript, C#, TypeScript, C, C++, Go, Rust, PHP, Scala, Kotlin, Ruby, Shell and SQL**.
55

66
---
77

jetbrains-core/it/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererCompletionIntegrationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class CodeWhispererCompletionIntegrationTest : CodeWhispererIntegrationTestBase(
5353
assertDoesNotThrow {
5454
invokeCodeWhispererService()
5555
verify(popupManager, never()).showPopup(any(), any(), any(), any(), any())
56-
verify(clientAdaptor, never()).listRecommendationsPaginator(any(), any())
56+
verify(clientAdaptor, never()).generateCompletionsPaginator(any())
5757
testMessageShown(message("codewhisperer.language.error", file.fileType.name))
5858
}
5959
}

jetbrains-core/it/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererIntegrationTestBase.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import org.mockito.kotlin.timeout
2828
import org.mockito.kotlin.times
2929
import org.mockito.kotlin.verify
3030
import org.mockito.kotlin.whenever
31-
import software.amazon.awssdk.services.codewhisperer.model.ListRecommendationsResponse
31+
import software.amazon.awssdk.services.codewhispererruntime.model.GenerateCompletionsResponse
3232
import software.aws.toolkits.core.TokenConnectionSettings
3333
import software.aws.toolkits.core.credentials.ToolkitBearerTokenProvider
3434
import software.aws.toolkits.jetbrains.core.MockClientManager
@@ -103,7 +103,6 @@ open class CodeWhispererIntegrationTestBase(val projectRule: CodeInsightTestFixt
103103
ApplicationManager.getApplication().replaceService(CodeWhispererTelemetryService::class.java, telemetryServiceSpy, disposableRule.disposable)
104104

105105
stateManager = CodeWhispererExplorerActionManager.getInstance()
106-
stateManager.setHasAcceptedTermsOfService(true)
107106
stateManager.setAutoEnabled(false)
108107

109108
popupManager = spy(CodeWhispererPopupManager.getInstance())
@@ -154,8 +153,8 @@ open class CodeWhispererIntegrationTestBase(val projectRule: CodeInsightTestFixt
154153
}
155154
}
156155

157-
fun withCodeWhispererServiceInvokedAndWait(manual: Boolean = true, runnable: (ListRecommendationsResponse) -> Unit) {
158-
val responseCaptor = argumentCaptor<ListRecommendationsResponse>()
156+
fun withCodeWhispererServiceInvokedAndWait(manual: Boolean = true, runnable: (GenerateCompletionsResponse) -> Unit) {
157+
val responseCaptor = argumentCaptor<GenerateCompletionsResponse>()
159158
val statesCaptor = argumentCaptor<InvocationContext>()
160159
invokeCodeWhispererService(manual)
161160
verify(codewhispererService, timeout(5000).atLeastOnce()).validateResponse(responseCaptor.capture())
@@ -204,7 +203,7 @@ open class CodeWhispererIntegrationTestBase(val projectRule: CodeInsightTestFixt
204203
return runBlocking {
205204
var issues = emptyList<CodeWhispererCodeScanIssue>()
206205
if (success) {
207-
verify(scanManager, timeout(60000).atLeastOnce()).renderResponseOnUIThread(issuesCaptor.capture())
206+
verify(scanManager, timeout(60000).atLeastOnce()).renderResponseOnUIThread(issuesCaptor.capture(), any(), any())
208207
issues = issuesCaptor.lastValue
209208
}
210209
verify(telemetryServiceSpy, timeout(60000).atLeastOnce()).sendSecurityScanEvent(codeScanEventCaptor.capture(), anyOrNull())
@@ -219,7 +218,7 @@ open class CodeWhispererIntegrationTestBase(val projectRule: CodeInsightTestFixt
219218
assertThat(response.responseContext.codeScanTotalIssues).isEqualTo(0)
220219
assertThat(response.responseContext.codeScanJobId).isNull()
221220
val exceptionCaptor = argumentCaptor<Exception>()
222-
verify(scanManager, atLeastOnce()).handleException(exceptionCaptor.capture())
221+
verify(scanManager, atLeastOnce()).handleException(any(), exceptionCaptor.capture())
223222
val e = exceptionCaptor.lastValue
224223
assertThat(e is CodeWhispererCodeScanException).isTrue
225224
assertThat(e.message).isEqualTo(message)

0 commit comments

Comments
 (0)