返回max_int。 这便是 GitHub Copilot 的最新功能 ——Explain Code。之前 Copilot 是基于人类的注释生成代码,现在好了,它也学会了反向输出。 网友们的反应也是可想而知了: 但在“新奇”之后,这件事也引发了不小的讨论。 AI 给代码做注释,有必要吗? 不仅是 Copilot,“AI 给代码做注释”这事最近在 Reddit...
选中代码,输入/explain(或右键点击代码行选择 Copilot > Explain this) 获取解释。 /explain后可加中文描述以获取中文解释。 4. 测试生成 类似代码解释,将/explain替换为/tests generate tests生成测试代码。 5. 行内快捷操作 Cmd+I/Ctrl+I在光标所在行显示输入框,方便提问或输入命令。 6. 快速问答 (q/a) 在...
选中要解释的代码行,在聊天框中输入 /explain,或者右键点击代码行选择 Copilot > Explain this。 如果需要中文解释,可以在聊天框中输入 /explain 后跟中文描述。 5. 生成测试 使用与解释代码相同的方法,将 /explain 替换为 /tests generate tests 来生成测试代码。 6. 行内快捷操作 在编辑器文件中,按 Cmd ...
获取有关使用 GitHub Copilot 的帮助 /doc 生成代码文档(行内聊天) /explain(@workspace /explain) 解释所选代码的工作原理 /fix(@workspace /fix) 为所选代码中的问题提出解决方案 @workspace /fixTestFailure(预览) 为失败的测试提出解决方案 @workspace /setupTests 为你的工作区配置测试框架 /tests(@workspace...
比如解释代码,选中解释的代码行,除了在聊天框输入 /explain 外,也可以右键依次点击 Github Copilot → Explain This: 对了,默认使用英文解释,如果需要中文,可以再 /explain 后加个使用中文: 生成的代码,除了复制,还可以将代码直接插入到光标处~ VS Code ...
在下拉列表中,选择“/explain”***,然后按“Enter”。 如果Copilot 返回的解释多于几行,请单击“聊天中的视图”***,以便更轻松地阅读说明。 优化低效代码 Copilot 可以帮助你优化代码,例如,使代码运行更快。 示例代码 在下面的两个部分中,我们将使用以下示例 bash 脚本来演示如何优化低效代码: #!/bin/bash ...
Let’s imagine you open theCopilot Chatin VS Code and type: “Explain the function in my @workspace that processes user login.” Below is thestep-by-stepbreakdown: Step A: Developer Prompt You open the Copilot Chat panel (or a sidebar) in VS Code. ...
选中要解释代码,右键copilot > explain this PS: 比较快捷,但是默认输出方式是英文 4.4 生成测试 前面的解释代码的方式一、方式二,换成/testsgenerate tests即可 4.5 行内操作 所有的解释、生成代码、测试、fix等都可以在行内操作进行。 所谓行内,就是在不离开编辑器文件代码的的情况下操作,这个时候只需要按comand...
As you can see, it explains the code in a very simple and easy-to-understand way and in a step-by-step manner which is great! You can also change the prompt that Copilot uses to explain the code in the“Advanced”tab of the“Explain”tab....
步骤一:安装 GitHub Copilot 1. 打开 Visual Studio Code 编辑器。 2. 在扩展栏中搜索 GitHub Copilot。 3. 点击“安装”按钮进行安装。 4. 安装完成后,重新启动 Visual Studio Code。 步骤二:启用 GitHub Copilot 1. 在 Visual Studio Code 编辑器中,打开任意一个项目。