Skip to content

feat(amazonq): Add language server support for codewhisperer #6462

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 247 commits into from
Mar 21, 2025

Conversation

jpinkney-aws
Copy link
Contributor

@jpinkney-aws jpinkney-aws commented Jan 29, 2025

Problem

  • Amazon q completions currently use a custom implementation. Instead, we can leverage the codewhisperer implementation in the language-servers repository to provide this information for us

Solution

  • Implement manifest downloading, lsp resolution
  • Decouple inline completion activation from codewhisperer activation
  • Port workspace context language server to use the lsp installer

TODOs before this is merged

Risks

  • Inline completion activation has been decoupled from other codewhisperer activation, we need to make sure everything is still getting activated and in the right order
  • workspace context language server now uses the manifest downloading code

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • 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 December 4, 2024 19:09
…6142)

## Problem
We want to experiment with the amazon q language server

## Solution
Set up the structure for the eventual amazon q language srever
## Problem
- we need a way to download the manifest and install the correct mynah
ui/language server code

## Solution
- create a common lsp downloader that flare/workspace lsps can use
## Problem
- vscode doesn't have the codewhisperer lsp for completion requests

## Solution
- use the codewhisperer lsp when `"aws.experiments": {
    "amazonqLSP": true
  },`

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
jpinkney-aws and others added 8 commits March 13, 2025 10:42
…ing (#6775)

## Problem
- missing diagrams for how the chat activation flow will work in flare
- missing diagrams for how e2e test should work in flare

## Solution
- add missing diagrams
- remove lsp debugging in favour of general lsp documentation



---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem
- we have tests for the amazon q lsp installer but not the workspace
context lsp installer

## Solution
- add tests for the workspace context lsp installer
- add a test for language server activation

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
…minutes (#6793)

## Problem
- When the bearer token updates in the background we never re-notify the
language server

## Solution
- update it every 5 minutes as a hack to unblock the pentest


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
Copy link
Contributor

@justinmk3 justinmk3 Mar 18, 2025

Choose a reason for hiding this comment

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

Everything in lsp/utils/ could be moved up into lsp/. Is the nesting communicating a meaningful grouping?

@@ -267,6 +273,17 @@ export async function waitUntil<T>(fn: () => Promise<T>, options: WaitUntilOptio
let elapsed: number = 0
let remaining = opt.timeout

// Internal helper to determine if we should retry
function shouldRetry(error: Error | undefined): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

oh, #6762 wasn't merged yet...

jpinkney-aws and others added 8 commits March 19, 2025 08:20
…s via Amazon Q Language Server (#6800)

## Problem
- Missing changelog

## Solution
- Add it before releasing


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
…6808)

## Problem
If you have a `.DS_STORE` file in the same directory of the language
server cache versions your language server will crash

## Solution
Only look for valid semver versions when cleaning up your cache

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
…e Server (#6811)

## Problem
When running multiple VSCode windows on mac arm64, Amazon Q's language
server works correctly in the first window but crashes in additional
windows with the error: `EXC_CRASH (SIGKILL (Code Signature Invalid))`

## Root Cause
The crash occurs because:
- The first VSCode window starts the language server and extracts
everything (including the node binary from flare)
- When additional VSCode windows are opened, they attempt to re-extract
the zip from flare, overriding the current contents
- On mac arm64, overwriting the node binary while it's in use by the
first VSCode window can apparently cause code signing validation to fail
for the next callers of it
- This didn't effect windows when I was playing around with it yesterday
- Weirdly enough, if you start the language server outside of VSCode,
unzip servers.zip again, and then spawn a new language server it doesn't
seem to have an issue. My guess is there's some weird interplay with
electron owning the spawning of the processes

## Solution
Instead of forcefully overriding contents in flare, only copy over the
file if its necessary

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem
- We removed chat a while ago from the `feature/amazonqLSP` branch
because we were just starting with inline suggestions

## Solution
- Now that we're moving to use chat we can re-add it
- Implement explain, refactor, fix, optimize, sendToPrompt, openTab
- Add a feature flag for enabling/disabling chat
- **note**: amazonqLSP and amazonqChatLSP must be enabled in order for
chat support to work
- extended the baseinstaller so that individual lsps installers can
provider their own resource paths

## Notes
- this is the equivalent of
https://github.com/aws/language-servers/blob/55253ea258b2d34bcc47b93e9998b1e9898e8f2a/client/vscode/src/chatActivation.ts
but integrated with our codebase
- since commands require the webview we pass in the view provider to all
commands so we can lazy evaluate the webview when required
- certain message listeners are only registered _after_ the UI is
resolved

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem
The inline completion document selectors between vscode's currently
implementation and the new implementation aren't aligned

## Solution
Rather than providing our own implementation that was originally stolen
from
[here](https://github.com/aws/language-servers/blob/main/client/vscode/src/inlineCompletionActivation.ts#L22)
and expanding it, we should just use the exact document selectors that
vscode already uses from
[here](https://github.com/aws/aws-toolkit-vscode/blob/master/packages/core/src/codewhisperer/models/constants.ts#L104)

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
@jpinkney-aws jpinkney-aws merged commit b048f97 into master Mar 21, 2025
31 of 34 checks passed
@jpinkney-aws jpinkney-aws deleted the feature/amazonqLSP branch March 21, 2025 21:37
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.

7 participants