做人流挂什么科| 局部皮肤瘙痒什么原因| 猫的眼睛晚上为什么会发光| 低烧是什么原因| 漏蛋白是什么原因造成的| ahc属于什么档次| 孟子姓什么| 更年期出汗吃什么药好| 脂蛋白a高有什么危害| 嗜睡乏力没精神容易疲劳是什么原因| 人为什么会生病| 米肉是什么| 女生吃木瓜有什么好处| 血管堵塞吃什么好疏通| 喉咙有异物感挂什么科| 奸诈是什么意思| 正畸和矫正有什么区别| 世界上最小的动物是什么| 工字五行属什么| 栀子黄是什么| vibe什么意思| 营养心脏最好的药是什么药| 注意力不集中是什么原因| bv是什么意思| 伊朗是什么派| 肝血不足吃什么补最快| 7月1日是什么节日| 葡萄什么季节成熟| 软化血管吃什么药最好| 11月17是什么星座| 血脂高吃什么药效果好| 鹦鹉可以吃什么| 去医院看痘痘挂什么科| 毕业答辩是什么| 肠胃不舒服吃什么药| 唇腺活检主要是看什么| 子宫占位是什么意思| 贞操是什么| 挂面是什么面| hr是什么品牌| 右手指发麻是什么原因| 口酸是什么原因| 什么时候种胡萝卜最好| 为什么头顶会痛| 为什么会晨勃| 婴儿流鼻涕吃什么药| 情定三生大结局是什么| 未曾谋面什么意思| 代血浆又叫什么| 梦见头发白了是什么意思| 梦见大白蛇是什么预兆| 天气热吃什么解暑| 念珠菌感染用什么药| 猪头肉炒什么好吃| 眼角发白是什么原因| 黄瓜有什么好处| 尿淀粉酶高是什么原因| 此言念什么| 下肢肿胀是什么原因| mrcp检查是什么意思| 摇粒绒是什么面料| 什么笑组词| 大好河山是什么生肖| 什么食物黄体酮含量高| 梦到大牙掉了一颗是什么意思| 黄瓜为什么是苦的| 沙茶酱是什么做的| 超声科检查什么| 为的笔顺是什么| 医生为什么看瞳孔知道没救了| 胸闷气短吃什么药疗效比较好| 生肖龙和什么生肖相冲| 头皮长疙瘩是什么原因| 妇炎康片主要治什么妇科病| 尿酸高有什么反应| 小孩为什么会细菌感染| 6月是什么星座| 真菌孢子是什么| 小便尿色黄是什么问题| 什么叫欲擒故纵| 螳螂吃什么食物| 嗓子哑吃什么药| 疤痕体质是什么| 小女子这厢有礼了什么意思| ga是什么意思| 嘴角上扬是什么意思| 男性生殖痒是什么原因| 乙肝大三阳是什么意思| lca是什么意思| 什么药降肌酐| 嗪读什么| 琴棋书画指的是什么| 眼睛突然红了是什么原因| 什么人容易得格林巴利| 理疗和按摩有什么区别| 肺气虚吃什么中成药| 5月3日是什么星座| 舌根发麻是什么原因| 非什么意思| 龙虾不能和什么一起吃| 鼻子无故出血什么原因| 塑形是什么| 心悸是什么意思| ras医学上是什么意思| 上半身胖属于什么体质| 脾胃虚寒是什么症状| 破窗效应是什么意思| 1967年出生属什么| 大便不调是什么意思| 手指关节痛吃什么药好| 梦见挖坟墓预示什么| 一什么公园| 排卵期什么时候开始| 脑淤血是什么原因引起的| 塔罗牌是什么| eeg是什么意思| 灼热感是什么样的感觉| 纳帕皮是什么皮| 茯苓有什么功效| 虫草什么时间吃最好| 酵母提取物是什么| 同房后小腹疼痛是什么原因| 什么是有机蔬菜| 黑油是什么油| 骨质硬化是什么意思| 痔疮是什么引起的| 气胸是什么意思| 什么叫眼睛散光| baron是什么意思| 冷暖自知是什么意思| 后脑勺白头发多是什么原因| 为什么会得炎症| 佩戴貔貅有什么讲究与禁忌| 结膜炎用什么眼药水效果好| 贝母和川贝有什么区别| 什么补血补气最好最快| 零七年属什么生肖| 胸片能查出什么| 好记性不如烂笔头是什么意思| 怀孕40天有什么症状| 增加免疫力吃什么| 头皮发痒是什么原因引起的| 侧记是什么意思| 药品经营与管理学什么| 大爱什么意思| 非均匀性脂肪肝是什么意思| 土龙是什么| ards是什么病| 体外射精是什么| 讽刺是什么意思| 抚今追昔的意思是什么| 蓝黑色是什么颜色| 胃泌素17是什么检查| 脾虚吃什么好的最快| 芙蓉是什么花| 请柬写伉俪什么意思| 耳朵一直痒是什么原因| 什么好| 女性割礼是什么| 发烧应该挂什么科| 大运正官是什么意思| 伏地魔什么意思| 小仙女什么意思| 六月二七是什么星座| 蚕豆有什么营养| mt是什么意思| 肌钙蛋白低说明什么| 可以组什么词语| 晚上总是做梦是什么原因引起的| 为什么叫黄瓜| 水晶眼镜对眼睛有什么好处| 什么时候喝咖啡最好| ac疫苗是预防什么的| 世界上最软的东西是什么| 铮铮是什么意思| 有偿服务是什么意思| 财主是什么意思| 神经性耳鸣有什么症状| 中国民间为什么要吃腊八粥| 慢性非萎缩性胃炎吃什么药| 什么水果利尿效果最好| 肝多发钙化灶什么意思| choker是什么意思| 一什么村庄| 95年的属什么生肖| 什么的流着| dm是什么意思| parzin眼镜是什么牌子| 什么地照着| 过敏性鼻炎有什么症状| 龙代表什么象征意义| 梦见找鞋子是什么意思| phoenix是什么牌子| 六味地黄丸是治什么的| abob白色药片是什么药| b超能检查出什么| 暄字五行属什么| 婴儿长牙有什么症状| 老鼠长什么样| 什么的蜡烛| 马凡氏综合症是什么病| 前戏是什么意思| 中药学是什么| 甘胆酸是查什么的| 喉咙干燥是什么原因| 两肋插刀是什么意思| 弥漫性肝病是什么意思| 病毒是什么生物| 什么是隐血| 异化是什么意思| 加湿器有什么作用| 术后吃什么水果| 男人眉骨高代表什么| 中耳炎用什么药最好| 什么叫石女| 咖啡伴侣是什么东西| 乙肝125阳性是什么意思| 小腹痛吃什么药| 谭震林是什么军衔| 五月二十六是什么星座| 早起眼皮肿是什么原因引起的| 40gp是什么意思| 子宫肌瘤吃什么药| 避孕套是什么| 人和是什么意思| 胰腺在人体起什么作用| 狗狗哭了代表什么预兆| 银手镯变黑是什么原因| 双侧骶髂关节致密性骨炎是什么病| 猫头鹰属于什么科| 姑爹是什么意思| 清明节有什么习俗| 伤口感染化脓用什么药| 潦倒是什么意思| 偶尔头疼是什么原因| 中国特工组织叫什么| 力挽狂澜是什么意思| 吃豆角中毒什么症状| 市政协主席是什么级别| 昊是什么意思| 88什么意思| 贝兄念什么| 什么叫中位数| 盲从什么意思| 检查膀胱挂什么科| 手麻是什么病的前兆| 预祝是什么意思| 成人男性尿床是什么原因造成的| 右边肋骨疼是什么原因| 亦女念什么| 阳痿什么意思| 孕妇肚子疼是什么原因| 身体冒虚汗什么原因| 低聚木糖是什么| 女人的逼长什么样| 散光什么意思| 11.20是什么星座| 树叶又什么又什么| 孩子白细胞高是什么原因| 先天性聋哑病属于什么遗传病| 口力念什么| rst是什么意思| 飞机什么时候停止登机| 咳嗽发烧吃什么药| 百度

