Skip to content

Commit 973b710

Browse files
committed
Addressing code review comments
1 parent b0e9648 commit 973b710

File tree

4 files changed

+25
-33
lines changed

4 files changed

+25
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package software.aws.toolkits.jetbrains.services.amazonq.lsp.artifacts
5+
6+
import com.intellij.openapi.util.SystemInfo
7+
import java.nio.file.Path
8+
import java.nio.file.Paths
9+
10+
fun getToolkitsCommonCachePath(): Path {
11+
return when {
12+
SystemInfo.isWindows -> {
13+
Paths.get(System.getenv("APPDATA"))
14+
}
15+
SystemInfo.isMac -> {
16+
Paths.get(System.getProperty("user.home"), "Library", "Caches")
17+
}
18+
else -> {
19+
Paths.get(System.getProperty("user.home"), ".cache")
20+
}
21+
}
22+
}

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/artifacts/ManifestFetcher.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package software.aws.toolkits.jetbrains.services.amazonq.lsp.artifacts
55

66
import com.intellij.openapi.util.text.StringUtil
77
import com.intellij.util.io.DigestUtil
8-
import software.amazon.awssdk.utils.UserHomeDirectoryUtils
98
import software.aws.toolkits.core.utils.exists
109
import software.aws.toolkits.core.utils.getLogger
1110
import software.aws.toolkits.core.utils.readText
@@ -14,13 +13,13 @@ import software.aws.toolkits.jetbrains.core.getTextFromUrl
1413
import software.aws.toolkits.jetbrains.core.saveFileFromUrl
1514
import software.aws.toolkits.jetbrains.services.amazonq.project.manifest.ManifestManager
1615
import java.nio.file.Path
17-
import java.nio.file.Paths
1816

1917
class ManifestFetcher {
2018

2119
private val lspManifestUrl = "https://aws-toolkit-language-servers.amazonaws.com/codewhisperer/0/manifest.json"
2220
private val manifestManager = ManifestManager()
23-
private val lspManifestFilePath: Path = Paths.get(UserHomeDirectoryUtils.userHomeDirectory(), ".aws", "amazonq", "cache", "lspManifest.js")
21+
private val lspManifestFilePath: Path = getToolkitsCommonCachePath().resolve("aws").resolve("toolkits").resolve("language-servers")
22+
.resolve("lsp-manifest.json")
2423

2524
companion object {
2625
private val logger = getLogger<ManifestFetcher>()

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,11 @@ class ManifestManager {
4040
val contents: List<TargetContent>? = emptyList(),
4141
)
4242

43-
data class Runtime(
44-
@JsonProperty("name")
45-
val name: String? = null,
46-
@JsonProperty("version")
47-
val version: String? = null,
48-
)
49-
50-
data class Capabilities(
51-
@JsonProperty("name")
52-
val name: String? = null,
53-
@JsonProperty("version")
54-
val version: String? = null,
55-
)
56-
57-
data class Protocol(
58-
@JsonProperty("name")
59-
val name: String? = null,
60-
@JsonProperty("version")
61-
val version: String? = null,
62-
)
63-
6443
data class Version(
6544
@JsonProperty("serverVersion")
6645
val serverVersion: String? = null,
6746
@JsonProperty("isDelisted")
6847
val isDelisted: Boolean? = null,
69-
@JsonProperty("runtime")
70-
val runtime: Runtime? = null,
71-
@JsonProperty("capabilities")
72-
val capabilities: List<Capabilities>? = emptyList(),
73-
@JsonProperty("protocol")
74-
val protocol: List<Protocol>? = emptyList(),
75-
@JsonProperty("thirdPartyLicenses")
76-
val thirdPartyLicenses: String? = null,
7748
@JsonProperty("targets")
7849
val targets: List<VersionTarget>? = emptyList(),
7950
)

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/HttpUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fun writeJsonToUrl(url: String, jsonString: String, indicator: ProgressIndicator
2727

2828
fun getETagFromUrl(url: String): String =
2929
HttpRequests.head(url)
30-
.userAgent("AWS Toolkit for JetBrains")
30+
.userAgent(AwsClientManager.getUserAgent())
3131
.connect { request ->
3232
request.connection.headerFields["ETag"]?.firstOrNull().orEmpty()
3333
}

0 commit comments

Comments
 (0)