Skip to content

feat(amazonQ): LSP -- Implement Initialize message #5367

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 10 commits into from
Feb 13, 2025

Conversation

samgst-amazon
Copy link
Contributor

Creates the initialization parameters for the Amazon Q LSP connection

Types of changes

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

Description

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

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.

@samgst-amazon samgst-amazon changed the title Samgst/q lsp initialize feat(Q): LSP -- Implement Initialize message Feb 12, 2025
Comment on lines 136 to 150
val metadata = ClientMetadata.getDefault()
return mapOf(
"aws" to mapOf(
"clientInfo" to mapOf(
"extension" to mapOf(
"name" to metadata.awsProduct.toString(),
"version" to metadata.awsVersion
),
"clientId" to metadata.clientId,
"version" to metadata.parentProductVersion,
"name" to metadata.parentProduct
)
)
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we model this as a data class instead of a free form map

}

private fun createWorkspaceFolders(): List<WorkspaceFolder> {
return project.basePath?.let { basePath ->
Copy link
Contributor

Choose a reason for hiding this comment

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

add a note to handle the case where this is null

Copy link

github-actions bot commented Feb 12, 2025

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 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

@samgst-amazon samgst-amazon changed the title feat(Q): LSP -- Implement Initialize message feat(amazonQ): LSP -- Implement Initialize message Feb 12, 2025
@samgst-amazon samgst-amazon marked this pull request as ready for review February 12, 2025 19:33
@samgst-amazon samgst-amazon requested a review from a team as a code owner February 12, 2025 19:33
// workspace folders?
// anything else we need?
val initializeResult = try {
withTimeout(Duration.ofSeconds(30)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

where does this 30 come from?

Copy link
Contributor Author

@samgst-amazon samgst-amazon Feb 12, 2025

Choose a reason for hiding this comment

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

arbitrary -- saw your //comment about having a timeout and thought we should have something

can change to retry with backoff pattern or something else, just wasn't sure what was appropriate here.

Copy link
Contributor

Choose a reason for hiding this comment

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

5-10s is probably good enough. if it doesn't spin up quickly we should kill server and retry, then fail after some # of attempts. can you log that as a separate task on the board?

@rli rli merged commit 013c54f into feature/q-lsp Feb 13, 2025
2 of 10 checks passed
@rli rli deleted the samgst/q-lsp-initialize branch February 13, 2025 00:17
leigaol pushed a commit to leigaol/aws-toolkit-jetbrains that referenced this pull request Mar 20, 2025
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
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.

2 participants