# @aws/lsp-codewhisperer 中文文档

规范地址：https://npmcn.com/package/%40aws/lsp-codewhisperer/

版本：0\.0\.133
npm 元数据更新时间：2026-10-28T18:20:37.248Z
中文译文更新时间：2026-11-07T18:13:42.285Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40aws/lsp-codewhisperer
原文对照：https://npmcn.com/package/%40aws/lsp-codewhisperer/?lang=original
项目主页：https://github.com/Amazon-Q-Developer/language-servers#readme
源码仓库：https://github.com/Amazon-Q-Developer/language-servers

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：13.6 MB，4943 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=18\.0\.0
- 运行依赖：43 个
- 首次发布：2024-03-07T17:47:09.811Z
- 最新版本发布：2026-10-28T18:20:36.836Z
- 近 30 天下载量：3240（2026-10-08 至 2026-11-06，npm 官方下载统计）
- 已发布版本数：125（近 12 个月 44 个）

## 中文简介

代码Whiper 语言服务器

## 安装

```sh
npm install @aws/lsp-codewhisperer
```

也可以使用：`pnpm add @aws/lsp-codewhisperer`、`yarn add @aws/lsp-codewhisperer`、`bun add @aws/lsp-codewhisperer`

## README

# 代码Whiper 服务器

## 指南

### 代理服务器

要在代理服务器后方使用 CodeWhiper 服务器,请导入 [`CodeWhispererServerTokenProxy`](https://npmcn.com/package/%40aws/lsp-codewhisperer/src/shared/proxy-server.ts) 作为服务器并设置环境变量 `HTTPS_PROXY` 或者说 `https_proxy` 到您正在使用的代理 URL. 你可以将环境变量传递到进程上,或者仅仅在你的系统上在全球设置.

```
export HTTPS_PROXY=https://proxy.example.com:5678
export https_proxy=https://proxy.example.com:5678
```

或者说

```
export HTTPS_PROXY=http://username:password@proxy.example.com:5678
export https_proxy=http://username:password@proxy.example.com:5678
```

### 网络工人运行时间

此软件包所执行的Amazon Q 服务器可能具有对NodeJS本土模块的依赖性,在非Node.js环境中无法提供.

要制作跨平台捆绑,使用允许有相容替代品(如Webpack)的压倒性模块的捆绑器.

此软件包中使用的节点JS模块

-   代码WhiperServer:
    -   `path`
-   安全扫描服务器 :
    -   `path`, (中文(简体) ), `os`

要覆盖模块,使用下一个选项:

-   `path` - 说吧 [https://www.npmjs.com/package/path-browserify (中文(简体) )](https://www.npmjs.com/package/path-browserify)
-   `os` - 说吧 [https://www.npmjs.com/package/os-browserify (中文(简体) )](https://www.npmjs.com/package/os-browserify)

### 正在获取 Amazon Q 配置

以下的 Amazon Q 配置可以随 : `aws/getConfigurationFromServer` 请求 [Qfigation 服务器](https://github.com/aws/language-servers/blob/main/server/aws-lsp-codewhisperer/src/language-server/configuration/qConfigurationServer.ts)数字 :

-   定制
-   开发者配置文件

请求要求 `section` 参数,确认以下选项:

-   `aws.q`
    -   `aws.q.customizations`
    -   `aws.q.developerProfiles`

示例

```ts
await languageClient.sendRequest(getConfigurationFromServerRequestType.method, {
            section: 'aws.q',
        })
// result:
{
  'customizations': [customization1, customization2, ...],
  'developerProfiles': [profile1, profile2, ...] // (if enabled)
}
```

Granular 请求, 如 `aws.q.customizations` 将只返回特定的配置.

示例

```ts
await languageClient.sendRequest(getConfigurationFromServerRequestType.method, {
            section: 'aws.q.customizations',
        })
// result:
[customization1, customization2, ...]
```

#### 开发者配置文件

默认情况下, 开发者配置文件不被获取 。 为了能够获取,客户端需要在初始化时发出支持信号 `InitializeParams`。 。 。 .

示例

```ts
const params: InitializeParams = {
  // ...
  aws: {
    // ...
    awsClientCapabilities: {
      q: {
        developerProfiles: true
      }
    }
  }
}
```

### 支持的工作空间配置

服务器支持如下 [工作空间配置](https://github.com/aws/language-servers/blob/996a422665f95656a481a766c8facfd7636ba2ba/server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/configurationUtils.ts#L81)数字 :

-   `aws.q.customization` (类型 : `string | undefined`,默认值 : `undefined`(中文(简体) )
    -   API 请求中使用的自定义 ARN, 空字符串将被解释为未定义 .
-   `aws.q.optOutTelemetry` (类型 : `OPTOUT | OPTIN`,默认值 : `OPTIN`(中文(简体) )
    -   此旗帜可以控制是选入还是选出遥测.
-   `aws.q.inlineSuggestions.extraContext` (类型 : `string | undefined`,默认值 : `undefined`(中文(简体) )
    -   要包含的额外上下文, 一个空字符串将被解释为未定义 。 见 [下级](https://npmcn.com/package/%40aws/lsp-codewhisperer/#readme-extra-context-for-q-inline-suggestions) 为更多背景.
-   `aws.q.inlineChat.extraContext` (类型 : `string | undefined`,默认值 : `undefined`(中文(简体) )
    -   内置聊天要包含的额外上下文, 一个空字符串将被解释为未定义 。 见 [下级](https://npmcn.com/package/%40aws/lsp-codewhisperer/#readme-extra-context-for-q-inline-chat) 为更多背景.
-   `aws.codeWhisperer.includeSuggestionsWithCodeReferences`: (类型 : `boolean`,默认值 : `false`(中文(简体) )
    -   此旗帜控制是否包含带有代码建议的引用 .
-   `aws.codeWhisperer.shareCodeWhispererContentWithAWS`: (类型 : `boolean`,默认值 : `false`(中文(简体) )
    -   此旗帜控制是否与 AWS 共享 Q 内容 .

客户端可以使用 `DidChangeConfiguration` 通知.

#### Q 内含建议的额外上下文

当客户端在需要定制建议的特定环境中运行时,服务器支持一个 `aws.q.inlineSuggestions.extraContext` 工作空间配置 。 此额外上下文将传递到文件开头的请求的左侧文件内容 .

#### Q 内置聊天的额外上下文

当客户端在需要定制内置聊天响应的特定环境中运行时,服务器支持一个 `aws.q.inlineChat.extraContext` 工作空间配置 。 这个额外的上下文将准备到请求的文件文本中,类似于内置建议是如何工作的.

## 常见问题

### @aws/lsp-codewhisperer 是什么？

代码Whiper 语言服务器

### 如何安装 @aws/lsp-codewhisperer？

在项目目录运行 npm install @aws/lsp-codewhisperer，或使用 pnpm add / yarn add / bun add。

### @aws/lsp-codewhisperer 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @aws/lsp-codewhisperer 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @aws/lsp-codewhisperer 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @aws/lsp-codewhisperer 可以商用吗？

@aws/lsp-codewhisperer 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @aws/lsp-codewhisperer 的下载量有多少？

根据 npm 官方下载统计，@aws/lsp-codewhisperer 在 2026/10/08 – 2026/11/06 这 30 天内被下载 3,240 次，日均约 108 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @aws/lsp-codewhisperer 还在维护吗？

最新版本 0\.0\.133 发布于 2026/10/29（10 天前）；至今共发布 125 个版本，其中过去 12 个月发布了 44 个；首次发布于 2024/03/08。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

