白癜风是什么| 绿豆汤放什么糖| 七月份有什么节日| ofd是什么意思| 毫发无损是什么意思| kj是什么意思| 肚子咕噜咕噜响是什么原因| 茶叶杀青是什么意思| 绝对值是什么| 高高的什么| 女大十八变是什么意思| 杭州什么宽带好又便宜| 一什么招牌| 做梦梦到老婆出轨是什么意思| 梦见别人理发是什么意思| 掉头发吃什么恢复最快| 低压偏低是什么原因| 退翳什么意思| 水煎是什么意思| 地头蛇比喻什么样的人| 为什么会湿疹| 什么是中性洗涤剂| 23年属什么| 什么样的野花| o什么意思| 滢是什么意思| 尿素氮肌酐比值偏高是什么原因| 小孩吃了就吐是什么原因| 心脏ct能检查出什么| 前辈是什么意思| 四个横念什么| 梦见小孩是什么意思| 带状疱疹不能吃什么东西| 锌过量会引发什么症状| 1946年属什么生肖| 大头菜是什么菜| 富贵包去医院挂什么科| 什么是有机食品和无机食品| 什么争鸣成语| 农业户口和非农业户口有什么区别| 一个巾一个占念什么| 腺样体肥大挂什么科| 蓝营绿营什么意思| 鼹鼠吃什么| 红颜知己是什么意思| 7月10号什么星座| 月经期喝什么汤好| 皮肤发白一块一块的是什么病| 夹腿是什么| 尿微肌酐比值高是什么情况| 静若幽兰什么意思| 阴山是今天的什么地方| 手指麻是什么原因| 眼睛一直眨是什么原因| daily是什么意思| 甲子日是什么意思| 肌张力高有什么症状| 宿便什么意思| 大白刁是什么鱼| 红豆杉是什么植物| 梁下放床有什么禁忌| 素毛肚是什么做的| 剑锋金命五行缺什么| 干红是什么意思| 为什么睡觉会打呼噜| 球菌阳性是什么意思| 脑梗的症状是什么| 黑色的屎是什么原因| 刘秀和刘邦是什么关系| 小猫什么时候可以洗澡| 孕期能吃什么| 黄体酮有什么副作用| 妇炎洁是什么| 什么叫御姐| 胎儿缺氧是什么原因造成的| 六爻小说讲的什么| 海鲜不能和什么一起吃| 头顶出汗是什么原因| 胃不舒服能吃什么水果| 女人吃葛根粉有什么好处| 低密度脂蛋白高吃什么药| 鼻涕带血是什么原因引起的| 有什么有什么的四字词语| 缄默什么意思| 孕期补铁吃什么| 什么不| 婴儿拉肚子是什么原因造成的| 坦诚相待是什么意思| 甘草有什么功效| 牙齿掉了一小块是什么原因| 银屑病为什么会自愈| 孕妇快生了有什么症状| 发福了是什么意思| 小样什么意思| 开窍是什么意思| 娇小是什么意思| 经常嗓子哑是什么原因| 编者按是什么| 菌丝是什么| 什么时候用得| 中产阶级的标准是什么| 梦到捡钱是什么意思| 宫颈cin1级是什么意思| 夏至为什么吃馄饨| 孕妇吃什么容易滑胎| 核糖体由什么组成| 淋巴细胞升高说明什么| 被口什么感觉| 言尽于此是什么意思| 婴儿拉奶瓣是什么原因| 老年人适合喝什么茶| 什么食物含碘| 凭什么我买单| 晚上睡觉阴部外面为什么会痒| 右侧卵巢内囊性回声是什么意思| 王爷是皇上的什么人| 绷不住了是什么意思| 属虎什么命| hp感染是什么意思| 脑供血不足吃什么药最好| 服了是什么意思| pro是什么的缩写| ns是什么意思| 双子后面是什么星座| 什么叫肿瘤| 婴儿采足底血是查什么| 心动过速吃什么药最好| 脑白质脱髓鞘是什么意思| 体温偏高的人说明什么| 靶向治疗是什么意思| 胃功能四项检查是什么| 七月初七是什么生肖| 为什么哭会流鼻涕| 美国为什么要打伊朗| 什么书在书店里买不到| 鸡眼和疣有什么区别| 猪巴皮是什么材质| 一带一路指的是什么| 男友力是什么意思| 什么寒什么冻| 酒糟鼻买什么药膏去红| 双肺多发结节是什么意思| 清肺火肺热吃什么药最有效| 下嘴唇跳动是什么原因| 什么食物嘌呤高| 女性腰疼去医院挂什么科| 秋是什么生肖| 文化是指什么| 打嗝是什么原因| 扁桃体结石是什么原因引起的| 赵本山是什么学历| 哈尔滨有什么好吃的| 痢疾是什么症状| 半夜尿多是什么原因| 七七是什么意思| 女性尿频尿急吃什么药| 什么是风湿病| 太平公主叫什么名字| 养囊是什么意思| 桑葚泡水喝有什么好处| 口角炎吃什么药| 嗓子有黄痰是什么原因| 佛跳墙是什么菜系| 3.22是什么星座| 什么什么大什么| 肾出血是什么原因引起的| 男性霉毒是什么症状| 来月经适合吃什么水果| 美女胸部长什么样| tsh是什么意思| 狗狗中毒了用什么办法可以解毒| 自汗恶风是什么意思| 手脚脱皮是什么原因导致的| 1954年出生属什么| 钝角是什么意思| 巴基斯坦人说什么语言| 遗精是什么原因| 循环利息是什么意思| 上房是什么意思| 蚊子除了吸血还吃什么| 柔式按摩是什么意思| 为什么叫太平间| 麦芽是什么| 匹维溴铵片治什么病| 吃什么可以止咳化痰| 驴血为什么是白色的| 什么是假性高血压| 心口疼是什么原因引起的| 人为什么会脸红| 吃了榴莲不可以吃什么| 左手食指有痣代表什么| 同型半胱氨酸高吃什么| 牛头人什么意思| 便血挂什么科室| 2月9日什么星座| 崎胎瘤是什么| 舌苔厚白吃什么药最好| 穿刺活检能查出肿瘤是什么性质吗| 小舌头学名叫什么| 杳冥是什么意思| 豆蔻是什么| 打喷嚏漏尿是什么原因| 女男是什么字| 达喜是什么药| 凝血四项是查什么的| 依从性是什么意思| 检查骨密度挂什么科| 9年是什么婚| mt指什么| 生抽和酱油有什么区别| 发烧反反复复是什么原因| 萝卜丁口红什么牌子| 吃什么对胰腺好| 画龙点晴是什么生肖| 翡翠的五行属性是什么| 第二天叫什么日| 沙茶是什么| 内向什么意思| 金刚是什么树的种子| 水肿吃什么药| 食道好像有东西堵着是什么原因| 解酒的酶是什么酶| angelababy是什么意思| 早上起床眼睛浮肿是什么原因| 右膝关节退行性变是什么意思| 长春有什么特产| 生活因什么而精彩| 九月份是什么星座| 南昌有什么好玩的| 脚老是抽筋是什么原因| 3岁宝宝流鼻血是什么原因| 菜籽油是什么油| 伊朗说什么语言| 7月一日是什么节| 脱发吃什么药| 印度属于什么亚| 鄙视是什么意思| 头孢长什么样图片| 弥勒佛为什么是未来佛| 微调是什么意思| 检查膝盖挂什么科| 肝内脂质沉积是什么意思| 息斯敏又叫什么药名| 无什么于事| 头顶爱出汗是什么原因| 面瘫有什么症状| 围绝经期吃什么药调理| 因势利导什么意思| 脂肪肝是什么| 痛风吃什么好得快| 高锰酸钾在药店叫什么| 白热化阶段是什么意思| 女人左手心痒预示什么| 盐酸安罗替尼胶囊主要治疗什么| 芃字五行属什么| 十二生肖里为什么没有猫| 外阴红肿瘙痒用什么药| 上皮细胞是什么| 重心是什么| 中指是什么意思| 外阴红肿疼痛用什么药| 为什么脚底板发黄| sjb是什么意思| 黄绿色是什么颜色| 百度