Try to extend agent mode in VS Code!

花语城2-3#,2-7#,2-11#,2-13#,2-14#,3-3#,3-4#,3.

百度 所有党员、干部都要戒贪止欲、克己奉公,切实把人民赋予的权力用来造福于人民。

Visual Studio Code has rich AI features powered by GitHub. In this tutorial, you discover how to use AI while coding in the editor, to ask questions about your code, and to start an editing session to make changes across multiple files.

While we're using JavaScript and TypeScript for this tutorial, note that Copilot is also trained on numerous other languages and a wide variety of frameworks.

Prerequisites

  • VS Code installed on your machine. Download it from the Visual Studio Code website.

  • Access to GitHub Copilot. Follow these steps to Set up GitHub Copilot in VS Code.

    Tip

    If you don't have a Copilot subscription or have a seat assigned by your organization, you can sign up to use Copilot for free directly from within VS Code and get a monthly limit of completions and chat interactions.

Get your first code suggestion

To get started with AI features in VS Code, you don't have to do anything special. As you're typing code in the editor, Copilot automatically presents you code suggestions (code completions) in the editor to help you code more efficiently.

  1. Open VS Code and create a new JavaScript file calculator.js.

  2. In the JavaScript file, start typing the following code:

    class Calculator
    

    Notice that as you type, you automatically get code suggestions for the implementation of the Calculator class in gray dimmed text (ghost text). The exact suggestions you receive might vary because large language models are non-deterministic.

    Screenshot of VS Code editor, showing Copilot suggesting the  method inside the  class.

  3. To accept the suggestion, press the Tab key.

    Congratulations! You've just accepted your first AI-powered code suggestion. As you continue typing, Copilot updates the code suggestion accordingly.

  4. For any given input, there might be multiple suggestions. Type the following code inside the class to add a factorial method:

    factorial(n) {
    
  5. Hover over the suggestion in the editor and notice that there are multiple suggestions.

    Screenshot of VS Code editor, showing Copilot giving multiple suggestions for  when hovering over it.

    You can use the arrow controls or use the keyboard shortcuts to show the next (?] (Windows, Linux Alt+])) or previous (?[ (Windows, Linux Alt+[)) suggestion.

AI-powered code completions can help you with generating boilerplate or repetitive code, letting you stay in the developer flow and focus on more complex coding tasks.

Use editor inline chat to generate a basic web server

With chat-based AI, you can use natural language to ask questions about your code or to ask it to generate code for you. Editor inline chat provides a chat interface directly in the editor, so you can prompt about the code in the active editor.

Let's use editor inline chat to help generate a basic Express web server.

  1. First, add a new TypeScript file server.ts to your workspace.

  2. Now, press ?I (Windows, Linux Ctrl+I) on your keyboard to bring up editor inline chat.

    Editor inline chat gives you a chat interface that lets you ask questions about the code in the active editor or generate code for you.

    Screenshot of VS Code editor, showing the Copilot Inline Chat control.

  3. Type "add a simple express web server" in the chat input field, and press Enter to submit the prompt.

    Notice that the code changes start streaming directly in the editor. The response is an implementation for a simple Node.js Express web server.

    Screenshot of VS Code editor, showing the inline chat response for adding an Express web server.

  4. Select Accept or press ?Enter (Windows, Linux Ctrl+Enter) to apply the proposed code changes.

    Congratulations! You've used editor inline chat for generating code using chat and natural language.

Refactor your code through AI chat

You can also use editor inline chat to refactor or improve existing code in the editor.

Notice that the generated web server is currently using a static port number 3000. Let's change this to use an environment variable instead.

  1. In the editor, select the 3000 port number in the server.ts file, and then press ?I (Windows, Linux Ctrl+I) to open inline chat.

  2. Type "use an environment variable for the port number" in the chat input field, and press Enter to send the chat request or prompt.

    Notice how the existing code is updated to use an environment variable for the port number.

    Screenshot of VS Code editor, showing editor inline chat to use an environment variable for the port number.

  3. Select Accept or press ?Enter (Windows, Linux Ctrl+Enter) to apply the proposed code changes.

  4. If you're not happy with a proposed change, you can modify the prompt and keep iterating to get a different solution. For example, ask to use a different environment variable name for the port number.

Use chat for general programming questions

As you're working in a new codebase, or exploring a new programming language, you might have more general coding questions come up. By using chat, you can have a chat conversation on the side, which keeps track of the history of your questions.

  1. Open the Chat view from the Copilot menu in the title bar or press ??I (Windows, Linux Ctrl+Alt+I).

    Screenshot of the VS Code editor, showing the Copilot menu, highlighting the Open Chat option.

  2. You can use chat in different ways. Select Ask from the mode dropdown to ask questions.

    In a later step, you'll use chat to start an editing session and make changes across multiple files.

    Screenshot of the Chat view, highlighting the dropdown to to change the chat mode to 'Ask'.

    Tip

    You can change the language model that is used in chat by choosing a different model from the dropdown.

  3. Type "what is recursion?" in the chat input field and press Enter to submit your chat prompt.

    Notice how the chat response contains rich results like Markdown text and code blocks.

    Screenshot of VS Code editor, showing the Chat view containing the answer to what recursion is.

  4. Follow the steps in the Chat Tutorial to learn how you can also use chat to ask questions about your specific codebase.

Make edits across multiple files

For larger code changes that might involve making edits to multiple files, you can start an AI-powered editing session. Instead of receiving code blocks in the Chat view, the edits are applied directly to your files across your workspace.

Let's start an editing session to return the contents of an HTML file for our web server.

  1. Select Edit from the mode dropdown in the Chat view.

    Screenshot of the Chat view, highlighting the dropdown to to change the chat mode to 'Edit'

  2. Notice that the server.ts file is automatically added as context for your chat prompt.

    By adding the file as context to your prompt, the AI model can provide more relevant code edits. Optionally, add more context to your prompt with the Add Context button.

    Screenshot of the Chat view, showing the prompt input field with the  file.

  3. Enter Return a static html page as the home page and implement it. in the chat input field and press Enter to start a new edit session.

    Notice that multiple edits are applied to your project: the server.ts file now returns the newly created index.html HTML page.

    Screenshot of VS Code editor, showing the chat response for returning a static HTML page in the web server response.

  4. If you're happy with the results, select Keep to apply all suggested changes.

    You can also navigate between the different edited files and accept or reject them by using the editor overlay controls.

    Screenshot of the Chat view, highlighting the Keep button to apply the changes and the editor overlay controls.

Fix coding errors with AI

Aside from inline suggestions and chat conversations, AI features are available in different areas throughout your developer flow in VS Code. You might notice the presence of AI functionality through the sparkle icon in the VS Code user interface.

One such place is the editor, whenever there's a red squiggle due to a compiler error. Let's use AI to fix a coding error.

  1. Open the server.ts TypeScript file that you created earlier in the editor.

    Notice that the import express from 'express'; statement contains a red squiggle. If you put the cursor on the red squiggle, you can see the sparkle icon appear.

    Screenshot of VS Code editor, showing the Copilot sparkle because of an error with the express import statement.

  2. Select the sparkle icon to view the AI Code Actions, and then select Fix using Copilot.

    Screenshot of VS Code editor, showing the Copilot code actions, highlighting .

  3. Notice that editor inline chat comes up, prepopulated with the error message, and a solution to fix the problem.

    Screenshot of VS Code editor, showing the Copilot Inline Chat proposing to install the express npm package to solve the problem.

    Directly from the chat response, you can optionally select the Insert into Terminal button to copy the proposed command in your terminal.

Next steps

Congratulations, you've now used AI to enhance your coding! In this tutorial, you successfully used AI features in VS Code to get code completions in the editor, and used chat to ask questions and generate code edits.

多发纳氏囊肿是什么意思 咖啡因是什么 指甲凹陷是什么原因引起的 2r是什么意思 得济是什么意思
牙疼吃什么药管用 感冒虚弱吃什么食物好 人流前需要检查什么项目 西布曲明是什么 sunglasses是什么意思
成都市花是什么花 频繁打嗝是什么原因 变态反应是什么意思 两极分化是什么意思 打蛋白针有什么作用
黄芪喝多了有什么副作用 一什么花生 有结石不能吃什么东西 16岁上什么年级 多发纳氏囊肿是什么意思
什么药能治痛风hcv8jop6ns7r.cn 0m是什么意思imcecn.com 小孩做ct对身体有什么影响hcv8jop6ns9r.cn 年轮是什么意思hcv8jop4ns2r.cn 女人什么时候最容易怀孕hcv9jop1ns1r.cn
望梅止渴的梅是什么梅hcv8jop2ns4r.cn 鸡飞狗跳是什么生肖inbungee.com 苦涩是什么意思hcv7jop7ns1r.cn 成人改名字需要什么手续hcv8jop5ns1r.cn 常规血检能查出什么hcv7jop5ns1r.cn
狐臭的味道像什么味道bjhyzcsm.com 公立医院和私立医院有什么区别hcv8jop2ns3r.cn 戒指戴在食指什么意思hcv8jop4ns1r.cn 高血压是什么原因造成的hcv8jop3ns3r.cn 硬卧是什么样子的hcv8jop2ns6r.cn
怀孕不可以吃什么东西shenchushe.com 膀胱充盈欠佳是什么意思hcv9jop0ns2r.cn 女属猪的和什么属相最配cj623037.com 又热又冷是什么原因hcv8jop8ns6r.cn 结核抗体弱阳性什么意思hcv9jop0ns6r.cn
百度