准备好了吗?下载 GitHub Copilot app,启动会话,并在 VS 代码中打开。
如何在 VS 代码中继续 GitHub Copilot 应用会话
学习如何将 agent 会话从 GitHub Copilot app 移动到 VS 代码,而不失去对话,代码更改,或工作上下文。
agent完成了你大部分的改变。 现在你想检查一个执行细节,手动调整几条线,并在你发货之前就在当地运行项目。
但工作在GitHub Copilot应用中。.. 你的编辑器是用来审查diffs,调试代码和进行最后调整的。 您必须选择在会话中停留到开始使用Visual Studio代码吗?
你没有。 您可以在 VS 代码中直接打开 Copilot 应用会话,并继续其对话,代码更改,并保持工作环境完整。 这意味着Copilot可以处理重复的或耗时的工作,然后手控回给你进行更仔细的审查,亲自编辑,以及本地测试。
在这个教程中,你会学会如何:
- 在 VS 代码中打开 Copilot 应用会话。
- 逐行审查 agent 的更改线。
- 继续你编辑的谈话
- 修改和测试本地代码。
- 将您更新到与会话相关的拉动请求中。
1. 从 Copilot app 的会话开始
打开要继续的会话。 发售前,请花点时间审查任务,Copilot工作完成。
一个会话包含不止一个修改文件的集合。 它还记录了任务,计划和产生这些变化的对话。 在你想了解Copilot为何选择具体执行或要求它修改部分工作时,这种背景是重要的。
在移动到 VS 代码之前,您不需要归纳历史或将其复制到一个新的聊天中。
2. 以VS码打开会话
从会话中选择以 VS 代码打开。 如果应用程序呈现一个以上支持的编辑器或 VS 代码安装,请选择您想要使用的编辑器。
VS代码使用与会话相关的工作树打开项目。 它还以 Copilot 侧边栏显示现有的会话。
这给你三个连接的原作品:
- 会议背景:任务、计划和对话仍然可用。
- diff:agent更改的文件和行已准备审查。
- 工作树:VS代码打开与会议使用的隔离工作树相同的。
您正在继续现有的会话,而不是在新的编辑窗口中重建它。
3. 审查agent的变化
在编辑前,检查VS代码中的diff. 打开源控视图查看已修改的文件,然后选择一个文件来逐行审查其更改行。
以任何其他提议的方式审查执行情况。 特别是,请检查:
- 代码解决了请求的问题。
- 执行存放处的公约。
- 错误状态和边缘情况得到适当处理。
- 测试涵盖了改变的行为。
- 没有修改无关的文件或行为。
保存下来的对话可以帮助解释Copilot是如何到达执行的。 如果某事不明,请继续提示Copilot在侧边栏。 例如:
解释为什么您更改了此函数而不是添加新的帮助。 找出任何可能影响的行为。
也可以要求Copilot再做一次更改。 由于会话和工作树保持连接,您不必从一开始就描述任务。
4. 进行实际编辑
一旦理解了提议的修改,就直接编辑VS代码中的任何文件。
这对于手动更快或更容易进行的调整是有用的,例如:
- 修改标签或错误信息。
- 重新命名一个变量以明确。
- 调整布局或样式。
- 增加一个缺失的测试案例。
- 适用特定存放处公约。
您正在编辑会话中已有的工作树,因此您的手动修改直接基于 agent 的工作。 您不需要在目录之间复制文件或手动重建分支。
5. 在当地运行和核实项目
使用VS代码集成终端运行项目正常的验证工作流程。 确切的命令取决于寄存器,但一些网络应用实例可能包括:
- npm 安装
- npm测试
- Npm运行 lint
- npm运行dev
处理 agent 生成的更改,与你处理一个人所写代码的方式相同:运行相关的测试,检查失败,并验证自己的行为。
如果开发服务器打印一个本地主机 URL,请打开它测试浏览器中的更改。 当得到您的 VS 代码设置的支持时,您可以在 VS 代码的集成浏览器中打开 URL,并在不离开编辑器的情况下检查结果。
对于用户界面的更改,验证要求的行为和附近的状态。 例如,以不同的视图大小检查修改的组件,确认加载,空,错误状态仍然有效。
6. 继续Copilot或继续自己编辑
无论何时,你都可以选择最适合下一步的交互:
- 当更改需要全库分析或重复编辑时,请提示Copilot。
- 知道具体变化后直接编辑
- 在测试和完善执行时反复使用这两种方法。
例如,在进行手动UI调整后,您可能会询问 Copilot:
为更新的标签添加一个测试,并运行相关的测试文件。 不修改不相关的组件。
Copilot保留解释“更新标签”所需的上下文
7. 提出和推动已完成的修改
执行完毕后,再审查一次最后版本。 然后使用源控视图或集成终端执行和推动修改:
- 状态
- 加点
- git 承诺 - m "参考会话变化"
- 推车
使用您的存储处的正常分支、 承诺、 审查和批准程序。 因为VS代码打开了与会话相关的工作树和分支,推动分支更新了已经跟踪该工作的拉动请求。
不需要将完成的文件复制到另一个检出或将工作与拉动请求重新连接。
从 agent 到编辑器的连续工作流程
在 VS 代码中打开 Copilot 应用程序会给你一个干净的分工,而不分割工作本身。 Copilot可以承担更大的或重复的执行,同时可以移动到编辑器中进行详细的审查,定向修改,局部测试,以及最终抛光。
会话,diff,和工作树移动与你。 开始在 Copilot app 中引导工作,每当需要手动控制时切换到 VS 代码,并通过相同的拉动请求工作流程将完成的结果推动。
标记:
编剧:
有关员额
GitHub的秘密探测模式:用较少的噪音寻找更多的秘密
GitHub的上下文知密分类器提高了检测质量,融资加权接受率为11.5%,将中位扫描执行时间缩短了86%.
初学者的 GitHub Copilot 应用程序:如何向 Copilot 教授您的代码库
学习如何在您的仓库中添加自定义指令和技能,使用自定义的agents,并连接像Playwright这样的MCP服务器。
秘密保护必须用软件缩放
开发者不会越发粗心,让开发者创造更多软件的工具也应该承担更多保护软件的工作。
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
Ready to try it? Download the GitHub Copilot app, start a session, and open it in VS Code when you are ready to continue coding.
How to continue a GitHub Copilot app session in VS Code
Learn how to move an agent session from the GitHub Copilot app into VS Code without losing the conversation, code changes, or working context.
The agent has finished the bulk of your change. Now you want to inspect one implementation detail, adjust a few lines by hand, and run the project locally before you ship it.
But the work is sitting in the GitHub Copilot app… and your editor is where you review diffs, debug code, and make final adjustments. Do you have to choose between staying in the session and starting over in Visual Studio Code?
You don’t. You can open the Copilot app session directly in VS Code and continue with its conversation, code changes, and working context intact. That means Copilot can handle the repetitive or time-consuming work, then hand control back to you for closer review, hands-on editing, and local testing.
In this tutorial, you’ll learn how to:
- Open a Copilot app session in VS Code.
- Review the agent’s changes line by line.
- Continue the same conversation from your editor.
- Modify and test the code locally.
- Push your updates to the pull request associated with the session.
1. Start with a session in the Copilot app
Open the session you want to continue. Before handing it off, take a moment to review the task and the work Copilot completed.
A session contains more than a collection of modified files. It also records the task, the plan, and the conversation that produced those changes. That context is important when you want to understand why Copilot chose a particular implementation or ask it to revise part of the work.
You do not need to summarize that history or copy it into a new chat before moving to VS Code.
2. Open the session in VS Code
From the session, select Open in VS Code. If the app presents more than one supported editor or VS Code installation, choose the one you want to use.
VS Code opens the project using the worktree associated with the session. It also displays the existing session in the Copilot sidebar.
That gives you three connected pieces of the original work:
- The session context: The task, plan, and conversation remain available.
- The diff: The files and lines changed by the agent are ready for review.
- The worktree: VS Code opens the same isolated working tree the session used.
You are continuing the existing session, not reconstructing it in a new editor window.
3. Review the agent’s changes
Before editing, inspect the diff in VS Code. Open the Source Control view to see the changed files, then select a file to review its changes line by line.
Review the implementation as you would any other proposed change. In particular, check that:
- The code solves the requested problem.
- The implementation follows the repository’s conventions.
- Error states and edge cases are handled appropriately.
- Tests cover the behavior that changed.
- No unrelated files or behaviors were modified.
The preserved conversation can help explain how Copilot arrived at the implementation. If something is unclear, continue prompting Copilot in the sidebar. For example:
Explain why you changed this function instead of adding a new helper. Identify any behavior this could affect.
You can also ask Copilot to make another change. Because the session and worktree remain connected, you do not have to describe the task from the beginning.
4. Make a hands-on edit
Once you understand the proposed changes, edit any file directly in VS Code.
This is useful for adjustments that are faster or easier to make by hand, such as:
- Refining a label or error message.
- Renaming a variable for clarity.
- Adjusting layout or styling.
- Adding a missing test case.
- Applying a repository-specific convention.
You are editing the session’s existing worktree, so your manual changes build directly on the agent’s work. You do not need to copy files between directories or manually re-create the branch.
5. Run and verify the project locally
Use the VS Code integrated terminal to run the project’s normal validation workflow. The exact commands depend on the repository, but some web app examples may include:
- npm install
- npm test
- npm run lint
- npm run dev
Treat agent-generated changes the same way you would treat code written by a person: run the relevant tests, inspect failures, and verify the behavior yourself.
If the development server prints a localhost URL, open it to test the change in a browser. When supported by your VS Code setup, you can open the URL in VS Code’s integrated browser and inspect the result without leaving the editor.
For a user-interface change, verify both the requested behavior and nearby states. For example, check the modified component at different viewport sizes and confirm that loading, empty, and error states still work.
6. Continue with Copilot or keep editing yourself
At any point, you can choose the interaction that best fits the next step:
- Prompt Copilot when the change requires repository-wide analysis or repetitive edits.
- Edit directly when you know the exact change you want.
- Use both approaches iteratively as you test and refine the implementation.
For example, after making a manual UI adjustment, you might ask Copilot:
Add a test for the updated label and run the relevant test file. Do not modify unrelated components.
Because you are still in the original session, Copilot retains the context needed to interpret “the updated label.”
7. Commit and push the finished changes
When the implementation is ready, review the final diff one more time. Then commit and push the changes using the Source Control view or the integrated terminal:
- git status
- git add
- git commit -m "Refine session changes"
- git push
Use your repository’s normal branch, commit, review, and approval practices. Because VS Code opened the worktree and branch associated with the session, pushing the branch updates the pull request already tracking that work.
There is no need to copy the finished files into another checkout or reconnect the work to the pull request manually.
A continuous workflow from agent to editor
Opening a Copilot app session in VS Code gives you a clean division of labor without splitting the work itself. Copilot can take on a larger or repetitive implementation, while you can move into the editor for detailed review, targeted changes, local testing, and final polish.
The session, diff, and worktree move with you. Start by directing the work in the Copilot app, switch to VS Code whenever you want hands-on control, and push the finished result through the same pull request workflow.
Tags:
Written by
Related posts
GitHub’s model for secret detection: Finding more secrets with less noise
GitHub’s context-aware secret classifier improves detection quality, raises weighted acceptance by 11.5%, and reduces median scan execution time by 86%.
GitHub Copilot app for Beginners: How to teach Copilot about your codebase
Learn how to add custom instructions and skills to your repository, use custom agents, and connect MCP servers like Playwright.
Secret protection must scale with software
Developers aren’t becoming more careless; they’re being outpaced. The tools that let developers create more software should also take on more of the work of protecting it.
Auto-fetched and translated by AI Atlas. All rights belong to the original author.