Try to extend agent mode in VS Code!

川酒决胜“发展关键期” 休闲食品“敲门”美好时光

百度   官场“大忽悠”是当今我国政治生活中形式主义的主要表现形式之一。

This article covers tips to write prompts to get better and more relevant responses from Copilot Chat in Visual Studio Code. Prompt engineering or prompt crafting is a common phrase you'll hear when discussing AI and refers to how and what information is packaged and sent to an AI API endpoint.

If you are new to VS Code or GitHub Copilot, you might want to review the GitHub Copilot Overview article first or dive straight into the Getting started tutorial.

There are different options for optimizing your Copilot experience for inline suggestions and chat:

Getting the most out of Copilot inline suggestions

The GitHub Copilot extension presents suggestions automatically to help you code more efficiently. There are things you can do to help ("prompt") Copilot to give you the best possible suggestions. And the good news is that you are probably already doing these right now, since they help you and your colleagues understand your code.

Provide context to Copilot

Copilot works best when it has sufficient context to know what you're doing and what you want help with. Just as you would provide a colleague with the context when asking for help with a specific programming task, you can do the same with Copilot.

Open files

For code completions, Copilot looks at the current and open files in your editor to analyze the context and create appropriate suggestions. Having related files open in VS Code while using Copilot helps set this context and lets the Copilot see a bigger picture of your project.

