M365 GitHub Copilot Sharing
M365 GitHub 副驾驶分享

48 subscribers 48 位订户
Zhengyang Du 杜正阳
May 17 · 1 min read · Edited May 17
5 月 17 日 · 阅读 1 分钟 · 5 月 17 日编辑
M365 GitHub Copilot Weekly Sharing #12
M365 GitHub Copilot 每周分享#12
Provide a top-level comment in your code file
在代码文件中提供顶级注释

This is most helpful if you have a blank file or empty codebase. In other words, if GitHub Copilot has zero context of what you want to build or accomplish, provide the context with a top-level comment in your code file, it could help both GitHub Copilot and yourself.
如果您有空白文件或空代码库,这将非常有帮助。换句话说,如果 GitHub Copilot 对您想要构建或完成的内容的上下文为零,请在代码文件中通过顶级注释提供上下文,这对 GitHub Copilot 和您自己都有帮助。

When prompting GitHub Copilot, think of the process as having a conversation with someone: How should I break down the problem so we can solve it together? How would I approach pair programming with this person?
当提示 GitHub Copilot 时,将这个过程想象成与某人对话:我应该如何分解问题,以便我们可以一起解决它?我将如何与这个人进行结对编程?

For example, when building a markdown editor in Next.js, we could write a comment like this
例如,在 Next.js 中构建 Markdown 编辑器时,我们可以编写这样的注释

/*
Create a basic markdown editor in Next.js with the following features:
在 Next.js 中创建一个基本的 Markdown 编辑器,具有以下功能:
- Use react hooks - Create state for markdown with default text "type markdown here"
- 使用反应钩子 - 使用默认文本“在此处键入 markdown”创建 markdown 状态
- A text area where users can write markdown
- 用户可以在其中编写 Markdown 的文本区域
- Show a live preview of the markdown text as I type
- 在我输入时显示 Markdown 文本的实时预览
- Support for basic markdown syntax like headers, bold, italics
- 支持基本的 Markdown 语法,如标题、粗体、斜体
- Use React markdown npm package
- 使用 React markdown npm 包
- The markdown text and resulting HTML should be saved in the component's state and updated in real time
- Markdown 文本和生成的 HTML 应保存在组件的状态中并实时更新
*/


What it is 这是什么
The purpose is to continuously share tips, good examples and relevant information to help all team members get better at using GitHub Copilot.
目的是不断分享技巧、好的示例和相关信息,以帮助所有团队成员更好地使用 GitHub Copilot。

Call for contribution 呼吁贡献
If you have any great examples or knowledge to share, please feel free to reply to the mail (Do not reply all). Your contribution is greatly appreciated.
如果您有任何好的例子或知识可以分享,请随时回复邮件(不要全部回复)。非常感谢您的贡献。

Give your feedback 提供您的反馈
If you find any of the tips helpful, please give the mail a thumbs-up. We'll focus more on the popular ones for future follow-ups based on your reaction. And if you have any other feedback, feel free to reply to the mail (Do not reply all).
如果您发现任何提示有帮助,请给邮件点赞。我们将根据您的反应更加关注热门的后续跟进。如果您有任何其他反馈,请随时回复邮件(请勿全部回复)。

All history sharing can be found at M365 GitHub Copilot Sharing - Newsletters (office.com).
所有历史记录共享均可在 M365 GitHub Copilot 共享 - Newsletters (office.com) 中找到。
Comments 评论
QY
Add a comment