Skip to content

Commit 44b6933

Browse files
committed
docs(amazonq): update instructions for enabling the chat client frin dev mode
1 parent 76b61df commit 44b6933

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

docs/lsp.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ sequenceDiagram
5353
"amazonqLSPChat": true // optional: enables chat from flare
5454
}
5555
```
56-
4. Uncomment the `__AMAZONQLSP_PATH` variable in `amazonq/.vscode/launch.json` Extension configuration
57-
1. Uncomment the `__AMAZONQLSP_UI` variable in `amazonq/.vscode/launch.json` Extension configuration if you want to debug the flare chat-client as well
56+
4. Uncomment the `__AMAZONQLSP_PATH` and `__AMAZONQLSP_UI` variables in the `amazonq/.vscode/launch.json` extension configuration
5857
5. Use the `Launch LSP with Debugging` configuration and set breakpoints in VSCode or the language server
5958
6059
## Amazon Q Inline Activation

packages/amazonq/.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"env": {
1515
"SSMDOCUMENT_LANGUAGESERVER_PORT": "6010",
1616
"WEBPACK_DEVELOPER_SERVER": "http://localhost:8080"
17-
// "__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/token-standalone.js",
17+
// "__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/agent-standalone.js",
1818
// "__AMAZONQLSP_UI": "${workspaceFolder}/../../../language-servers/chat-client/build/amazonq-ui.js"
1919
},
2020
"envFile": "${workspaceFolder}/.local.env",

packages/amazonq/src/lsp/chat/webviewProvider.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
} from 'aws-core-vscode/shared'
2323
import { AuthUtil, RegionProfile } from 'aws-core-vscode/codewhisperer'
2424
import { featureConfig } from 'aws-core-vscode/amazonq'
25+
import { getAmazonQLspConfig } from '../config'
2526

2627
export class AmazonQChatViewProvider implements WebviewViewProvider {
2728
public static readonly viewType = 'aws.amazonq.AmazonQChatView'
@@ -44,10 +45,23 @@ export class AmazonQChatViewProvider implements WebviewViewProvider {
4445

4546
const lspDir = Uri.parse(LanguageServerResolver.defaultDir())
4647
const dist = Uri.joinPath(globals.context.extensionUri, 'dist')
48+
49+
const resourcesRoots = [lspDir, dist]
50+
51+
/**
52+
* if the mynah chat client is defined, then make sure to add it to the resource roots, otherwise
53+
* it will 401 when trying to load
54+
*/
55+
const mynahUIPath = getAmazonQLspConfig().ui
56+
if (process.env.WEBPACK_DEVELOPER_SERVER && mynahUIPath) {
57+
const dir = path.dirname(mynahUIPath)
58+
resourcesRoots.push(Uri.parse(dir))
59+
}
60+
4761
webviewView.webview.options = {
4862
enableScripts: true,
4963
enableCommandUris: true,
50-
localResourceRoots: [lspDir, dist],
64+
localResourceRoots: resourcesRoots,
5165
}
5266

5367
const source = 'vue/src/amazonq/webview/ui/amazonq-ui-connector-adapter.js' // Sent to dist/vue folder in webpack.

0 commit comments

Comments
 (0)