-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(amazonq): Implement aws/syncModuleDependencies call #5414
feat(amazonq): Implement aws/syncModuleDependencies call #5414
Conversation
Qodana Community for JVM7 new problems were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...olkits/jetbrains/services/amazonq/lsp/model/aws/dependencies/SyncModuleDependenciesParams.kt
Fixed
Show fixed
Hide fixed
package software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.dependencies | ||
|
||
public class SyncModuleDependenciesParams( | ||
val moduleName: String, |
Check warning
Code scanning / QDJVMC
Unused symbol Warning
val moduleName: String, | ||
val programmingLanguage: String, | ||
val files: List<String>, | ||
val dirs: List<String>, |
Check warning
Code scanning / QDJVMC
Unused symbol Warning
val programmingLanguage: String, | ||
val files: List<String>, | ||
val dirs: List<String>, | ||
val includePatterns: List<String>, |
Check warning
Code scanning / QDJVMC
Unused symbol Warning
val files: List<String>, | ||
val dirs: List<String>, | ||
val includePatterns: List<String>, | ||
val excludePatterns: List<String>, |
Check warning
Code scanning / QDJVMC
Unused symbol Warning
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
import com.jetbrains.python.packaging.management.PythonPackageManager | ||
import com.jetbrains.python.sdk.PythonSdkUtil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this service we should define a generic interface that is registered with the extension point system and register them dynamically through optional depends. otherwise this will all fail if user is missing the java/python plugin
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...olkits/jetbrains/services/amazonq/lsp/dependencies/providers/JavaModuleDependencyProvider.kt
Fixed
Show fixed
Hide fixed
...kits/jetbrains/services/amazonq/lsp/dependencies/providers/PythonModuleDependencyProvider.kt
Fixed
Show fixed
Hide fixed
val dependencies = mutableListOf<String>() | ||
|
||
PythonSdkUtil.findPythonSdk(module)?.let { sdk -> | ||
val packageManager = PythonPackageManager.forSdk(module.project, sdk) |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
val dependencies = mutableListOf<String>() | ||
|
||
PythonSdkUtil.findPythonSdk(module)?.let { sdk -> | ||
val packageManager = PythonPackageManager.forSdk(module.project, sdk) |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
|
||
PythonSdkUtil.findPythonSdk(module)?.let { sdk -> | ||
val packageManager = PythonPackageManager.forSdk(module.project, sdk) | ||
packageManager.installedPackages.forEach { pkg -> |
Check warning
Code scanning / QDJVMC
Unstable API Usage Warning
...mmunity/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/util/ExtensionPointUtils.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...aws/toolkits/jetbrains/services/amazonq/lsp/dependencies/DefaultModuleDependenciesService.kt
Fixed
Show fixed
Hide fixed
...ains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt
Fixed
Show fixed
Hide fixed
...ains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt
Fixed
Show fixed
Hide fixed
...ains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt
Fixed
Show fixed
Hide fixed
<depends optional="true" config-file="java-support.xml">com.intellij.modules.java</depends> | ||
<depends optional="true" config-file="python-support.xml">com.intellij.modules.python</depends> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends should be on top-level plugin.xml, so use existing amazon-ext-java.xml
CompletableFuture<Unit>().also { completableFuture -> | ||
AmazonQLspService.executeIfRunning(project) { languageServer -> | ||
languageServer.syncModuleDependencies(params) | ||
completableFuture.complete(null) | ||
} ?: completableFuture.completeExceptionally(IllegalStateException("LSP Server not running")) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplifies to
CompletableFuture<Unit>().also { completableFuture -> | |
AmazonQLspService.executeIfRunning(project) { languageServer -> | |
languageServer.syncModuleDependencies(params) | |
completableFuture.complete(null) | |
} ?: completableFuture.completeExceptionally(IllegalStateException("LSP Server not running")) | |
} | |
AmazonQLspService.executeIfRunning(project) { languageServer -> | |
languageServer.syncModuleDependencies(params) | |
}?.toCompletableFuture() ?: CompletableFuture.failedFuture(IllegalStateException("LSP Server not running")) |
import java.util.concurrent.CompletableFuture | ||
|
||
/** | ||
* Remote interface exposed by the Amazon Q language server | ||
*/ | ||
@Suppress("unused") | ||
interface AmazonQLanguageServer : LanguageServer { | ||
@JsonRequest("aws/syncModuleDependencies") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you see if @JsonNotification
works
Implement the bare structure of the syncModuleDependencies service to make the call from the client to the server
Types of changes
Description
added interface for the service handler as well as the data class for the params.
aws/syncModuleDependencies added to AmazonQLanguageServer interface to handle sending the JSONRequests
Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.