Skip to content
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): Add language server support for codewhisperer #6462

Open
wants to merge 158 commits into
base: master
Choose a base branch
from

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.
aws-toolkit-automation and others added 30 commits January 31, 2025 21:32
…#6385)

## Problem
LSP downloading processes does not emit any telemetry. 

## Solution

### Refactoring
- separate verification from core downloading steps so that we can
capture it as its own telemetry event.
- Note: this refactor means that if all the downloaded content cannot be
verified, no files will be written to disk.
- Introduce abstraction of `StageResolver` to make telemetry
instrumentation more natural.

### Metric Behavior
- metric for each stage of the LSP setup process.
- can be emitted multiple times per stage to capture specific error
codes. See tests for examples.
- Commons repo PR: aws/aws-toolkit-common#961
- bumped commons version to
[1.0.296](aws/aws-toolkit-common@8df7a87)
to include this change.

### Testing
- adds basic tests for `ManifestResolver` in
`packages/core/src/test/shared/lsp/manifestResolver.test.ts`.
- adds basic tests for `LanguageServerResolver` in
`packages/core/src/test/shared/lsp/lspResolver.test.ts`.
- Currently `LanguageServerResolver` only supports mac, so its tests
skip on non-mac platforms. There is a techdebt test to address this.

## Future Work
- Update logging messages to be LSP specific. 

---

- 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
Amazon q currently uses the 2.3.2 version of the language server which
doesn't appear to be working

## Solution
Update to the 3.x.x series for now

Independently i'm going to follow up with teams to understand how this
happened. Had we released this feature to prod amazon q inline would
have been completely broken


---

- 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 leading `''` when not in debug mode made the process start but not
accept any events

## Solution
Only prepend the `inspect` args when required


---

- 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 can't consume prerelease versions from the gamma manifest

## Solution
Support pre release lsp versions + test

## Notes
- I'll have another PR soon that pulls out the configuration so we can
switch manifest urls for testing pretty easily
- E2E tests won't work until
#6538 is merged


---

- 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.
…6467)

## Problem
In the last few months we reduced the amount of output channels. This
includes having the workspace context language server log to the "Amazon
Q logs" output channel. However, the codewhisperer language server
always creates the "Amazon Q Language Server" output channel

## Solution
When the trace server is enabled ('amazonq.trace.server' in the vscode
settings), output to a seperate channel because its extremely noisy,
otherwise send the logs to the "Amazon Q Logs" output channel

---

- 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.
…ders. (#6526)

## Problem
The log messages coming out of the LSP work do not make it clear which
LSP its working with (Q Workspace or Q general).
Follow up from:
#6385 (comment)
## Solution
- Use new `LogTopic` functionality to scope these to specific LSP. 
- Add more logging information from LSP cleanup process. 

---

- 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
https://taskei.amazon.dev/tasks/IDE-15760
Users want to know that language servers are downloading


## Solution
Add a toast notification message with progress bar when LSP is
downloading
Also added a developer command to reset LSP download for testing, and a
"setup completed" log when downloaded.

---
Short demo:


https://github.com/user-attachments/assets/784f93a2-66e0-45b6-80dc-226247667a7b



---


- 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.

---------

Co-authored-by: tomzu <[email protected]>
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.

4 participants