Skip to content

Commit 1234c76

Browse files
authored
Merge branch 'main' into feature/stop-generation
2 parents c38c01a + 0c30f6e commit 1234c76

File tree

8 files changed

+51
-45
lines changed

8 files changed

+51
-45
lines changed

.changes/3.34.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"date" : "2024-10-22",
3+
"version" : "3.34",
4+
"entries" : [ {
5+
"type" : "bugfix",
6+
"description" : "Fix issue where the plugin can't read SSO tokens from disk / always returns 'Unable to load client registration'"
7+
} ]
8+
}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# _3.34_ (2024-10-22)
2+
- **(Bug Fix)** Fix issue where the plugin can't read SSO tokens from disk / always returns 'Unable to load client registration'
3+
14
# _3.33_ (2024-10-17)
25
- **(Feature)** Add support for 2024.3
36
- **(Bug Fix)** `@workspace` cannot properly locate certain folders for certain project setup

buildSrc/src/main/kotlin/toolkit-intellij-subplugin.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ configurations {
3535
// IDE provides Kotlin
3636
exclude(group = "org.jetbrains.kotlin")
3737
exclude(group = "org.jetbrains.kotlinx")
38-
39-
exclude(group = "com.fasterxml.jackson.core")
40-
exclude(group = "com.fasterxml.jackson.module", "jackson-module-kotlin")
41-
exclude(group = "com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml")
4238
}
4339

