Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
b7c54b8
Merge staging into feature/q-region-expansion
aws-toolkit-automation Feb 26, 2025
41d8c50
Merge staging into feature/q-region-expansion
aws-toolkit-automation Feb 26, 2025
65249d7
Merge staging into feature/q-region-expansion
aws-toolkit-automation Feb 28, 2025
44b4b09
Merge staging into feature/q-region-expansion
aws-toolkit-automation Feb 28, 2025
2815cfb
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 3, 2025
d08719b
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 3, 2025
46ca763
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 4, 2025
14a48dd
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 4, 2025
dab35c6
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 4, 2025
fedbe0c
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 4, 2025
76014cd
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 4, 2025
ab73ae7
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 4, 2025
342a011
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 4, 2025
5b37de6
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 4, 2025
137d487
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 5, 2025
d781df5
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 5, 2025
5c696de
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 5, 2025
09791c0
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 5, 2025
3c48903
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 5, 2025
7a33ae8
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 5, 2025
2c28d9d
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 5, 2025
5d1e181
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 6, 2025
8b763e7
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 6, 2025
0e5e65f
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 6, 2025
6966641
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 6, 2025
8a7ab55
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 6, 2025
355eb4a
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 6, 2025
aad92ca
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
e38e41a
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
2e12846
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
d9349a5
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
7a73e8e
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
d22b99e
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
f33e2bb
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
181ea5f
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
ee8c4ef
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 10, 2025
a670ff0
config(amazonq): update service sdk model (#2096)
Will-ShaoHua Mar 11, 2025
335d3ff
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 11, 2025
9cf0386
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 11, 2025
894161b
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 11, 2025
03412c2
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 11, 2025
b23e86b
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 11, 2025
02e20d9
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 11, 2025
fc98b47
feat(amazonq): region profile quickpick impl (#2098)
Will-ShaoHua Mar 14, 2025
88787d5
feat(amazonq): profile selection webview page (#2100)
Will-ShaoHua Mar 14, 2025
a70edb3
feat(amazonq): integrate profile selection flow with Chat, webview
Will-ShaoHua Mar 20, 2025
30d7142
feat(amazonq): chat panel region profile context menu item
Will-ShaoHua Mar 20, 2025
3eb9b78
feat(amazonq): profileManager implementation (#2102)
Will-ShaoHua Mar 21, 2025
ca4b4c9
Merge remote-tracking branch 'upstream-staging/feature/q-region-expan…
Will-ShaoHua Mar 21, 2025
230d5e2
Merge pull request #2097 from aws/autoMerge/feature/q-region-expansion
jpinkney-aws Mar 21, 2025
70ac56b
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 21, 2025
728f633
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 24, 2025
117f9c6
feat(amazonq): region expansion UX improvement (#2094)
Will-ShaoHua Mar 24, 2025
b014a43
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 25, 2025
696a87e
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 25, 2025
04b21b7
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 25, 2025
0b0578e
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 25, 2025
54268a0
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 25, 2025
2979a6f
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 25, 2025
197cf4b
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 25, 2025
fc0f8f2
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 25, 2025
217d11c
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 26, 2025
5b9819d
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 26, 2025
76f7235
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 26, 2025
87a5178
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 26, 2025
95c0022
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 27, 2025
488a97b
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 27, 2025
034a3e5
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 27, 2025
0c742e7
fix(amazonq): fit & finish / bugbash issues
Will-ShaoHua Mar 27, 2025
9b39743
feat(inline): send profile arn with inline APIs #2103
Will-ShaoHua Mar 27, 2025
50ea884
feat(generic chat): send profile arn with chat APIs #2104
Will-ShaoHua Mar 27, 2025
b98000a
feat(review): send profile arn with codeScan, testGen APIs
Will-ShaoHua Mar 27, 2025
16efde6
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 27, 2025
64b66e6
feat(transform): pass profile arn to transformation APIs
Will-ShaoHua Mar 27, 2025
0d7ec02
feat(feature-dev): pass profile arn to feature dev API
Will-ShaoHua Mar 27, 2025
940d76e
telemetry(amazonq): didSelectProfile
Will-ShaoHua Mar 27, 2025
c927295
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 28, 2025
9c257ed
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 28, 2025
77d066f
fix(amazonq): chat enablement isn't updated correctly on profile changed
Will-ShaoHua Mar 28, 2025
0d710f3
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 28, 2025
1726aeb
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 28, 2025
0d20307
Merge staging into feature/q-region-expansion
aws-toolkit-automation Mar 28, 2025
e0227a2
telemetry(amazonq): webview didLoadModule
Will-ShaoHua Mar 31, 2025
5f3d53b
feat(amazonq): disable Q context menu when profile selection is pendi…
Will-ShaoHua Apr 1, 2025
fdcc69a
feat(amazonq): clean up all sessions storage on profileChanged #2115
Will-ShaoHua Apr 1, 2025
d929a9c
config(amazonq): use external endpoints
Will-ShaoHua Apr 1, 2025
a42cc18
fix(amazonq): Q connectionState not correctly set
Will-ShaoHua Apr 7, 2025
9f1ab71
fix(amazonq): profile page styling
Will-ShaoHua Apr 7, 2025
bab1a70
fix(amazonq): make cross-validating async
Will-ShaoHua Apr 7, 2025
df8cb90
Merge remote-tracking branch 'upstream/feature/q-region-expansion' in…
Will-ShaoHua Apr 7, 2025
14c269a
retry ci
Will-ShaoHua Apr 7, 2025
c555f1c
Merge master into feature/q-region-expansion
justinmk3 Apr 7, 2025
b283ffc
changelog
Will-ShaoHua Apr 8, 2025
80cc6db
Merge 'public/master' into feature/q-region-expansion
justinmk3 Apr 8, 2025
9c5ee2f
fix(amazonq): profile arn not passed causing ResourceNotFound #2123
Will-ShaoHua Apr 8, 2025
20089a2
Merge staging into feature/q-region-expansion
justinmk3 Apr 8, 2025
eaa1a99
Merge staging into feature/q-region-expansion
aws-toolkit-automation Apr 8, 2025
73efc58
Merge staging into feature/q-region-expansion
aws-toolkit-automation Apr 8, 2025
f54ca73
Merge staging into feature/q-region-expansion
aws-toolkit-automation Apr 8, 2025
7a8d9aa
Release 3.54.0
Apr 9, 2025
f310286
Release 1.55.0
Apr 9, 2025
bec4f9e
Update version to snapshot version: 3.55.0-SNAPSHOT
Apr 9, 2025
76977ad
Update version to snapshot version: 1.56.0-SNAPSHOT
Apr 9, 2025
38e95a8
Merge release into master
Apr 9, 2025
8e00eef
fix(chat): Use shell icon in shell command header (#6974)
yueny2020 Apr 9, 2025
01ff102
fix(amazonq): confusing message during loading profiles
Will-ShaoHua Apr 9, 2025
46d475e
changelog
justinmk3 Apr 9, 2025
4ad3e92
fix(chat): change warning category and show the currect warning messa…
Randall-Jiang Apr 9, 2025
35ac939
fix(chat): Send back throttling error message
jguoamz Apr 9, 2025
1b81576
fix(chat): Improve diffView UX (#6981)
jguoamz Apr 9, 2025
529da80
fix(feat): add tooltip and set default mode to on (#6983)
Randall-Jiang Apr 9, 2025
e78b9a2
fix(amazonq): "failed to run command" #6982
justinmk3 Apr 9, 2025
dad80e5
fix(amazonq): confusing message during loading profiles
justinmk3 Apr 9, 2025
9a0a571
Release 1.56.0
Apr 9, 2025
c21be70
Update version to snapshot version: 1.57.0-SNAPSHOT
Apr 9, 2025
ca07d7f
Merge pull request #6984 from jguoamz/throttling
mr-lee Apr 9, 2025
d0a6bc1
fix(chat): disable prompt during loop (#6986)
ctlai95 Apr 10, 2025
6af0425
feat(amazon lsp): add copyToClipboard implementation (#6980)
opieter-aws Apr 10, 2025
9d382e5
fix(chat): handle JSON.parse error gracefully
jguoamz Apr 10, 2025
b6d4754
Merge pull request #6988 from jguoamz/jsonParse
mr-lee Apr 10, 2025
db64637
fix(amazonq): Grouping read tool messages under contextList (#6975)
laileni-aws Apr 10, 2025
b4f2428
fix(amazonq): /review returns 0 findings #6992
zuoyaofu Apr 10, 2025
1da77e7
fix(amazonq): /review "Generate fix" does not work #6993
zuoyaofu Apr 10, 2025
2857452
Release 1.57.0
Apr 10, 2025
f540496
Update version to snapshot version: 1.58.0-SNAPSHOT
Apr 10, 2025
ce3dd61
fix(amazonq): inline chat now activates independently of LSP chat #6973
Hweinstock Apr 10, 2025
c319671
Merge remote-tracking branch 'origin/master' into HEAD
Hweinstock Apr 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@vscode/test-electron": "^2.3.8",
"@vscode/test-web": "^0.0.65",
"@vscode/vsce": "^2.19.0",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-aws-toolkits": "file:plugins/eslint-plugin-aws-toolkits",
"eslint-plugin-header": "^3.1.1",
Expand Down
38 changes: 38 additions & 0 deletions packages/amazonq/.changes/1.55.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"date": "2025-04-09",
"version": "1.55.0",
"entries": [
{
"type": "Bug Fix",
"description": "Amazon Q Chat: Update chat history icon"
},
{
"type": "Bug Fix",
"description": "Amazon Q Chat: chat occasionally freezes and displays gray screen"
},
{
"type": "Bug Fix",
"description": "Amazon Q Chat: Set owner-only permissions for chat history and saved prompt files"
},
{
"type": "Feature",
"description": "`/test` generates tests in all languages, not only Java/Python"
},
{
"type": "Feature",
"description": "Amazon Q chat: Click export icon to save chat transcript in Markdown or HTML"
},
{
"type": "Feature",
"description": "SageMaker: Disable the unsupported agentic commands and welcome prompt"
},
{
"type": "Feature",
"description": "Amazon Q Chat: Add `@code` context for PHP, Ruby, Scala, Shell, and Swift projects"
},
{
"type": "Feature",
"description": "Enterprise users can choose their preferred Amazon Q profile to improve personalization and workflow across different business regions"
}
]
}
14 changes: 14 additions & 0 deletions packages/amazonq/.changes/1.56.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"date": "2025-04-09",
"version": "1.56.0",
"entries": [
{
"type": "Bug Fix",
"description": "Improve status message while loading Amazon Q Profiles during login"
},
{
"type": "Bug Fix",
"description": "\"failed to run command\" error"
}
]
}
14 changes: 14 additions & 0 deletions packages/amazonq/.changes/1.57.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"date": "2025-04-10",
"version": "1.57.0",
"entries": [
{
"type": "Bug Fix",
"description": "Fix bug where generate fix does not work"
},
{
"type": "Bug Fix",
"description": "Fix bug where review shows 0 findings"
}
]
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "inline chat activates properly when using 'aws.experiments.amazonqChatLSP' feature flag"
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 21 additions & 0 deletions packages/amazonq/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 1.57.0 2025-04-10

- **Bug Fix** Fix bug where generate fix does not work
- **Bug Fix** Fix bug where review shows 0 findings

## 1.56.0 2025-04-09

- **Bug Fix** Improve status message while loading Amazon Q Profiles during login
- **Bug Fix** "failed to run command" error

## 1.55.0 2025-04-09

- **Bug Fix** Amazon Q Chat: Update chat history icon
- **Bug Fix** Amazon Q Chat: chat occasionally freezes and displays gray screen
- **Bug Fix** Amazon Q Chat: Set owner-only permissions for chat history and saved prompt files
- **Feature** `/test` generates tests in all languages, not only Java/Python
- **Feature** Amazon Q chat: Click export icon to save chat transcript in Markdown or HTML
- **Feature** SageMaker: Disable the unsupported agentic commands and welcome prompt
- **Feature** Amazon Q Chat: Add `@code` context for PHP, Ruby, Scala, Shell, and Swift projects
- **Feature** Enterprise users can choose their preferred Amazon Q profile to improve personalization and workflow across different business regions

## 1.54.0 2025-04-03

- **Bug Fix** Amazon Q chat: `@prompts` not added to context
Expand Down
13 changes: 12 additions & 1 deletion packages/amazonq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "amazon-q-vscode",
"displayName": "Amazon Q",
"description": "The most capable generative AI-powered assistant for building, operating, and transforming software, with advanced capabilities for managing data and AI",
"version": "1.55.0-SNAPSHOT",
"version": "1.58.0-SNAPSHOT",
"extensionKind": [
"workspace"
],
Expand Down Expand Up @@ -361,6 +361,11 @@
"when": "view =~ /^aws\\.amazonq/",
"group": "1_amazonQ@1"
},
{
"command": "aws.amazonq.selectRegionProfile",
"when": "view == aws.amazonq.AmazonQChatView && aws.amazonq.connectedSsoIdc == true",
"group": "1_amazonQ@1"
},
{
"command": "aws.amazonq.signout",
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected && !aws.isSageMakerUnifiedStudio",
Expand Down Expand Up @@ -573,6 +578,12 @@
"category": "%AWS.amazonq.title%",
"enablement": "aws.codewhisperer.connected"
},
{
"command": "aws.amazonq.selectRegionProfile",
"title": "Change Profile",
"category": "%AWS.amazonq.title%",
"enablement": "aws.codewhisperer.connected"
},
{
"command": "aws.amazonq.transformationHub.reviewChanges.acceptChanges",
"title": "%AWS.command.q.transform.acceptChanges%"
Expand Down
3 changes: 3 additions & 0 deletions packages/amazonq/src/app/amazonqScan/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export function init(appContext: AmazonQAppInitContext) {
AuthUtil.instance.secondaryAuth.onDidChangeActiveConnection(() => {
return debouncedEvent()
})
AuthUtil.instance.regionProfileManager.onDidChangeRegionProfile(() => {
return debouncedEvent()
})

Commands.register('aws.amazonq.security.scan-statusbar', async () => {
if (AuthUtil.instance.isConnectionExpired()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export class ScanController {
interactionType: data.vote,
})
})

AuthUtil.instance.regionProfileManager.onDidChangeRegionProfile(() => {
this.sessionStorage.removeActiveTab()
})
}

private async tabOpened(message: any) {
Expand Down
2 changes: 0 additions & 2 deletions packages/amazonq/src/app/chat/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { AuthUtil, CodeWhispererSettings } from 'aws-core-vscode/codewhisperer'
import { Commands, placeholder, funcUtil } from 'aws-core-vscode/shared'
import * as amazonq from 'aws-core-vscode/amazonq'
import { scanChatAppInit } from '../amazonqScan'
import { init as inlineChatInit } from '../../inlineChat/app'

export async function activate(context: ExtensionContext) {
const appInitContext = amazonq.DefaultAmazonQAppInitContext.instance
Expand Down Expand Up @@ -72,7 +71,6 @@ function registerApps(appInitContext: amazonq.AmazonQAppInitContext, context: Ex
amazonq.testChatAppInit(appInitContext)
scanChatAppInit(appInitContext)
amazonq.docChatAppInit(appInitContext)
inlineChatInit(context)
}

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/amazonq/src/extensionNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { DevOptions } from 'aws-core-vscode/dev'
import { Auth, AuthUtils, getTelemetryMetadataForConn, isAnySsoConnection } from 'aws-core-vscode/auth'
import api from './api'
import { activate as activateCWChat } from './app/chat/activation'
import { activate as activateInlineChat } from './inlineChat/activation'
import { beta } from 'aws-core-vscode/dev'
import { activate as activateNotifications, NotificationsController } from 'aws-core-vscode/notifications'
import { AuthState, AuthUtil } from 'aws-core-vscode/codewhisperer'
Expand Down Expand Up @@ -55,6 +56,7 @@ async function activateAmazonQNode(context: vscode.ExtensionContext) {
await activateCWChat(context)
await activateQGumby(extContext as ExtContext)
}
activateInlineChat(context)

const authProvider = new CommonAuthViewProvider(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/
import * as vscode from 'vscode'
import { InlineChatController } from '../inlineChat/controller/inlineChatController'
import { registerInlineCommands } from '../inlineChat/command/registerInlineCommands'
import { InlineChatController } from './controller/inlineChatController'
import { registerInlineCommands } from './command/registerInlineCommands'

export function init(context: vscode.ExtensionContext) {
export function activate(context: vscode.ExtensionContext) {
const inlineChatController = new InlineChatController(context)
registerInlineCommands(context, inlineChatController)
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class InlineChatProvider {
codeQuery: context?.focusAreaContext?.names,
userIntent: this.userIntentRecognizer.getFromPromptChatMessage(message),
customization: getSelectedCustomization(),
profile: AuthUtil.instance.regionProfileManager.activeRegionProfile,
context: [],
relevantTextDocuments: [],
additionalContents: [],
Expand Down
5 changes: 2 additions & 3 deletions packages/amazonq/src/lsp/chat/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import * as vscode from 'vscode'
import { Commands, globals } from 'aws-core-vscode/shared'
import { window } from 'vscode'
import { AmazonQChatViewProvider } from './webviewProvider'
Expand Down Expand Up @@ -74,6 +73,6 @@ function registerGenericCommand(commandName: string, genericCommand: string, pro
* Instead, we just create our own as a temporary solution
*/
async function focusAmazonQPanel() {
await vscode.commands.executeCommand('aws.amazonq.AmazonQChatView.focus')
await vscode.commands.executeCommand('aws.amazonq.AmazonCommonAuth.focus')
await Commands.tryExecute('aws.amazonq.AmazonQChatView.focus')
await Commands.tryExecute('aws.amazonq.AmazonCommonAuth.focus')
}
16 changes: 10 additions & 6 deletions packages/amazonq/src/lsp/chat/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import {
insertToCursorPositionNotificationType,
} from '@aws/language-server-runtimes/protocol'
import { v4 as uuidv4 } from 'uuid'
import { window } from 'vscode'
import * as vscode from 'vscode'
import { Disposable, LanguageClient, Position, State, TextDocumentIdentifier } from 'vscode-languageclient'
import * as jose from 'jose'
import { AmazonQChatViewProvider } from './webviewProvider'
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
import { AmazonQPromptSettings } from 'aws-core-vscode/shared'
import { AmazonQPromptSettings, messages } from 'aws-core-vscode/shared'

export function registerLanguageServerEventListener(languageClient: LanguageClient, provider: AmazonQChatViewProvider) {
languageClient.onDidChangeState(({ oldState, newState }) => {
Expand Down Expand Up @@ -62,11 +62,15 @@ export function registerMessageListeners(

switch (message.command) {
case COPY_TO_CLIPBOARD:
// TODO see what we need to hook this up
languageClient.info('[VSCode Client] Copy to clipboard event received')
try {
await messages.copyToClipboard(message.params.code)
} catch (e) {
languageClient.error(`[VSCode Client] Failed to copy to clipboard: ${(e as Error).message}`)
}
break
case INSERT_TO_CURSOR_POSITION: {
const editor = window.activeTextEditor
const editor = vscode.window.activeTextEditor
let textDocument: TextDocumentIdentifier | undefined = undefined
let cursorPosition: Position | undefined = undefined
if (editor) {
Expand Down Expand Up @@ -119,8 +123,8 @@ export function registerMessageListeners(
)

const editor =
window.activeTextEditor ||
window.visibleTextEditors.find((editor) => editor.document.languageId !== 'Log')
vscode.window.activeTextEditor ||
vscode.window.visibleTextEditors.find((editor) => editor.document.languageId !== 'Log')
if (editor) {
message.params.cursorPosition = [editor.selection.active]
message.params.textDocument = { uri: editor.document.uri.toString() }
Expand Down
Loading
Loading