Top level comment

Just as you would give a brief, high-level introduction to a coworker, a top level comment in the file you're working in can help Copilot understand the overall context of the pieces you are creating.

Appropriate includes and references

It's best to manually set the includes or module references you need for your work. Copilot can make suggestions, but you likely know best what dependencies you need to include. This can also help let Copilot know what frameworks, libraries, and their versions you'd like it to use when crafting suggestions.

In the following TypeScript example, we want to log the output of the add method. When we don't have any includes, Copilot suggests using console.log:

Copilot inline suggestion proposes Console.log when no imports in the file.

On the other hand, when you add a reference to Log4js, Copilot suggests using that framework for logging the output:

Copilot inline suggestion proposes logging using the imported logging framework.

Meaningful function names

Just as a method called fetchData() won't mean much to a coworker (or you after several months), fetchData() won't help Copilot either. Using meaningful function names helps Copilot provide a body that does what you want.

Specific and well-scoped function comments

A function name can only be so descriptive without being overly long. Function comments can help fill in details that Copilot might need to know.

Prime Copilot with sample code

One trick to get Copilot on the right page, is to copy and paste sample code that is close to what you are looking for into your open editor. Providing a small example can help Copilot generate suggestions that match the language and tasks you want to achieve. Once Copilot begins providing you with the code you want and will actually use, you can delete the sample code from the file. This can be especially helpful to jump start Copilot to a newer library version when it defaults to providing older code suggestions.

Be consistent and keep the quality bar high

Copilot is going to latch on to your code to generate suggestions that follow the existing pattern, so the adage "garbage in, garbage out" applies.

Always keeping a high quality bar can take discipline. Especially when you're coding fast and loose to get something working, you might want to disable Copilot completions while in "hacking" mode. You can temporarily disable completions from the Copilot status menu. Bring up the Copilot status menu dropdown by selecting the Copilot Status bar item.

Hover over the Copilot Status bar item displays "Show Copilot status menu"

From the dropdown, you can disable completions entirely, or disable just for the active file type, for example Markdown files.

Copilot Status menu dropdown with Disable Completions selected

Getting the most out of Copilot Chat

You can also get assistance from Copilot via a chat interface by installing the GitHub Copilot Chat extension.

When you're using chat to interact with GitHub Copilot, there are several things you can do to optimize your experience.

Use chat participants and slash commands

Chat participants are designed to collect extra context either about a code base or a specific domain or technology. By using the appropriate participant, the AI can find and provide better information to send to the LLM. For example, use @workspace if you want to ask questions about your open project, or @vscode to know more about VS Code features and APIs.

Asking the @vscode participant how to change the VS Code colors

Slash commands help Copilot Chat understand your intent when you ask a question. Are you learning about a code base (/explain), do you want help with fixing an issue (/fix), or are you creating test cases (/tests)? By letting Copilot Chat know what you're trying to do, it can tune its reply to your task and provide helpful commands, settings, and code snippets.

