Skip to content

feat(lsp): Addition of LSP for Amazon Q #5593

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

Merged
merged 166 commits into from
Apr 18, 2025
Merged

feat(lsp): Addition of LSP for Amazon Q #5593

merged 166 commits into from
Apr 18, 2025

Conversation

manodnyab
Copy link
Contributor

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

aws-toolkit-automation and others added 30 commits February 10, 2025 22:22
This is the initial iteration of the bare minimum of process management to interact with Amazon Q logic vended by Flare.
It is a direct port of the exploratory work done in https://github.com/rli/lsp-exp/tree/master/src/main/kotlin/org/example/lsp4j

Missing are tests and any sort of edge case handling
Initialize message is the first request sent from the client and sets up the LSP session configuration for subsequent communications.
Includes:

    Process ID for server management
    Client capabilities for LSP features
    Client information (IDE/product details)
    Workspace folders for project context
    Extended client metadata specific to Amazon Q

***needs tests, not currently working
@manodnyab manodnyab requested review from a team as code owners April 17, 2025 05:04
Copy link

github-actions bot commented Apr 17, 2025

Qodana Community for JVM

19 new problems were found

Inspection name Severity Problems
Unused symbol 🔶 Warning 7
Usage of redundant or deprecated syntax or deprecated symbols 🔶 Warning 6
Unstable API Usage 🔶 Warning 4
Constructor parameter is never used as a property 🔶 Warning 1
Function or property has platform type ◽️ Notice 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

val fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFileDescriptor()
fileChooserDescriptor.isForcedToUseIdeaFileChooser = true

textFieldWithBrowseButton(fileChooserDescriptor = fileChooserDescriptor)

Check warning

Code scanning / QDJVMC

Unstable API Usage Warning

'textFieldWithBrowseButton(com.intellij.openapi.fileChooser.FileChooserDescriptor, com.intellij.openapi.project.Project, kotlin.jvm.functions.Function1)' is marked unstable with @ApiStatus.Experimental
@@ -116,6 +138,20 @@
}

group(message("aws.settings.codewhisperer.group.q_chat")) {
row {
checkBox(message("aws.settings.codewhisperer.workspace_context")).apply {

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
@Service(Service.Level.PROJECT)
class AmazonQLspService(private val project: Project, private val cs: CoroutineScope) : Disposable {
private var instance: Deferred<AmazonQServerInstance>
val capabilities

Check notice

Code scanning / QDJVMC

Function or property has platform type Note

Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable.
@Service(Service.Level.PROJECT)
class AmazonQLspService(private val project: Project, private val cs: CoroutineScope) : Disposable {
private var instance: Deferred<AmazonQServerInstance>
val capabilities

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Property "capabilities" is never used
override fun dispose() {
}

suspend fun restart() = mutex.withLock {

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Function "restart" is never used
PythonSdkUtil.findPythonSdk(module)?.let { sdk ->
PythonSdkUtil.getSitePackagesDirectory(sdk)?.let { sitePackagesDir ->
val packageManager = PythonPackageManager.forSdk(module.project, sdk)
packageManager.installedPackages.forEach { pkg ->

Check warning

Code scanning / QDJVMC

Unstable API Usage Warning

'getInstalledPackages()' is declared in unstable 'com.jetbrains.python.packaging.management.PythonPackageManager' marked with @ApiStatus.Experimental
package software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.dependencies

class DidChangeDependencyPathsParams(
val moduleName: String,

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Property "moduleName" is never used

class DidChangeDependencyPathsParams(
val moduleName: String,
val runtimeLanguage: String,

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Property "runtimeLanguage" is never used
val moduleName: String,
val runtimeLanguage: String,
val paths: List<String>,
val includePatterns: List<String>,

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Property "includePatterns" is never used
val runtimeLanguage: String,
val paths: List<String>,
val includePatterns: List<String>,
val excludePatterns: List<String>,

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Property "excludePatterns" is never used
Copy link
Contributor

@rli rli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a merge (not squash) to avoid conflicts in outstanding nested features / PRs

Comment on lines 25 to 29
// FIX_WHEN_MIN_IS_242
if (providers.gradleProperty("ideProfileName").get() == "2024.1") {
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:0.24.0")
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// FIX_WHEN_MIN_IS_242
if (providers.gradleProperty("ideProfileName").get() == "2024.1") {
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:0.24.0")
}

Comment on lines +26 to +32
override fun telemetryEvent(`object`: Any) {
println(`object`)
}

override fun publishDiagnostics(diagnostics: PublishDiagnosticsParams) {
println(diagnostics)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

MessageType.Warning -> NotificationType.WARNING
MessageType.Info, MessageType.Log -> NotificationType.INFORMATION
}
println("$type: ${messageParams.message}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger

}

override fun showMessageRequest(requestParams: ShowMessageRequestParams): CompletableFuture<MessageActionItem?>? {
println(requestParams)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
println(requestParams)

@rli
Copy link
Contributor

rli commented Apr 17, 2025

/retryBuilds

manodnyab and others added 5 commits April 17, 2025 12:58
 Conflicts:
	plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/CodeWhispererSettingsTest.kt
return jweObject.serialize()
}

fun decrypt(jwt: String): String {

Check warning

Code scanning / QDJVMC

Unused symbol Warning

Function "decrypt" is never used
@manodnyab
Copy link
Contributor Author

/retryBuilds

@manodnyab manodnyab changed the title Addition of LSP for Amazon Q feat(lsp): Addition of LSP for Amazon Q Apr 18, 2025
@manodnyab manodnyab merged commit 85d78db into main Apr 18, 2025
20 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants