### Setup: Install dependencies and clone test fixture Source: https://github.com/amazon-q-developer/language-servers/blob/main/integration-tests/atx-transform-server/README.md Install dependencies and clone the Bobs Used Bookstore Classic repository as the test fixture. ```bash # Install dependencies npm install # Clone test fixture mkdir -p out/tests/testFixture git clone https://github.com/aws-samples/bobs-used-bookstore-classic.git out/tests/testFixture/bobs-used-bookstore-classic ``` -------------------------------- ### Install dependencies and watch Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Install dependencies and start the watch process for the VSCode Toolkit Extension. ```console npm install npm run watch ``` -------------------------------- ### Run a language server bundle Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Starts a language server bundle as a node application. Bundles are produced in ./app/**/build/* directories and require nodejs to be installed. ```bash node ./app/aws-lsp-codewhisperer-binary/aws-lsp-codewhisperer-token-binary.js --stdio ``` -------------------------------- ### Run development server for web worker testing Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/aws-lsp-codewhisperer-runtimes/README.md Starts a webpack development server (default: http://127.0.0.1:8080) that serves a basic setup to test web worker bundling, server initialization, and basic language client/server communication. Requires bundling with the package script first. ```bash npm run start ``` -------------------------------- ### Install language-servers dependencies Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Installs dependencies in the language-servers folder after setting up the runtime link. ```bash cd ../language-servers && npm install ``` -------------------------------- ### Run token-standalone bundle Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/aws-lsp-codewhisperer-runtimes/README.md Starts the token-standalone bundle with Node.js to verify it can run. ```bash node ./out/token-standalone.js --stdio ``` -------------------------------- ### Run iam-standalone bundle Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/aws-lsp-codewhisperer-runtimes/README.md Starts the iam-standalone bundle with Node.js to verify it can run. ```bash node ./out/iam-standalone.js --stdio ``` -------------------------------- ### Clone and install dependencies Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Clones the repository, changes into the language-servers directory, and installs dependencies. Requires node version 18+ and npm. ```bash git clone git@github.com:aws/language-servers.git cd language-servers npm install ``` -------------------------------- ### Install and link language-server-runtimes Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Installs dependencies in language-server-runtimes and creates an npm link to the runtimes/out directory. Since v0.2.3, the link must point to /language-server-runtimes/runtimes/out due to the monorepo structure. ```bash cd language-server-runtimes && npm install && cd ./runtimes && npm run prepub && cd ./out && npm link ``` -------------------------------- ### Install dependencies with npm install Source: https://github.com/amazon-q-developer/language-servers/blob/main/integration-tests/q-agentic-chat-server/README.md Installs project dependencies before running integration tests. ```bash npm install ``` -------------------------------- ### Force local language-server-runtimes usage Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Extreme option to force using the local language-server-runtimes install when the normal link does not take effect. Runs clean and reinstall steps in both projects, then links the runtime packages and compiles with --force. ```bash # From language-server-runtimes npm run clean && npm install && npm -ws install && npm run compile && npm -ws run prepub --if-present # From language-servers npm run clean && rm -fr node_modules && rm -fr server/aws-lsp-codewhisperer/node_modules npm install && npm -ws install && npm link @aws/language-server-runtimes @aws/language-server-runtimes-types && npm run compile -- --force ``` -------------------------------- ### Set required environment variables for integration tests Source: https://github.com/amazon-q-developer/language-servers/blob/main/integration-tests/q-agentic-chat-server/README.md Sets required environment variables for the integration tests. Replace the placeholder values with your actual SSO token, start URL, profile ARN, and runtime file path. ```bash export TEST_SSO_TOKEN="your-sso-token" export TEST_SSO_START_URL="your-sso-start-url" export TEST_PROFILE_ARN="your-profile-arn" export TEST_RUNTIME_FILE="/path/to/aws-lsp-codewhisperer.js" ``` -------------------------------- ### Run WebdriverIO tests for web worker implementation Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/aws-lsp-codewhisperer-runtimes/README.md Runs WebdriverIO tests that bundle the package, start the development server, launch a headless Chrome browser, connect to http://localhost:8080, and validate web worker initialization by checking for runtime console errors. Stops the server via npm run stop-dev-server. Tests are currently disabled on Windows. ```bash npm run test ``` -------------------------------- ### Set HTTPS_PROXY environment variables Source: https://github.com/amazon-q-developer/language-servers/blob/main/server/aws-lsp-codewhisperer/README.md Export the HTTPS_PROXY and https_proxy environment variables to route CodeWhisperer server traffic through a proxy. The first example uses a proxy without authentication; the second includes credentials in the URL. ```bash export HTTPS_PROXY=https://proxy.example.com:5678 export https_proxy=https://proxy.example.com:5678 ``` ```bash export HTTPS_PROXY=http://username:password@proxy.example.com:5678 export https_proxy=http://username:password@proxy.example.com:5678 ``` -------------------------------- ### Override AWS region and endpoint in VS Code launch configuration Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Example VS Code launch configuration that sets the AWS_Q_REGION and AWS_Q_ENDPOINT_URL environment variables to override the default region and endpoint for AWS SDK clients when building the capabilities servers. Placeholders 'set_region_here' and 'set_q_endpoint_here' must be replaced with actual values. ```json { "name": "CodeWhisperer Server Token", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", "args": ["--extensionDevelopmentPath=${workspaceFolder}/client/vscode", "--disable-extensions"], "outFiles": ["${workspaceFolder}/client/vscode/out/**/*.js"], "env": { "LSP_SERVER": "${workspaceFolder}/app/aws-lsp-codewhisperer-runtimes/out/token-standalone.js", "ENABLE_INLINE_COMPLETION": "true", "ENABLE_TOKEN_PROVIDER": "true", "ENABLE_CUSTOM_COMMANDS": "true", "ENABLE_CHAT": "true", "ENABLE_CUSTOMIZATIONS": "true", "AWS_Q_REGION": "set_region_here", "AWS_Q_ENDPOINT_URL" : "set_q_endpoint_here" }, "preLaunchTask": "compile" } ``` -------------------------------- ### Bundle All Runtimes Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/hello-world-lsp-runtimes/README.md Produces all runtime bundles (standalone and webworker) for the Hello World Language Server. ```bash npm run bundle ``` -------------------------------- ### Package Structure Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/hello-world-lsp-runtimes/README.md Shows the package structure with build, out, and src directories and their contents. ```text . ├── build - Budled Javascript runtime programms │ ├── hello-world-lsp-standalone.js - standalone bundle │ ├── hello-world-lsp-webworker.js - webworker bundle ├── out - Compiled Javascipt │ ├── standalone.js │ ├── webworker.js ├── src - source code configuration for bundling │ ├── standalone.ts └── └── webworker.ts ``` -------------------------------- ### Bundle with Webpack Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/hello-world-lsp-runtimes/README.md Creates JavaScript bundled files using webpack for the Hello World Language Server. ```bash npm run webpack ``` -------------------------------- ### Compile Hello World Language Server Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/hello-world-lsp-runtimes/README.md Compiles the Hello World Language Server package before creating runtime bundles. Run from the package root. ```bash cd ./language-servers/server/hello-world-lsp npm run compile ``` -------------------------------- ### Compile the repository Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Compiles the repository. Builds are typically incremental. ```bash npm run compile ``` -------------------------------- ### Clone language-servers and language-server-runtimes repositories Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Clones the language-servers and language-server-runtimes repositories, which is the first step when developing both projects together. ```bash git clone git@github.com:aws/language-servers.git git clone git@github.com:aws/language-server-runtimes.git ``` -------------------------------- ### Run Tests with npm test Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Run the test suite from the command line using npm. ```bash npm test ``` -------------------------------- ### Configuration values Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Shows the configuration properties for the chat client: quickActionCommands and disclaimerAcknowledged. ```typescript // Configures quick actions quickActionCommands?: QuickActionCommandGroup[] // Configures chat client not to show legal disclaimer as it has already been acknowledged before disclaimerAcknowledged?: boolean ``` -------------------------------- ### Run integration tests with npm run test-integ Source: https://github.com/amazon-q-developer/language-servers/blob/main/integration-tests/q-agentic-chat-server/README.md Runs the integration test suite for the Q Agentic Chat Language Server. ```bash npm run test-integ ``` -------------------------------- ### Run Standalone Bundle Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/hello-world-lsp-runtimes/README.md Runs the standalone bundle locally using Node.js with stdio transport to test the build. ```bash node ./out/hello-world-lsp-standalone.js --stdio ``` -------------------------------- ### Clone language-servers repository Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Clone the language-servers repository and navigate into it before setting up the VSCode Toolkit Extension. ```bash git clone git@github.com:aws/language-servers.git cd language-servers ``` -------------------------------- ### Standalone Bundle Log Output Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/hello-world-lsp-runtimes/README.md Expected JSON-RPC log output when running the standalone bundle, showing runtime initialization and capability registration. ```text Content-Length: 127 {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Runtime: Initializing runtime without encryption"}}Content-Length: 130 {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Runtime: Registering IAM credentials update handler"}}Content-Length: 133 {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Runtime: Registering bearer credentials update handler"}}Content-Length: 153 {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"[2024-05-14T10:16:02.618Z] The Hello World Capability has been initialised"}} ``` -------------------------------- ### ssoAuth/authDevice/getToken command parameters Source: https://github.com/amazon-q-developer/language-servers/blob/main/server/device-sso-auth-lsp/README.md Params for the ssoAuth/authDevice/getToken command. The startUrl is optional and defaults to 'https://view.awsapps.com/start'. ```typescript { /** * Command identifier */ command: "ssoAuth/authDevice/getToken", arguments?: { /** * Identity provide URL for authentication. Defaults to 'https://view.awsapps.com/start', if not set. */ startUrl?: string } } ``` -------------------------------- ### createPrompt Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Requests to create a prompt. ```APIDOC ## createPrompt ### Description Requests to create a prompt. ### Event Name `aws/chat/createPrompt` ### Parameters - **CreatePromptParams** - See [CreatePromptParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L397) ``` -------------------------------- ### Link language-server-runtimes to language-servers Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Links the local language-server-runtimes package into language-servers so that local changes are used. ```bash npm link @aws/language-server-runtimes ``` -------------------------------- ### Fetch only customizations with aws.q.customizations Source: https://github.com/amazon-q-developer/language-servers/blob/main/server/aws-lsp-codewhisperer/README.md Send a getConfigurationFromServer request with section 'aws.q.customizations' to fetch only the customizations configuration. The response is an array of customization objects. ```typescript await languageClient.sendRequest(getConfigurationFromServerRequestType.method, { section: 'aws.q.customizations', }) // result: [customization1, customization2, ...] ``` -------------------------------- ### Fetch Amazon Q configurations with getConfigurationFromServer Source: https://github.com/amazon-q-developer/language-servers/blob/main/server/aws-lsp-codewhisperer/README.md Send a getConfigurationFromServer request with section 'aws.q' to fetch both customizations and developer profiles. The response includes a 'customizations' array and a 'developerProfiles' array (if enabled). ```typescript await languageClient.sendRequest(getConfigurationFromServerRequestType.method, { section: 'aws.q', }) // result: { 'customizations': [customization1, customization2, ...], 'developerProfiles': [profile1, profile2, ...] // (if enabled) } ``` -------------------------------- ### uiReady Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when the UI is ready. ```APIDOC ## uiReady ### Description Notifies when the UI is ready. ### Event Name `aws/chat/ready` ### Parameters None ``` -------------------------------- ### Compile Amazon Q server bundles Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/aws-lsp-codewhisperer-runtimes/README.md Compiles the package and produces two bundled JavaScript programs in the ./out/ directory: iam-standalone.js and token-standalone.js. ```bash npm run package ``` -------------------------------- ### Run CodeWhisperer server bundle with debugging Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Run the CodeWhisperer server bundle with debugging enabled. Ensure --inspect or --inspect-brk is passed right after the node command. ```bash node --inspect=6012 {rootPath}/app/aws-lsp-codewhisperer-runtimes/out/token-standalone.js --nolazy --stdio --pre-init-encryption --set-credentials-encryption-key ``` -------------------------------- ### Create chat with configuration Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Creates a chat instance inside a webview, passing the VS Code API and a configuration object. ```typescript amazonQChat.createChat(acquireVsCodeApi(), configuration); ``` -------------------------------- ### Generate packaged build for agent-standalone server and chat-client Source: https://github.com/amazon-q-developer/language-servers/blob/main/app/aws-lsp-codewhisperer-runtimes/README.md Generates a packaged build for the agent-standalone server and chat-client. Must be run inside the app/aws-lsp-codewhisperer-runtimes directory. ```bash npm run local-build ``` -------------------------------- ### workspace/executeCommand ssoAuth/authDevice/getToken Source: https://github.com/amazon-q-developer/language-servers/blob/main/server/device-sso-auth-lsp/README.md Custom command sent from client to server using workspace/executeCommand LSP capability to initiate SSO Device Authentication flow. ```APIDOC ## [workspace/executeCommand] ssoAuth/authDevice/getToken ### Description Initiates SSO Device Authentication flow using the provided Identity Provider URL. The server prompts the client to display a message when called. When the device is authenticated and a bearer token is resolved, the token is cached on the filesystem. Cached token data is used in subsequent calls to refresh the token instead of invoking the flow again. ### Method workspace/executeCommand (LSP) ### Endpoint workspace/executeCommand ### Parameters #### Command - **command** (string) - Required - Command identifier: "ssoAuth/authDevice/getToken" #### Arguments (optional) - **startUrl** (string) - Optional - Identity provider URL for authentication. Defaults to 'https://view.awsapps.com/start' if not set. ### Request Example { "command": "ssoAuth/authDevice/getToken", "arguments": { "startUrl": "https://view.awsapps.com/start" } } ### Response #### Success Response - **token** (string) - Bearer token resolved after SSO flow completed. #### Response Example { "token": "" } ``` -------------------------------- ### Clean and recompile Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Performs a clean rebuild, useful when switching branches or when a full recompile is needed. ```bash npm run clean npm run compile ``` -------------------------------- ### aws/chat/openFileDialog Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Request from the UI to add selected files to the context. ```APIDOC ## aws/chat/openFileDialog ### Description Request to add selected files to context. ### Method Request ### Endpoint `aws/chat/openFileDialog` ### Parameters - **result** (OpenFileDialogResult) - Required - The result containing the selected files. ### Response No response expected. ``` -------------------------------- ### aws/chat/quickAction Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification from the UI to the server to send a quick action command. ```APIDOC ## aws/chat/quickAction ### Description Sends a quick action command. ### Method Notification ### Endpoint `aws/chat/quickAction` ### Parameters - **params** (QuickActionParams) - Required - The quick action parameters. ### Response No response expected. ``` -------------------------------- ### Enable debug output with DEBUG environment variable Source: https://github.com/amazon-q-developer/language-servers/blob/main/integration-tests/q-agentic-chat-server/README.md Optionally enables debug output for the integration tests. ```bash export DEBUG = true ``` -------------------------------- ### fileClick Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when a file is clicked. ```APIDOC ## fileClick ### Description Notifies when a file is clicked. ### Event Name `aws/chat/fileClick` ### Parameters - **FileClickParams** - See [FileClickParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L371) ``` -------------------------------- ### InitializeParams configuration for token cache location Source: https://github.com/amazon-q-developer/language-servers/blob/main/server/device-sso-auth-lsp/README.md Configuration options passed at LSP Initialize handshake. The tokenCacheLocation is optional and defaults to $HOMEDIR/.aws/device-sso-lsp/cache. ```typescript interface InitializeParams { initializationOptions: { // Path to writable directory to store SSO auth and refresh token cache // Default: $HOMEDIR/.aws/device-sso-lsp/cache tokenCacheLocation?: string } } ``` -------------------------------- ### Enable developer profiles in InitializeParams Source: https://github.com/amazon-q-developer/language-servers/blob/main/server/aws-lsp-codewhisperer/README.md Set aws.awsClientCapabilities.q.developerProfiles to true in the InitializeParams to signal support for fetching developer profiles. Without this, developer profiles are not fetched by default. ```typescript const params: InitializeParams = { // ... aws: { // ... awsClientCapabilities: { q: { developerProfiles: true } } } } ``` -------------------------------- ### authFollowUpClicked Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when an auth follow-up is clicked. ```APIDOC ## authFollowUpClicked ### Description Notifies when an auth follow-up is clicked. ### Event Name `authFollowUpClicked` ### Parameters - **AuthFollowUpClickedParams** - See [AuthFollowUpClickedParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/chat-client-ui-types/src/uiContracts.ts#L84) ``` -------------------------------- ### Sinon Usage Summary Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Quick summary of sinon usage: stubInterface for interfaces, stub for objects and functions, and the impact of explicit typing on compilation and method completion. ```typescript // Use to stub interfaces (must explicitly set type in declaration) stubInterface() stub(new MyClass()) // Use to stub objects stub(myFunc) // Use to stub functions // Explicitly typing let myClassStub: SinonStubbedInstance // vs let myClassStub: MyClass // will have an impact on compilation and method completion ``` -------------------------------- ### Object Instance Stub with sinon Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Stubbing an object instance: use stub(new MyClass()) with callThrough() to execute actual functionality, or createStubInstance(MyClass) to stub return values without creating an instance. ```typescript let myClassStub: SinonStubbedInstance = stub(new MyClass()) // Do this if you want myFunc() to execute its actual functionality myClassStub.myFunc.callThrough() // Or if you plan to only explicitly stub return values // it is safer/easier to do the following. // Note we are not creating a new instance of MyClass here. let myClassStub: SinonStubbedInstance = createStubInstance(MyClass) myClassStub.myFunc.returns(3) ``` -------------------------------- ### linkClick Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when a link is clicked. ```APIDOC ## linkClick ### Description Notifies when a link is clicked. ### Event Name `aws/chat/linkClick` ### Parameters - **LinkClickParams** - See [LinkClickParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L312) ``` -------------------------------- ### followUpClicked Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when a follow-up suggestion is clicked. ```APIDOC ## followUpClicked ### Description Notifies when a follow-up suggestion is clicked. ### Event Name `aws/chat/followUpClick` ### Parameters - **FollowUpClickParams** - See [FollowUpClickParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L320) ``` -------------------------------- ### sourceLinkClick Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when a source link is clicked. ```APIDOC ## sourceLinkClick ### Description Notifies when a source link is clicked. ### Event Name `aws/chat/sourceLinkClick` ### Parameters - **SourceLinkClickParams** - See [SourceLinkClickParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L316) ``` -------------------------------- ### Chat Client Events and Responses Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md List of chat client events and responses that can be emitted or handled by the chat client. ```APIDOC ## [EVENT] aws/chat/tabBarAction ### Description Notifies when a tab bar action is requested. ### Method EVENT ### Endpoint `aws/chat/tabBarAction` ### Parameters #### Params - **TabBarActionParams** - Required - The parameters for the tab bar action. ``` ```APIDOC ## [RESPONSE] aws/chat/getSerializedChat ### Description Provides response to getSerializedChat request. ### Method RESPONSE ### Endpoint `aws/chat/getSerializedChat` ### Parameters #### Params - **GetSerializedChatResult** - Required - The result of the getSerializedChat request. ``` ```APIDOC ## [EVENT] stopChatResponse ### Description Requests to stop current chat response. ### Method EVENT ### Endpoint `stopChatResponse` ### Parameters #### Params - **StopChatResponseParams** - Required - The parameters for stopping the chat response. ``` ```APIDOC ## [EVENT] aws/chat/buttonClick ### Description Sends button click event. ### Method EVENT ### Endpoint `aws/chat/buttonClick` ### Parameters #### Params - **ButtonClickParams** - Required - The parameters for the button click event. ``` ```APIDOC ## [EVENT] openSettings ### Description Requests to open settings. ### Method EVENT ### Endpoint `openSettings` ### Parameters #### Params - **OpenSettingsParams** - Required - The parameters for opening settings. ``` ```APIDOC ## [EVENT] aws/chat/ruleClick ### Description Notifies when a rule is clicked. ### Method EVENT ### Endpoint `aws/chat/ruleClick` ### Parameters #### Params - **RuleClickParams** - Required - The parameters for the rule click event. ``` ```APIDOC ## [EVENT] aws/chat/listRules ### Description Requests to list workspace rules. ### Method EVENT ### Endpoint `aws/chat/listRules` ### Parameters #### Params - **ListRulesParams** - Required - The parameters for listing rules. ``` ```APIDOC ## [EVENT] aws/chat/addPinnedContext ### Description Requests to add pinned context. ### Method EVENT ### Endpoint `aws/chat/addPinnedContext` ### Parameters #### Params - **PinnedContextParams** - Required - The parameters for adding pinned context. ``` ```APIDOC ## [EVENT] aws/chat/removePinnedContext ### Description Requests to remove pinned context. ### Method EVENT ### Endpoint `aws/chat/removePinnedContext` ### Parameters #### Params - **PinnedContextParams** - Required - The parameters for removing pinned context. ``` ```APIDOC ## [EVENT] openFileDialog ### Description Requests to open file dialog. ### Method EVENT ### Endpoint `openFileDialog` ### Parameters #### Params - **OpenFileDialogParams** - Required - The parameters for opening file dialog. ``` ```APIDOC ## [EVENT] filesDropped ### Description Notifies when files are dropped. ### Method EVENT ### Endpoint `filesDropped` ### Parameters #### Params - **FilesDroppedParams** - Required - The parameters for the files dropped event. ``` ```APIDOC ## [EVENT] aws/chat/promptInputOptionChange ### Description Notifies when prompt input options change. ### Method EVENT ### Endpoint `aws/chat/promptInputOptionChange` ### Parameters #### Params - **PromptInputOptionChangeParams** - Required - The parameters for the prompt input option change event. ``` -------------------------------- ### infoLinkClick Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when an info link is clicked. ```APIDOC ## infoLinkClick ### Description Notifies when an info link is clicked. ### Event Name `aws/chat/infoLinkClick` ### Parameters - **InfoLinkClickParams** - See [InfoLinkClickParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L307) ``` -------------------------------- ### copyToClipboard Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Requests to copy code to clipboard. ```APIDOC ## copyToClipboard ### Description Requests to copy code to clipboard. ### Event Name `copyToClipboard` ### Parameters - **CopyCodeToClipboardParams** - See [CopyCodeToClipboardParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/chat-client-ui-types/src/uiContracts.ts#L142) ``` -------------------------------- ### amazonQChat.createChat Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Function to create a chat instance inside a webview with configuration options. ```APIDOC ## [FUNCTION] amazonQChat.createChat ### Description Creates a chat instance inside a webview with the given configuration. ### Method FUNCTION ### Signature `amazonQChat.createChat(acquireVsCodeApi(), configuration)` ### Parameters - **acquireVsCodeApi** (function) - Required - The VS Code API object. - **configuration** (object) - Required - The configuration object. ### Configuration - **quickActionCommands** (QuickActionCommandGroup[]) - Optional - Configures quick actions. - **disclaimerAcknowledged** (boolean) - Optional - Configures chat client not to show legal disclaimer as it has already been acknowledged before. ``` -------------------------------- ### Sinon Imports Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Imports needed for sinon stubbing: ts-sinon for stubInterface, sinon for the rest. ```typescript import { stubInterface } from 'ts-sinon' // Only use this module for `stubInterface` import { SinonStubbedInstance, SinonStubbedMember, createStubInstance, stub } from 'sinon' ``` -------------------------------- ### aws/chat/listRules Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification from the server to the UI providing the list of workspace rules. ```APIDOC ## aws/chat/listRules ### Description Provides response with list of workspace rules to the UI. ### Method Notification ### Endpoint `aws/chat/listRules` ### Parameters - **result** (ListRulesResult) - Required - The list of workspace rules. ### Response No response expected. ``` -------------------------------- ### sendFeedback Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Sends user feedback. ```APIDOC ## sendFeedback ### Description Sends user feedback. ### Event Name `aws/chat/feedback` ### Parameters - **FeedbackParams** - See [FeedbackParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L278) ``` -------------------------------- ### aws/chat/openTab Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification from the server to the UI providing the response to an openTab request. ```APIDOC ## aws/chat/openTab ### Description Provides response to openTab request. ### Method Notification ### Endpoint `aws/chat/openTab` ### Parameters - **requestID** (string) - Required - ID shared between the webview and vscode client. - **result** (UiMessageResultParams) - Required - Contains the result of type OpenTabResult. ### Response No response expected. ``` -------------------------------- ### ssoAuth/authDevice/getToken response with token Source: https://github.com/amazon-q-developer/language-servers/blob/main/server/device-sso-auth-lsp/README.md Response of the ssoAuth/authDevice/getToken command, containing the bearer token resolved after the SSO flow completes. ```typescript { /** * Bearer token resolved after SSO flow completed. */ token: string } ``` -------------------------------- ### conversationClick Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when a conversation is clicked. ```APIDOC ## conversationClick ### Description Notifies when a conversation is clicked. ### Event Name `aws/chat/conversationClick` ### Parameters - **ConversationClickParams** - See [ConversationClickParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L507) ``` -------------------------------- ### insertToCursorPosition Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Requests to insert code at cursor position. ```APIDOC ## insertToCursorPosition ### Description Requests to insert code at cursor position. ### Event Name `insertToCursorPosition` ### Parameters - **InsertToCursorPositionParams** - See [InsertToCursorPositionParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L294) ``` -------------------------------- ### aws/chat/ruleClick Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification from the server to the UI providing the result of a rule click or action. ```APIDOC ## aws/chat/ruleClick ### Description Provides response to rule click or action, specifying action execution result. ### Method Notification ### Endpoint `aws/chat/ruleClick` ### Parameters - **result** (RuleClickResult) - Required - The result of the rule click action. ### Response No response expected. ``` -------------------------------- ### aws/chat/sendChatPrompt Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification from the UI to the server to send a chat prompt. ```APIDOC ## aws/chat/sendChatPrompt ### Description Sends a chat prompt to the server. ### Method Notification ### Endpoint `aws/chat/sendChatPrompt` ### Parameters - **params** (ChatParams) - Required - The chat prompt parameters. ### Response No response expected. ``` -------------------------------- ### chatPromptOptionAcknowledged Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when a chat prompt option is acknowledged. ```APIDOC ## chatPromptOptionAcknowledged ### Description Notifies when a chat prompt option is acknowledged. ### Event Name `chatPromptOptionAcknowledged` ### Parameters - **ChatPromptOptionAcknowledgedParams** - See [ChatPromptOptionAcknowledgedParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/chat-client-ui-types/src/uiContracts.ts#L107C18-L107C52) ``` -------------------------------- ### Function Stub with sinon Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Stubbing a function: use SinonStubbedMember instead of SinonStubbedInstance, and explicitly type the assignment to pass linting. ```typescript interface myFuncInterface { (x: string): string } myFunc: myFuncInterface = (x: string) => { return x } // Note `SinonStubedMember` instead of `SinonStubbedInstance` for functions const myFuncStub: SinonStubbedMember = stub(myFunc) // Must explicitly type with `SinonStubbedMember` on assignment for this to pass linting myFuncStub.callThrough() ``` -------------------------------- ### aws/chat/tabChange Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification from the UI to the server when a tab is changed. ```APIDOC ## aws/chat/tabChange ### Description Notifies when a tab is changed. ### Method Notification ### Endpoint `aws/chat/tabChange` ### Parameters - **params** (TabChangeParams) - Required - The tab change parameters. ### Response No response expected. ``` -------------------------------- ### Reset callThrough() with resetBehaviour() Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md To change a stubbed function from callThrough() to returns(), you must first call resetBehaviour(). ```typescript const myStubbedFunc = stub() myStubbedFunc.callThrough() myStubbedFunc.resetBehaviour() myStubbedFunc.returns() ``` -------------------------------- ### aws/chat/tabAdd Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification from the UI to the server when a tab is added. ```APIDOC ## aws/chat/tabAdd ### Description Notifies when a tab is added. ### Method Notification ### Endpoint `aws/chat/tabAdd` ### Parameters - **params** (TabAddParams) - Required - The tab add parameters. ### Response No response expected. ``` -------------------------------- ### aws/chat/sendPinnedContext Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification from the server to the UI with pinned context information. ```APIDOC ## aws/chat/sendPinnedContext ### Description Sends pinned context information to the UI. ### Method Notification ### Endpoint `aws/chat/sendPinnedContext` ### Parameters - **params** (PinnedContextParams) - Required - The pinned context information. ### Response No response expected. ``` -------------------------------- ### listConversations Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Requests to list conversations with filter provided. ```APIDOC ## listConversations ### Description Requests to list conversations with filter provided. ### Event Name `aws/chat/listConversations` ### Parameters - **ListConversationsParams** - See [ListConversationsParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L463) ``` -------------------------------- ### disclaimerAcknowledged Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notification that the legal disclaimer was acknowledged by the user. ```APIDOC ## disclaimerAcknowledged ### Description Notifies destination that legal disclaimer was acknowledged by a user. ### Method Notification ### Endpoint `disclaimerAcknowledged` ### Parameters None. ### Response No response expected. ``` -------------------------------- ### Default AWS Q endpoint and region constants Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Default values for the AWS Q endpoint URL and region used by the AWS SDK clients. These constants are defined in server/aws-lsp-codewhisperer/src/constants.ts and are overridden by the AWS_Q_ENDPOINT_URL and AWS_Q_REGION environment variables. ```typescript export const DEFAULT_AWS_Q_ENDPOINT_URL = 'https://codewhisperer.us-east-1.amazonaws.com/' export const DEFAULT_AWS_Q_REGION = 'us-east-1' ``` -------------------------------- ### Interface Stub with ts-sinon Source: https://github.com/amazon-q-developer/language-servers/blob/main/CONTRIBUTING.md Stubbing an interface requires ts-sinon's stubInterface() because sinon cannot stub interfaces directly. ```typescript // Note the need for `ts-sinon.stubInterface()` to stub interfaces. // `sinon` does not provide the ability to stub interfaces. let myInterfaceStub: SinonStubbedInstance = stubInterface() myInterfaceStub.someFunctionItDefined.returns('my value') ``` -------------------------------- ### tabRemoved Source: https://github.com/amazon-q-developer/language-servers/blob/main/chat-client/README.md Notifies when a tab is removed. ```APIDOC ## tabRemoved ### Description Notifies when a tab is removed. ### Event Name `aws/chat/tabRemove` ### Parameters - **TabRemoveParams** - See [TabRemoveParams](https://github.com/aws/language-server-runtimes/blob/112feba70219a98a12f13727d67c540205fa9c9f/types/chat.ts#L292) ```