4440
configureEach {

buildSrc/src/main/kotlin/toolkit-publish-root-conventions.gradle.kts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tasks.withType<PatchPluginXmlTask>().configureEach {
2020
intellijPlatform {
2121
instrumentCode = false
2222

23-
verifyPlugin {
23+
pluginVerification {
2424
ides {
2525
// recommended() appears to resolve latest EAP for a product?
2626
ide(provider { IntelliJPlatformType.IntellijIdeaCommunity }, toolkitIntelliJ.version())
@@ -65,14 +65,6 @@ dependencies {
6565
}
6666
}
6767

68-
configurations {
69-
runtimeClasspath {
70-
exclude(group = "com.fasterxml.jackson.core")
71-
exclude(group = "com.fasterxml.jackson.module", "jackson-module-kotlin")
72-
exclude(group = "com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml")
73-
}
74-
}
75-
7668
tasks.runIde {
7769
systemProperty("aws.toolkit.developerMode", true)
7870
systemProperty("ide.plugins.snapshot.on.unload.fail", true)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Toolkit Version
5-
toolkitVersion=3.34-SNAPSHOT
5+
toolkitVersion=3.35-SNAPSHOT
66

77
# Publish Settings
88
publishToken=

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

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import software.aws.toolkits.jetbrains.services.amazonq.project.ProjectContextCo
1919
import software.aws.toolkits.jetbrains.services.amazonq.toolwindow.AmazonQToolWindow
2020
import software.aws.toolkits.jetbrains.services.amazonq.toolwindow.AmazonQToolWindowFactory
2121
import software.aws.toolkits.jetbrains.services.codewhisperer.explorer.CodeWhispererExplorerActionManager
22-
import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
2322
import java.lang.management.ManagementFactory
2423
import java.time.Duration
2524
import java.util.concurrent.atomic.AtomicBoolean
@@ -50,26 +49,24 @@ class AmazonQStartupActivity : ProjectActivity {
5049
// Automatically start the project context LSP after some delay when average CPU load is below 30%.
5150
// The CPU load requirement is to avoid competing with native JetBrains indexing and other CPU expensive OS processes
5251
// In the future we will decouple LSP start and indexing start to let LSP perform other tasks.
53-
if (CodeWhispererSettings.getInstance().isProjectContextEnabled()) {
54-
val startLspIndexingDuration = Duration.ofMinutes(30)
55-
project.waitForSmartMode()
56-
try {
57-
withTimeout(startLspIndexingDuration) {
58-
while (true) {
59-
val cpuUsage = ManagementFactory.getOperatingSystemMXBean().systemLoadAverage
60-
if (cpuUsage > 0 && cpuUsage < 30) {
61-
ProjectContextController.getInstance(project = project)
62-
break
63-
} else {
64-
delay(60_000) // Wait for 60 seconds
65-
}
52+
val startLspIndexingDuration = Duration.ofMinutes(30)
53+
project.waitForSmartMode()
54+
try {
55+
withTimeout(startLspIndexingDuration) {
56+
while (true) {
57+
val cpuUsage = ManagementFactory.getOperatingSystemMXBean().systemLoadAverage
58+
if (cpuUsage > 0 && cpuUsage < 30) {
59+
ProjectContextController.getInstance(project = project)
60+
break
61+
} else {
62+
delay(60_000) // Wait for 60 seconds
6663
}
6764
}
68-
} catch (e: TimeoutCancellationException) {
69-
LOG.warn { "Failed to start LSP server due to time out" }
70-
} catch (e: Exception) {
71-
LOG.warn { "Failed to start LSP server" }
7265
}
66+
} catch (e: TimeoutCancellationException) {
67+
LOG.warn { "Failed to start LSP server due to time out" }
68+
} catch (e: Exception) {
69+
LOG.warn { "Failed to start LSP server" }
7370
}
7471
}
7572

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ class CodeWhispererFeatureConfigService {
108108

109109
fun getNewAutoTriggerUX(): Boolean = getFeatureValueForKey(NEW_AUTO_TRIGGER_UX).stringValue() == "TREATMENT"
110110

111+
@Suppress("UNUSED")
112+
fun getInlineCompletion(): Boolean = getFeatureValueForKey(INLINE_COMPLETION).stringValue() == "TREATMENT"
113+
111114
// Get the feature value for the given key.
112115
// In case of a misconfiguration, it will return a default feature value of Boolean false.
113116
private fun getFeatureValueForKey(name: String): FeatureValue =
@@ -117,6 +120,7 @@ class CodeWhispererFeatureConfigService {
117120
companion object {
118121
fun getInstance(): CodeWhispererFeatureConfigService = service()
119122
private const val TEST_FEATURE_NAME = "testFeature"
123+
private const val INLINE_COMPLETION = "ProjectContextV2"
120124
private const val DATA_COLLECTION_FEATURE = "IDEProjectContextDataCollection"
121125
const val CUSTOMIZATION_ARN_OVERRIDE_NAME = "customizationArnOverride"
122126
private const val NEW_AUTO_TRIGGER_UX = "newAutoTriggerUX"
@@ -141,6 +145,11 @@ class CodeWhispererFeatureConfigService {
141145
"CONTROL",
142146
FeatureValue.builder().stringValue("CONTROL").build()
143147
),
148+
INLINE_COMPLETION to FeatureContext(
149+
INLINE_COMPLETION,
150+
"CONTROL",
151+
FeatureValue.builder().stringValue("CONTROL").build()
152+
)
144153
)
145154
}
146155
}

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,17 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
3838
private val retryCount = AtomicInteger(0)
3939
val isIndexComplete = AtomicBoolean(false)
4040
private val mapper = jacksonObjectMapper()
41+
4142
init {
4243
cs.launch {
43-
if (CodeWhispererSettings.getInstance().isProjectContextEnabled()) {
44-
while (true) {
45-
if (encoderServer.isNodeProcessRunning()) {
46-
// TODO: need better solution for this
47-
delay(10000)
48-
initAndIndex()
49-
break
50-
} else {
51-
yield()
52-
}
44+
while (true) {
45+
if (encoderServer.isNodeProcessRunning()) {
46+
// TODO: need better solution for this
47+
delay(10000)
48+
initAndIndex()
49+
break
50+
} else {
51+
yield()
5352
}
5453
}
5554
}
@@ -102,9 +101,11 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
102101
if (isInitSuccess) {
103102
logger.info { "project context index starting" }
104103
delay(300)
105-
val isIndexSuccess = index()
106-
if (isIndexSuccess) isIndexComplete.set(true)
107-
return@launch
104+
if (CodeWhispererSettings.getInstance().isProjectContextEnabled()) {
105+
val isIndexSuccess = index()
106+
if (isIndexSuccess) isIndexComplete.set(true)
107+
return@launch
108+
}
108109
}
109110
} catch (e: Exception) {
110111
if (e.stackTraceToString().contains("Connection refused")) {

0 commit comments

Comments
 (0)