GitHub Copilot 有多神奇(英文)
微wx笑 2023-02-07【编程工具】 2 0关键字: GitHub Copilot
GitHub Copilot 是一个 AI 编程辅助工具,会自动生成代码。
最近,它推出了"代码刷"功能(code brush),用户可以选择不同的刷子处理代码,本文演示这个功能多么神奇。
GitHub Copilot 是一个 AI 编程辅助工具,会自动生成代码。
最近,它推出了"代码刷"功能(code brush),用户可以选择不同的刷子处理代码,本文演示这个功能多么神奇。
Github Next now showed a new feature in GitHub Copilot labs that allows you to change code you write to make it cleaner, more robust and document it automatically.
GitHub Copilot is incredible, and if you check what’s happening in the preview released as the Copilot Labs extension it will only get more amazing.
Check this out:
Let’s start with a basic JavaScript that checks a string length and reports when it is empty. One with an obvious mistake, as we use a single `=` instead of the type safe `===`. This will always report the string as empty.
Using the `Fix bugs` brush, this is rectified.
Using the `Clean` brush also adds reporting when the string is not empty.
Using the `List steps` brush adds comments for step (sure, this is redundant, but it also works for much more complex code).
Using `Make robust` adds error reporting instead of logging and an extra check to make sure that `str` is really a String and not an empty Array.
The `Add types` brush does exactly that.
You can also define custom brushes and there are more to come.
转自:https://christianheilmann.com/2022/12/13/code-brushes-for-github-copilot/
本文为转载文章,版权归原作者所有,不代表本站立场和观点。
下一篇:返回列表