You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(amazonq): update lsp clientname to support sagemaker unified studio case (#7817)
## Problem
In order to set appropriate Origin Info on LSP side for SMUS CodeEditor,
[link](https://github.com/aws/language-servers/blob/68adf18d7ec46a7ecf9c66fd9d52b1b8f7bc236e/server/aws-lsp-codewhisperer/src/shared/utils.ts#L377),
clientInfo needs to be distinct and with current logic that uses
```vscode.env.appName``` whose value will be same for all sagemaker
codeeditor instances
- The original PR was reverted
[here](https://github.com/aws/aws-toolkit-vscode/pull/7813/commits) due
to failing unit tests
- Unit test failure was due to env variable ```SERVICE_NAME``` being
modified directly from test code causing failure in other tests which
identified the environment to be SMUS without clean isolation
- Fixed the test failure by using sinon stub instead of modifying env
vars in node process
## Solution
- To check if the environment is SageMaker and a Unified Studio instance
and set corresponding clientInfo Name which is ```AmazonQ-For-SMUS-CE```
## Testing
- Built artefact locally using ```npm run compile && npm run package```
and tested on a SMUS CE space
- Ran ```npm run test -w packages/toolkit``` which succeeded
- LSP logs are attached to show the respective client Info details
```
[Trace - 9:55:46 PM] Sending request 'initialize - (0)'.
Params: {
"processId": 6395,
"clientInfo": {
"name": "vscode",
"version": "1.90.1"
},
....
"initializationOptions": {
"aws": {
"clientInfo": {
"name": "AmazonQ-For-SMUS-CE",
"version": "1.90.1",
"extension": {
"name": "AmazonQ-For-VSCode",
.....
```
- Tested the debug artefact in SMUS and SMAI spaces
As observed below, the sign out was only disabled for SMUS case
initially with
[this](https://github.com/parameja1/aws-toolkit-vscode/blob/f5fa7989be44238d4d27b8c9e7fed967c05bc0e9/packages/core/src/codewhisperer/ui/statusBarMenu.ts#L96)
change, a
[CR](f5cf3bd)
followed up which overrode the logic in isSageMaker and returned true
for all cases irrespective of the appName passed
SMUS
------
<img width="720" height="383" alt="image"
src="https://github.com/user-attachments/assets/49504777-0922-49b8-942a-12efacfd4311"
/>
SMAI
-----
<img width="720" height="383" alt="image"
src="https://github.com/user-attachments/assets/e50c30df-f275-4f7b-bff0-11177a7fed0a"
/>
- Observing Q sendMessage failure in SMAI CE instance due to missing
permissions, again unrelated to this change
---
- 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: Laxman Reddy <[email protected]>
0 commit comments