Inline Chat slash command list

You could write out your project scope or current task with a natural language query but using chat participants and slash commands is more concise and explicit.

Learn more about chat participants and slash commands in Copilot Chat.

Use chat variables for context

Chat participants, such as @workspace or @vscode, can contribute chat variables that provide domain-specific context. You can reference a chat variable in your chat prompt by using the # symbol. By using a chat variable, you can be more specific about the context that you include in your chat prompt.

For example, with #<file name> or #<folder name> you can reference specific files or folders from your workspace in your chat prompt. This helps make the answers from Copilot Chat more relevant to your code by providing context about the file you are working with. You can ask questions like "Can you suggest improvements to #package.json?" or "How do I add an extension in #devcontainer.json?".

You can also add context to your chat message by using the Attach Context button in the Chat view. You can then select the specific type of context from a Quick Pick, such as the current selection, one or more files from the workspace, or one or more symbols from your source code.

Screenshot of VS Code Copilot Chat view, showing the Attach context button and context Quick Pick.

Learn more about using context variables with Copilot Chat.

Be specific and keep it simple

When you ask Copilot to do something, be specific in your ask and break down a large task into separate, smaller tasks. For example, don't ask Copilot to create an Express app, that uses TypeScript and Pug, and that has a products page that retrieves data from a MongoDB database. Instead, first ask Copilot to create the Express app with TypeScript and Pug. Next, ask to add a products page, and finally ask to retrieve the customer data from a database.

When you ask Copilot to do a specific task, be specific about the inputs, outputs, APIs, or frameworks you want to use. The more specific your prompt is, the better the outcome will be. For example, instead of "read product data from the database", use "read all products by category, return the data in JSON format, and use the Mongoose library".

Iterate on your solution

When asking Copilot Chat for help, you aren't stuck with the first response. You can iterate and prompt Copilot to improve the solution. Copilot has both the context of the generated code and also your current conversation.

Here's an example using Inline Chat to create a function to calculate Fibonacci numbers:

First response from Copilot for a function to calculate Fibonacci numbers

Maybe you prefer a solution that doesn't use recursion:

Ask Copilot to not use recursion and new result

You can even ask Copilot to follow coding conventions or improve variable names:

Ask Copilot to use better variable names and new result

Even if you've already accepted a result, you can always ask Copilot to iterate on the code later.

More resources about prompting for Copilot

If you'd like to learn more about productively using GitHub Copilot, you can follow up with these videos and blog posts:

性生活出血是什么原因 卫衣是什么 七月14号是什么星座 茔是什么意思 9.7是什么星座
略什么意思 下午5点多是什么时辰 四季平安是什么生肖 动物的尾巴有什么作用 腹泻可以吃什么食物
预防高原反应吃什么药 花椒什么时候传入中国 榨菜是什么菜做的 女人出虚汗失眠吃什么药 胃酸吃什么药效果最好
水乳是什么 细菌性阴道炎用什么药好 竹荪是什么 右腿麻木是什么原因 低血压有什么症状
iqc是什么意思hcv7jop7ns3r.cn p波增宽什么意思hcv8jop1ns8r.cn 仲夏是什么时候hlguo.com 脱肛是什么原因造成的hcv8jop8ns8r.cn 什么烧肉好吃ff14chat.com
山野是什么意思hcv8jop0ns1r.cn 郁结是什么意思wzqsfys.com 立是什么生肖creativexi.com ckd是什么意思jiuxinfghf.com 梦见被蛇咬了是什么意思hcv9jop7ns4r.cn
一什么家hcv8jop3ns0r.cn 吃红萝卜有什么好处hcv8jop7ns2r.cn 喝荷叶茶有什么好处和坏处hcv8jop4ns0r.cn 主胰管不扩张是什么意思wzqsfys.com 小儿麻痹是什么病hcv9jop6ns0r.cn
潘氏试验阳性说明什么hcv7jop9ns6r.cn 三醋酯纤维是什么面料hcv7jop4ns8r.cn 梦见死人是什么征兆xinmaowt.com 收缩压和舒张压是什么意思hcv8jop1ns0r.cn 狐臭看什么科jiuxinfghf.com
百度