doc: update docs/github-copilot.md
This commit is contained in:
parent
29bb4e487c
commit
8ae69f2386
@ -53,7 +53,7 @@ Quick Reference
|
|||||||
[C++](./docs/cpp.md)<!--rehype:style=background: rgb(6 147 13);&class=contributing-->
|
[C++](./docs/cpp.md)<!--rehype:style=background: rgb(6 147 13);&class=contributing-->
|
||||||
[Dart](./docs/dart.md)<!--rehype:style=background: rgb(64 196 255);-->
|
[Dart](./docs/dart.md)<!--rehype:style=background: rgb(64 196 255);-->
|
||||||
[Docker](./docs/docker.md)<!--rehype:style=background: rgb(72 143 223);-->
|
[Docker](./docs/docker.md)<!--rehype:style=background: rgb(72 143 223);-->
|
||||||
[Docker-Compose](./docs/docker-compose.md)<!--rehype:style=background: rgb(72 143 223);&class=contributing tag&data-lang=Docker-->
|
[Docker Compose](./docs/docker-compose.md)<!--rehype:style=background: rgb(72 143 223);&class=contributing tag&data-lang=Docker-->
|
||||||
[Dockerfile](./docs/dockerfile.md)<!--rehype:style=background: rgb(0 72 153);&class=tag&data-lang=Docker-->
|
[Dockerfile](./docs/dockerfile.md)<!--rehype:style=background: rgb(0 72 153);&class=tag&data-lang=Docker-->
|
||||||
[Django](./docs/django.md)<!--rehype:style=background: rgb(12 75 51);&class=contributing tag&data-lang=Python-->
|
[Django](./docs/django.md)<!--rehype:style=background: rgb(12 75 51);&class=contributing tag&data-lang=Python-->
|
||||||
[Elixir](./docs/elixir.md)<!--rehype:style=background: rgb(124 26 156);&class=contributing tag&data-lang=Elixir-->
|
[Elixir](./docs/elixir.md)<!--rehype:style=background: rgb(124 26 156);&class=contributing tag&data-lang=Elixir-->
|
||||||
@ -188,7 +188,8 @@ Quick Reference
|
|||||||
|
|
||||||
## 工具
|
## 工具
|
||||||
|
|
||||||
[ChatGPT](./docs/chatgpt.md)<!--rehype:style=background: rgb(74, 161, 129);&class=tag&data-lang=ai-->
|
[ChatGPT](./docs/chatgpt.md)<!--rehype:style=background: rgb(74, 161, 129);&class=tag&data-lang=AI-->
|
||||||
|
[Github Copilot](./docs/github-copilot.md)<!--rehype:style=background: rgb(125 45 220);&class=tag contributing&data-lang=AI&data-info=👆看看还缺点儿什么?-->
|
||||||
[Emacs](./docs/emacs.md)<!--rehype:style=background: rgb(98 36 134);-->
|
[Emacs](./docs/emacs.md)<!--rehype:style=background: rgb(98 36 134);-->
|
||||||
[Github](./docs/github.md)<!--rehype:style=background: rgb(36 41 47);-->
|
[Github](./docs/github.md)<!--rehype:style=background: rgb(36 41 47);-->
|
||||||
[Linux Command](./docs/linux-command.md)<!--rehype:style=background: rgb(215 89 62);&class=tag&data-lang=命令速查-->
|
[Linux Command](./docs/linux-command.md)<!--rehype:style=background: rgb(215 89 62);&class=tag&data-lang=命令速查-->
|
||||||
|
@ -3,12 +3,12 @@ Github Copilot 备忘清单
|
|||||||
|
|
||||||
这是开始使用 [Github Copilot](https://code.visualstudio.com/docs/editor/github-copilot) 的快速参考指南
|
这是开始使用 [Github Copilot](https://code.visualstudio.com/docs/editor/github-copilot) 的快速参考指南
|
||||||
|
|
||||||
一、准备工作
|
入门
|
||||||
----
|
----
|
||||||
|
|
||||||
### 1、账号注册
|
### 1、账号注册
|
||||||
|
|
||||||
> 需要先拥有一个Github账号,并订阅Copilot。
|
需要先拥有一个Github账号,并订阅Copilot。
|
||||||
|
|
||||||
事项 | 说明
|
事项 | 说明
|
||||||
:-|-
|
:-|-
|
||||||
@ -18,7 +18,7 @@ Github 账号 | [注册地址](https://github.com/signup)
|
|||||||
### 2、安装Vscode插件
|
### 2、安装Vscode插件
|
||||||
<!--rehype:wrap-class=col-span-1 row-span-1-->
|
<!--rehype:wrap-class=col-span-1 row-span-1-->
|
||||||
|
|
||||||
> 在扩展商店中搜索安装下面插件
|
在扩展商店中搜索安装下面插件
|
||||||
|
|
||||||
插件名称 | 功能
|
插件名称 | 功能
|
||||||
:-|-
|
:-|-
|
||||||
@ -51,7 +51,7 @@ Editor Chat| 在编辑器中打开完整的对话界面
|
|||||||
Silde Chat| 在编辑器的侧边栏打开对话界面
|
Silde Chat| 在编辑器的侧边栏打开对话界面
|
||||||
Quick Chat| 在顶部唤起对话界面
|
Quick Chat| 在顶部唤起对话界面
|
||||||
|
|
||||||
二、提示技巧
|
提示技巧
|
||||||
----
|
----
|
||||||
|
|
||||||
### 提示之禅
|
### 提示之禅
|
||||||
@ -275,7 +275,7 @@ dailogs = [
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
三、快捷键
|
快捷键
|
||||||
----
|
----
|
||||||
<!--rehype:body-class=cols-2-->
|
<!--rehype:body-class=cols-2-->
|
||||||
|
|
||||||
@ -287,6 +287,7 @@ dailogs = [
|
|||||||
<!--rehype:wrap-class=col-span-2 row-span-1-->
|
<!--rehype:wrap-class=col-span-2 row-span-1-->
|
||||||
|
|
||||||
#### Copilot 中 Inline Suggestions 相关命令
|
#### Copilot 中 Inline Suggestions 相关命令
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
||||||
|-|:-|:-|:-|
|
|-|:-|:-|:-|
|
||||||
@ -300,6 +301,7 @@ dailogs = [
|
|||||||
<!--rehype:className=show-header wrap-text left-align-->
|
<!--rehype:className=show-header wrap-text left-align-->
|
||||||
|
|
||||||
#### Copilot 中 Completions Panel 相关命令
|
#### Copilot 中 Completions Panel 相关命令
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
||||||
|-|:-|:-|:-|
|
|-|:-|:-|:-|
|
||||||
@ -310,6 +312,7 @@ dailogs = [
|
|||||||
<!--rehype:className=show-header wrap-text left-align-->
|
<!--rehype:className=show-header wrap-text left-align-->
|
||||||
|
|
||||||
#### Copilot 中 其他命令
|
#### Copilot 中 其他命令
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
||||||
|-|:-|:-|:-|
|
|-|:-|:-|:-|
|
||||||
@ -324,6 +327,7 @@ dailogs = [
|
|||||||
<!--rehype:wrap-class=col-span-2 row-span-1-->
|
<!--rehype:wrap-class=col-span-2 row-span-1-->
|
||||||
|
|
||||||
#### Copilot Chat 中 Chat 相关命令
|
#### Copilot Chat 中 Chat 相关命令
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
||||||
|-|:-|:-|:-|
|
|-|:-|:-|:-|
|
||||||
@ -334,6 +338,7 @@ dailogs = [
|
|||||||
<!--rehype:className=show-header wrap-text left-align-->
|
<!--rehype:className=show-header wrap-text left-align-->
|
||||||
|
|
||||||
#### Copilot Chat 中 Inline Chat 相关命令
|
#### Copilot Chat 中 Inline Chat 相关命令
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
||||||
|-|:-|:-|:-|
|
|-|:-|:-|:-|
|
||||||
@ -345,6 +350,7 @@ dailogs = [
|
|||||||
<!--rehype:className=show-header wrap-text left-align-->
|
<!--rehype:className=show-header wrap-text left-align-->
|
||||||
|
|
||||||
#### Copilot Chat 中 Quick Chat 相关命令
|
#### Copilot Chat 中 Quick Chat 相关命令
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
||||||
|-|:-|:-|:-|
|
|-|:-|:-|:-|
|
||||||
@ -353,6 +359,7 @@ dailogs = [
|
|||||||
<!--rehype:className=show-header wrap-text left-align-->
|
<!--rehype:className=show-header wrap-text left-align-->
|
||||||
|
|
||||||
#### Copilot Chat 中 Editor Chat 相关命令
|
#### Copilot Chat 中 Editor Chat 相关命令
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
||||||
|-|:-|:-|:-|
|
|-|:-|:-|:-|
|
||||||
@ -360,6 +367,7 @@ dailogs = [
|
|||||||
<!--rehype:className=show-header wrap-text left-align-->
|
<!--rehype:className=show-header wrap-text left-align-->
|
||||||
|
|
||||||
#### Copilot Chat 其他命令
|
#### Copilot Chat 其他命令
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
| 命令 |说明 | 快捷键 | Mac 快捷键 |
|
||||||
|-|:-|:-|:-|
|
|-|:-|:-|:-|
|
||||||
@ -368,10 +376,10 @@ dailogs = [
|
|||||||
`github.copilot.ghpr.applySuggestion`|为Github Pull Request提供代码建议|-|-
|
`github.copilot.ghpr.applySuggestion`|为Github Pull Request提供代码建议|-|-
|
||||||
<!--rehype:className=show-header wrap-text left-align-->
|
<!--rehype:className=show-header wrap-text left-align-->
|
||||||
|
|
||||||
四、Copilot Chat 的 Slash Commands 使用技巧
|
Copilot Chat 的 Slash Commands 使用技巧
|
||||||
----
|
----
|
||||||
|
|
||||||
> 在聊天对话框中可以通过`/`开头的命令来与Copilot Chat进行交互。
|
在聊天对话框中可以通过`/`开头的命令来与Copilot Chat进行交互。
|
||||||
|
|
||||||
### Slash Commands 示例
|
### Slash Commands 示例
|
||||||
<!--rehype:wrap-class=col-span-1 row-span-1-->
|
<!--rehype:wrap-class=col-span-1 row-span-1-->
|
||||||
@ -393,9 +401,9 @@ dailogs = [
|
|||||||
@vscode /api 请解释 inlineChat.start 的作用
|
@vscode /api 请解释 inlineChat.start 的作用
|
||||||
|
|
||||||
@workspace /explain def helloworld():...
|
@workspace /explain def helloworld():...
|
||||||
|
```
|
||||||
|
|
||||||
在每一行代码末尾添加注释进行解释
|
在每一行代码末尾添加注释进行解释
|
||||||
```
|
|
||||||
|
|
||||||
#### Agent
|
#### Agent
|
||||||
|
|
||||||
@ -420,7 +428,7 @@ dailogs = [
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> 通过命令 `github.copilot.interactiveEditor.generate` 触发
|
通过命令 "github.copilot.interactiveEditor.generate" 触发
|
||||||
|
|
||||||
|命令 |说明 |
|
|命令 |说明 |
|
||||||
|- |:-|
|
|- |:-|
|
||||||
@ -430,32 +438,34 @@ dailogs = [
|
|||||||
|
|
||||||
> 当然也可以直接选中区域,然后在inline chat中输入指令执行 copilot会对选中区域进行指令操作
|
> 当然也可以直接选中区域,然后在inline chat中输入指令执行 copilot会对选中区域进行指令操作
|
||||||
|
|
||||||
|常用指令|
|
#### 常用指令
|
||||||
| - |
|
|
||||||
|在每一行代码末尾添加注释进行解释|
|
- 在每一行代码末尾添加注释进行解释
|
||||||
|使代码满足PEP484要求|
|
- 使代码满足PEP484要求
|
||||||
<!--rehype:className=show-header wrap-text left-align-->
|
<!--rehype:className=style-round-->
|
||||||
|
|
||||||
### Silde Chat 的 Slash Commands
|
### Silde Chat 的 Slash Commands
|
||||||
<!--rehype:wrap-class=col-span-1 row-span-2-->
|
<!--rehype:wrap-class=col-span-1 row-span-2-->
|
||||||
|
|
||||||
> 通过命令 `workbench.action.chat.openInSidebar` 触发 `chat` 后使用
|
- 通过命令 `workbench.action.chat.openInSidebar` 触发 `chat` 后使用
|
||||||
> 或点击侧边栏上的Copilot聊天按钮
|
- 或点击侧边栏上的Copilot聊天按钮
|
||||||
> 在Chat输入框中还允许指定Agent(即环境)
|
- 在Chat输入框中还允许指定Agent(即环境)
|
||||||
|
<!--rehype:className=style-round-->
|
||||||
|
|
||||||
#### Slash Commands
|
#### Slash Commands
|
||||||
|
|
||||||
|命令 |说明 |
|
|命令 |说明 |
|
||||||
|- |:-|
|
|- |:-|
|
||||||
/api |回答vscode扩展插件开发的问题
|
`/api` |回答vscode扩展插件开发的问题
|
||||||
/explain |对选中的代码进行解释
|
`/explain` |对选中的代码进行解释
|
||||||
/fix |修复此选中的代码
|
`/fix` |修复此选中的代码
|
||||||
/new |创建新项目workspace
|
`/new` |创建新项目workspace
|
||||||
/newNotebook |创建新的Jupyter Notebook
|
`/newNotebook` |创建新的Jupyter Notebook
|
||||||
/terminal |解释命令行里的命令
|
`/terminal` |解释命令行里的命令
|
||||||
/tests |为选中的代码生成单元测试
|
`/tests` |为选中的代码生成单元测试
|
||||||
/help |帮助说明
|
`/help` |帮助说明
|
||||||
/clear |清除会话
|
`/clear` |清除会话
|
||||||
|
<!--rehype:className=left-align-->
|
||||||
|
|
||||||
### `/terminal`特有的变量, 以`#`号开头
|
### `/terminal`特有的变量, 以`#`号开头
|
||||||
|
|
||||||
@ -471,13 +481,12 @@ dailogs = [
|
|||||||
|
|
||||||
- Quick Chat 与 Chat 的 Slash Commands相同
|
- Quick Chat 与 Chat 的 Slash Commands相同
|
||||||
- Editor Chat 与 Chat 的 Slash Commands相同
|
- Editor Chat 与 Chat 的 Slash Commands相同
|
||||||
|
<!--rehype:className=style-round-->
|
||||||
|
|
||||||
五、参数设置
|
参数设置
|
||||||
----
|
----
|
||||||
|
|
||||||
打开vscode 命令面板, 输入`Preferences:Open Settings` 打开配置文件,在文件模式下配置相关参数.
|
打开 VSCode 命令面板,输入 `Preferences: Open Settings` 来打开配置文件。在文件模式下,您可以配置相关参数。要获取完整的参数说明,请查看 `copilot` 和 `copilot chat` 两个插件目录下的 `package.json` 文件,具体位置可以参考 [VSCode 扩展市场](https://code.visualstudio.com/docs/editor/extension-marketplace#_where-are-extensions-installed)。
|
||||||
|
|
||||||
完整参数说明可以查看 `copilot` 与 `copilot chat` 两个[插件目录](https://code.visualstudio.com/docs/editor/extension-marketplace#_where-are-extensions-installed)下的 `package.json` 文件获知。
|
|
||||||
|
|
||||||
### 完整配置参考
|
### 完整配置参考
|
||||||
|
|
||||||
@ -532,49 +541,59 @@ dailogs = [
|
|||||||
|
|
||||||
### 参数说明
|
### 参数说明
|
||||||
<!--rehype:wrap-class=col-span-2 row-span-1-->
|
<!--rehype:wrap-class=col-span-2 row-span-1-->
|
||||||
|
|
||||||
#### 代理参数
|
#### 代理参数
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
|设置参数 |值类型|说明 |
|
|设置参数 |值类型|说明 |
|
||||||
|:--|:--|:--|
|
|:--|:--|:--|
|
||||||
`"http.proxy"`| string |配置网络代理地址
|
`"http.proxy"`| string |配置网络代理地址
|
||||||
|
<!--rehype:className=left-align-->
|
||||||
|
|
||||||
#### Copilot Chat 参数
|
#### Copilot Chat 参数
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
|设置参数 |值类型|说明 |
|
|设置参数 |值类型|说明 |
|
||||||
|:--|:--|:--|
|
|:--|:--|:--|
|
||||||
`"github.copilot.chat.localeOverride"`| string | 设置Copilot本地语言
|
`"github.copilot.chat.localeOverride"`| string | 设置Copilot本地语言
|
||||||
`"github.copilot.chat.welcomeMessage"`| string |Copilot Chat 是否显示欢迎语<br>`first`: 仅第一次启动时, `always`: 总是, `never`: 从不
|
`"github.copilot.chat.welcomeMessage"`| string |Copilot Chat 是否显示欢迎语<br>`first`: 仅第一次启动时, `always`: 总是, `never`: 从不
|
||||||
|
<!--rehype:className=left-align-->
|
||||||
|
|
||||||
#### Copilot 基本参数
|
#### Copilot 基本参数
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
|设置参数 |值类型|说明 |
|
|设置参数 |值类型|说明 |
|
||||||
|:--|:--|:--|
|
|:--|:--|:--|
|
||||||
`"editor.inlineSuggest.enabled"`| boolean |启用内联建议
|
| `"editor.inlineSuggest.enabled"` | boolean | 启用内联建议 |
|
||||||
`"github.copilot.editor.iterativeFixing"`| boolean| 允许 Copilot 提供迭代修复建议
|
| `"github.copilot.editor.iterativeFixing"` | boolean | 允许 Copilot 提供迭代修复建议 |
|
||||||
`"github.copilot.editor.enableAutoCompletions"`| boolean |允许 Copilot 提供自动补全
|
| `"github.copilot.editor.enableAutoCompletions"` | boolean | 允许 Copilot 提供自动补全 |
|
||||||
`"github.copilot.editor.enableCodeActions"`| boolean|允许 Copilot 代码操作建议,这些操作可能包括重构代码、优化代码结构、修复可错误等
|
| `"github.copilot.editor.enableCodeActions"` | boolean | 允许 Copilot 提供代码操作建议,包括重构和优化代码结构、修复错误等 |
|
||||||
|
<!--rehype:className=left-align-->
|
||||||
|
|
||||||
#### 设置 Copilot 生效的文件类型
|
#### 设置 Copilot 生效的文件类型
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
|设置参数 |值类型|说明 |
|
|设置参数 |值类型|说明 |
|
||||||
|:--|:--|:--|
|
|:--|:--|:--|
|
||||||
`"github.copilot.enable"`| json |请将 `"*": true` 放到末尾 <br>[语言](https://code.visualstudio.com/docs/languages/identifiers)后设置 `false` 表示禁用copilot, 设置 `true` 表示启用
|
`"github.copilot.enable"`| json |请将 `"*": true` 放到末尾 <br>[语言](https://code.visualstudio.com/docs/languages/identifiers)后设置 `false` 表示禁用copilot, 设置 `true` 表示启用
|
||||||
|
<!--rehype:className=left-align-->
|
||||||
|
|
||||||
#### Copilot 高级参数
|
#### Copilot 高级参数
|
||||||
|
<!--rehype:style=text-align: left;-->
|
||||||
|
|
||||||
> github.copilot.advanced 可以控制模型参数,最终影响到代码生成. 其值为json
|
`github.copilot.advanced` 可以控制模型参数,最终影响到代码生成。其值为json
|
||||||
|
|
||||||
|设置参数 |值类型|说明 |
|
| 设置参数 | 值类型 | 说明 |
|
||||||
|:--|:--|:--|
|
|----------|----------|----------|
|
||||||
`"length"`| integer | 生成的代码字数, 默认为 `500`
|
| `"length"` | 整数 integer | 生成代码的字数,默认为 `500` |
|
||||||
`"top_p"`| number | 控制模型候选范围,默认值为 `1`,值范围为`0.0~1.0`
|
| `"top_p"` | 数字 number | 控制模型候选范围,默认值为 `1`,范围为 `0.0~1.0` |
|
||||||
`"temperature"`| string | 控制模型的创造性,默认值为 `""`,值越大越不可预测,值范围为`0.0~1.0`
|
| `"temperature"` | 字符串 string | 控制模型创造性,默认值为空,值越大越不可预测,范围为 `0.0~1.0` |
|
||||||
`"inlineSuggestCount"`| integer | 内联提示的个数, 默认为`3`
|
| `"inlineSuggestCount"` | 整数 integer | 内联提示的个数,默认为 `3` |
|
||||||
`"listCount"`| integer | 控制`Completions Panel`中建议个数,默认为 `10`
|
| `"listCount"` | 整数 integer | `Completions Panel` 中建议的个数,默认为 `10` |
|
||||||
`"stops"`| json | 控制模型代码生成时停止的标志,可以按[语言](https://code.visualstudio.com/docs/languages/identifiers)来控制
|
| `"stops"` | JSON | 控制模型代码生成时的停止标志,可按[语言](https://code.visualstudio.com/docs/languages/identifiers)控制 |
|
||||||
`"indentationMode"`| json | 指定[语言](https://code.visualstudio.com/docs/languages/identifiers)是否采用该语言的缩近模式,由此可能会与stops冲突,比如采用`\{\}`缩近时,设置该参数时需要综合考虑
|
| `"indentationMode"` | JSON | 指定[语言](https://code.visualstudio.com/docs/languages/identifiers)是否使用该语言的缩进模式,可能与 stops 冲突 |
|
||||||
`"debug.showScores"`| boolean | 在代码建议列表中显示每个建议的分数
|
| `"debug.showScores"` | 布尔值 boolean | 在代码建议列表中显示每个建议的分数 |
|
||||||
<!--rehype:className=wrap-text -->
|
<!--rehype:className=left-align-->
|
||||||
|
|
||||||
END... ENJOY YOURSELF
|
END... ENJOY YOURSELF
|
||||||
----
|
----
|
||||||
|
Loading…
x
Reference in New Issue
Block a user