Skip to content

Commit 0628cae

Browse files
Merge branch 'feature/q-lsp' into samgst/lsp-WSmessages
2 parents 5458f0c + 35b0424 commit 0628cae

File tree

29 files changed

+887
-81
lines changed

29 files changed

+887
-81
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" : "Fix suggestion not visible in remote for 2024.3"
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" : "/test: update capability card text"
4+
}

buildspec/windowsTests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ env:
88
phases:
99
install:
1010
commands:
11+
# force install java21 while we work throuh path issues
12+
- |
13+
$javaName = "C:\Program Files\Amazon Corretto" | ForEach-Object {
14+
ls $_ | Where-Object {$_ -Like "jdk*"} | Sort-Object -Descending -Property Name | Select-Object -first 1 -expandproperty Name
15+
}
16+
$JAVA_HOME = "C:\Program Files\Amazon Corretto\$javaName"
1117
- |
1218
if(-Not($Env:CODE_COV_TOKEN -eq $null)) {
1319
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
@@ -21,6 +27,8 @@ phases:
2127
# See https://github.com/NuGet/NuGet.Client/pull/4259
2228
$Env:NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY = "3,1000"
2329
30+
$Env:JAVA_HOME = $JAVA_HOME
31+
2432
if ($Env:CODEARTIFACT_DOMAIN_NAME -and $Env:CODEARTIFACT_REPO_NAME) {
2533
$Env:CODEARTIFACT_URL=aws codeartifact get-repository-endpoint --domain $Env:CODEARTIFACT_DOMAIN_NAME --repository $Env:CODEARTIFACT_REPO_NAME --format maven --query repositoryEndpoint --output text
2634
# $Env:CODEARTIFACT_NUGET_URL=aws codeartifact get-repository-endpoint --domain $Env:CODEARTIFACT_DOMAIN_NAME --repository $Env:CODEARTIFACT_REPO_NAME --format nuget --query repositoryEndpoint --output text

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/focusArea/FocusAreaContextExtractor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class FocusAreaContextExtractor(private val fqnWebviewAdapter: FqnWebviewAdapter
180180
val startOffset = 0.coerceAtLeast(offset - halfMaxCharacters)
181181
val endOffset = fileText.length.coerceAtMost(offset + halfMaxCharacters)
182182

183-
// Adjust the start and end offsets if necessary to ensure a total of 10k characters
183+
// Adjust the start and end offsets if necessary to ensure a total of 40k characters
184184
val excessCharacters = maxCharacters - (endOffset - startOffset)
185185
val adjustedStartOffset = 0.coerceAtLeast(startOffset - excessCharacters)
186186
val adjustedEndOffset = fileText.length.coerceAtMost(endOffset + excessCharacters)
@@ -198,7 +198,7 @@ class FocusAreaContextExtractor(private val fqnWebviewAdapter: FqnWebviewAdapter
198198
}
199199

200200
companion object {
201-
const val MAX_LENGTH = 10000
201+
const val MAX_LENGTH = 40000
202202
}
203203
}
204204

plugins/amazonq/codewhisperer/jetbrains-community/src/migration/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ interface CodeWhispererModelConfigurator {
3737
*/
3838
fun getNewUpdate(connectionId: String): Collection<CustomizationUiItem>?
3939

40+
/**
41+
* Get any current persisted customization arn override config
42+
*/
43+
fun getPersistedCustomizationOverride(): String?
44+
4045
companion object {
4146
fun getInstance(): CodeWhispererModelConfigurator = service()
4247
}

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/customization/CodeWhispererModelConfigurator.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
7676

7777
private val hasShownNewCustomizationNotification = AtomicBoolean(false)
7878

79+
@Deprecated("Use customizationArnOverrideV2 for the latest arn override persistence")
7980
private var serviceDefaultArn: String? = null
8081

82+
private var customizationArnOverrideV2: String? = null
83+
8184
override fun showConfigDialog(project: Project) {
8285
runInEdt {
8386
calculateIfIamIdentityCenterConnection(project) {
@@ -181,7 +184,7 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
181184
*/
182185
override fun switchCustomization(project: Project, newCustomization: CodeWhispererCustomization?, isOverride: Boolean) {
183186
calculateIfIamIdentityCenterConnection(project) {
184-
if (isOverride && (newCustomization == null || newCustomization.arn.isEmpty() || serviceDefaultArn == newCustomization.arn)) {
187+
if (isOverride && (newCustomization == null || newCustomization.arn.isEmpty() || customizationArnOverrideV2 == newCustomization.arn)) {
185188
return@calculateIfIamIdentityCenterConnection
186189
}
187190
val oldCus = connectionIdToActiveCustomizationArn[it.id]
@@ -197,7 +200,7 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
197200
CodeWhispererCustomizationListener.notifyCustomUiUpdate()
198201
}
199202
if (isOverride) {
200-
serviceDefaultArn = newCustomization?.arn
203+
customizationArnOverrideV2 = newCustomization?.arn
201204
}
202205
}
203206
}
@@ -249,6 +252,7 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
249252
state.connectionIdToActiveCustomizationArn.putAll(this.connectionIdToActiveCustomizationArn)
250253
state.previousAvailableCustomizations.putAll(this.connectionToCustomizationsShownLastTime)
251254
state.serviceDefaultArn = this.serviceDefaultArn
255+
state.customizationArnOverrideV2 = this.customizationArnOverrideV2
252256

253257
return state
254258
}
@@ -261,8 +265,12 @@ class DefaultCodeWhispererModelConfigurator : CodeWhispererModelConfigurator, Pe
261265
connectionToCustomizationsShownLastTime.putAll(state.previousAvailableCustomizations)
262266

263267
this.serviceDefaultArn = state.serviceDefaultArn
268+
this.customizationArnOverrideV2 = state.customizationArnOverrideV2
264269
}
265270

271+
// current latest field is customizationArnOverrideV2
272+
override fun getPersistedCustomizationOverride() = customizationArnOverrideV2
273+
266274
override fun dispose() {}
267275

268276
private fun invalidateSelectedAndNotify(project: Project) {
@@ -292,8 +300,12 @@ class CodeWhispererCustomizationState : BaseState() {
292300
@get:MapAnnotation
293301
val previousAvailableCustomizations by map<String, MutableList<String>>()
294302

303+
@Deprecated("Use customizationArnOverrideV2 for the latest arn override persistence")
295304
@get:Property
296305
var serviceDefaultArn by string()
306+
307+
@get:Property
308+
var customizationArnOverrideV2 by string()
297309
}
298310

299311
data class CustomizationUiItem(

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/startup/CodeWhispererProjectStartupActivity.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,18 @@ class CodeWhispererProjectStartupActivity : StartupActivity.DumbAware {
7474
runOnce = true
7575
}
7676

77-
// Start a job that runs every 30 mins
77+
// Start a job that runs every 180 minutes
7878
private fun initFeatureConfigPollingJob(project: Project) {
7979
projectCoroutineScope(project).launch {
8080
while (isActive) {
8181
CodeWhispererFeatureConfigService.getInstance().fetchFeatureConfigs(project)
8282
CodeWhispererFeatureConfigService.getInstance().getCustomizationFeature()?.let { customization ->
83+
val persistedCustomizationOverride = CodeWhispererModelConfigurator.getInstance().getPersistedCustomizationOverride()
84+
val latestCustomizationOverride = customization.value.stringValue()
85+
if (persistedCustomizationOverride == latestCustomizationOverride) return@let
86+
87+
// latest is different from the currently persisted, need update
88+
CodeWhispererFeatureConfigService.getInstance().validateCustomizationOverride(project, customization)
8389
CodeWhispererModelConfigurator.getInstance().switchCustomization(
8490
project,
8591
CodeWhispererCustomization(arn = customization.value.stringValue(), name = customization.variation),

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/util/CodeWhispererConstants.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ object CodeWhispererConstants {
8888
const val TOTAL_MILLIS_IN_SECOND = 1000
8989
const val TOTAL_SECONDS_IN_MINUTE: Long = 60L
9090
const val ACCOUNTLESS_START_URL = "accountless"
91-
const val FEATURE_CONFIG_POLL_INTERVAL_IN_MS: Long = 30 * 60 * 1000L // 30 mins
91+
const val FEATURE_CONFIG_POLL_INTERVAL_IN_MS: Long = 180 * 60 * 1000L // 180 mins
9292
const val USING: String = "using"
9393
const val GLOBAL_USING: String = "global using"
9494
const val STATIC: String = "static"

plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/util/GitIgnoreFilteringUtil.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ class GitIgnoreFilteringUtil(
6060
"*.csv",
6161
"*.dylib",
6262
"*.parquet",
63-
"*.xlsx"
63+
"*.xlsx",
64+
"*.tar.gz",
65+
"*.tar",
66+
"*.pack",
67+
"*.pkg",
68+
"*.pkl",
69+
"*.deb",
70+
"*.model"
6471
)
6572
)
6673
}

plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererModelConfiguratorTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class CodeWhispererModelConfiguratorTest {
421421
)
422422
)
423423

424-
this.serviceDefaultArn = "arn:aws:codewhisperer:default"
424+
this.customizationArnOverrideV2 = "arn:aws:codewhisperer:default"
425425
}
426426

427427
XmlSerializer.serializeInto(state, element)
@@ -441,6 +441,7 @@ class CodeWhispererModelConfiguratorTest {
441441
"</entry>" +
442442
"</map>" +
443443
"</option>" +
444+
"<option name=\"customizationArnOverrideV2\" value=\"arn:aws:codewhisperer:default\" />" +
444445
"<option name=\"previousAvailableCustomizations\">" +
445446
"<map>" +
446447
"<entry key=\"fake-sso-url\">" +
@@ -453,7 +454,6 @@ class CodeWhispererModelConfiguratorTest {
453454
"</entry>" +
454455
"</map>" +
455456
"</option>" +
456-
"<option name=\"serviceDefaultArn\" value=\"arn:aws:codewhisperer:default\" />" +
457457
"</component>"
458458

459459
assertThat(actual).isEqualTo(expected)
@@ -470,7 +470,7 @@ class CodeWhispererModelConfiguratorTest {
470470
val actual = XmlSerializer.deserialize(element, CodeWhispererCustomizationState::class.java)
471471
assertThat(actual.connectionIdToActiveCustomizationArn).hasSize(0)
472472
assertThat(actual.previousAvailableCustomizations).hasSize(0)
473-
assertThat(actual.serviceDefaultArn).isNull()
473+
assertThat(actual.customizationArnOverrideV2).isNull()
474474
}
475475

476476
@Test
@@ -504,12 +504,12 @@ class CodeWhispererModelConfiguratorTest {
504504
</entry>
505505
</map>
506506
</option>
507-
<option name="serviceDefaultArn" value="arn:aws:codewhisperer:default"/>
507+
<option name="customizationArnOverrideV2" value="arn:aws:codewhisperer:default"/>
508508
</component>
509509
"""
510510
)
511511
val actual = XmlSerializer.deserialize(element, CodeWhispererCustomizationState::class.java)
512-
assertThat(actual.serviceDefaultArn).isEqualTo("arn:aws:codewhisperer:default")
512+
assertThat(actual.customizationArnOverrideV2).isEqualTo("arn:aws:codewhisperer:default")
513513
assertThat(actual.connectionIdToActiveCustomizationArn).hasSize(1)
514514
assertThat(actual.connectionIdToActiveCustomizationArn["fake-sso-url"]).isEqualTo(
515515
CodeWhispererCustomization(
@@ -546,7 +546,7 @@ class CodeWhispererModelConfiguratorTest {
546546
)
547547
val actual = XmlSerializer.deserialize(element, CodeWhispererCustomizationState::class.java)
548548
assertThat(actual.connectionIdToActiveCustomizationArn).hasSize(0)
549-
assertThat(actual.serviceDefaultArn).isNull()
549+
assertThat(actual.customizationArnOverrideV2).isNull()
550550
assertThat(actual.previousAvailableCustomizations).hasSize(1)
551551
assertThat(actual.previousAvailableCustomizations["fake-sso-url"]).isEqualTo(listOf("arn_1", "arn_2", "arn_3"))
552552
}

0 commit comments

Comments
 (0)