Files
vscode/extensions/copilot
ae0e51e824 nes: fix: NES cached suggestion not shown after rebasing over user indentation (#326537)
* Fix NES cached suggestion not shown after rebasing over user indentation

When a cached NES suggestion is a line-based insertion that restates the
line's indentation (e.g. predicting "    return [" on an empty body line)
and the user tabs to indent that line, tryRebaseCacheEntry served the raw,
non-minimized edit whose range spans the indentation the user already
typed. That edit is not a clean at-cursor insertion, so the core
inline-completions renderer drops it and the cached suggestion is silently
not shown.

Minimize the served rebased edit via removeCommonSuffixAndPrefix so the
indentation the user already typed is stripped, yielding a clean at-cursor
insertion that renders as ghost text. This is semantically neutral (same
apply() result on the current document) and idempotent for the downstream
isRejectedNextEdit check. Minimizing is done at the cache serving layer
rather than in editRebase, which intentionally keeps the full line edit for
response/telemetry fidelity.

Adds a regression test covering the empty-line + tab scenario.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 02c9dab3-1534-4b24-86c1-410c66e9d550

* Salvage NES suggestion on rebaseFailed for indentation mismatch

The previous commit minimized the served edit in the rebase *success*
branch, but that path already renders as ghost text, so the change was a
semantic no-op and its test modeled an artificial success path.

The real bug is in the rebase *failure* path: strict rebase matches
indentation literally, so when the user re-types a line's leading
whitespace differently than the model predicted (e.g. pressing Tab to
insert a tab character, or a different number of spaces, on an empty body
line), the whole suggestion is silently dropped and nothing is shown.

Salvage that case in the cache layer: on `rebaseFailed`, re-anchor the
model's still-valid content as a clean at-cursor insertion that respects
the indentation the user actually typed. This mirrors the reconciliation
the engine already performs when the indentation matches, is a faithful
representation of the model's intent (so it upholds the display layer's
soundness invariant), and only fires when the suggestion would otherwise
be dropped.

Revert the no-op minimization and replace the misleading regression test
with a faithful one covering the tab-character drop scenario (which fails
without this salvage).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 02c9dab3-1534-4b24-86c1-410c66e9d550

* Gate NES indentation-mismatch salvage behind a setting

Put the rebaseFailed re-anchoring behavior behind a new team-internal,
experiment-based setting `chat.advanced.inlineEdits.reanchorContentOnIndentationMismatch`
(default off) so it can be rolled out or disabled independently.

Thread the flag through `NesRebaseConfigs` (built in `_getNesRebaseConfigs`)
and gate the `tryReanchorContentAfterIndentation` salvage call on it. Add a
regression test asserting the suggestion is dropped when the setting is
disabled, alongside the existing salvage test with it enabled.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 02c9dab3-1534-4b24-86c1-410c66e9d550

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-07-20 16:24:20 +05:00
..
2026-07-14 12:34:04 +02:00
2026-07-12 20:30:31 +00:00
2026-07-20 10:04:21 +00:00

GitHub Copilot - Your autonomous AI peer programmer

GitHub Copilot is an AI peer programming tool that transforms how you write code in Visual Studio Code.

GitHub Copilot agents handle complete coding tasks end-to-end, autonomously planning work, editing files, running commands, and self-correcting when they hit errors. You can also leverage inline suggestions for quick coding assistance and inline chat for precise, focused edits directly in the editor.

Sign up for GitHub Copilot Free!

Working with GitHub Copilot agent mode to make edits to code in your workspace

Getting access to GitHub Copilot

Sign up for GitHub Copilot Free, or request access from your enterprise admin.

To access GitHub Copilot, an active GitHub Copilot subscription is required. You can read more about our business and individual offerings at github.com/features/copilot.

Build with autonomous agents

Let AI agents implement complex features end-to-end. Give an agent a high-level task and it breaks the work into steps, edits multiple files, runs terminal commands, and self-corrects when it hits errors or failing tests. Agents excel at building new features, debugging and fixing failing tests, refactoring codebases, and collaborating via pull requests.

Manage sessions from a central view. Run multiple agent sessions in parallel and track them in one place. Monitor session status, switch between active work, review file changes, and resume where you left off.

Run agents with your preferred harness. Use agents locally in VS Code, in the background via Copilot CLI, or Cloud via Copilot Coding Agent. You can also work with providers like Claude and Codex, and hand tasks off between agent types with context preserved all within the VS Code.

Video showing an agent session building a complete feature in VS Code.

Use agents to plan before you build with the Plan agent, which breaks tasks into structured implementation plans and asks clarifying questions. When your plan is ready, hand it off to an implementation agent to execute it. You can also delegate tasks to cloud agents that create branches, implement changes, and open pull requests for your team to review.

More ways to code with AI

Receive intelligent inline suggestions as you type with ghost text suggestions and next edit suggestions, helping you write code faster. Copilot predicts your next logical change, and you can accept suggestions with the Tab key.

Video showing Copilot next edit suggestions.

Use inline chat for targeted edits by pressing Ctrl+I/Cmd+I to open a chat prompt directly in the editor. Describe a change and Copilot suggests edits in place for refactoring methods, adding error handling, or explaining complex algorithms without leaving your editor.

Inline chat in VS Code

Customize AI for your workflow

Agents work best when they understand your project's conventions and have the right tools. Tailor Copilot so it generates code that fits your codebase from the start.

Project context. Use custom instructions to specify project-wide or task-specific context and coding guidelines.

Add specialized capabilities. Teach Copilot specialized capabilities with agent skills or define specialized personas with custom agents.

Connect to external tools and services. Extend agents further with tools from MCP servers and extensions to give Copilot a gateway to external data sources, APIs, or specialized tools.

Supported languages and frameworks

GitHub Copilot works on any language, including Java, PHP, Python, JavaScript, Ruby, Go, C#, or C++. Because its been trained on languages in public repositories, it works for most popular languages, libraries and frameworks.

Version compatibility

As Copilot Chat releases in lockstep with VS Code due to its deep UI integration, every new version of Copilot Chat is only compatible with the latest and newest release of VS Code. This means that if you are using an older version of VS Code, you will not be able to use the latest Copilot Chat.

Only the latest Copilot Chat versions will use the latest models provided by the Copilot service, as even minor model upgrades require prompt changes and fixes in the extension.

Privacy and preview terms

By using Copilot Chat you agree to GitHub Copilot chat preview terms. Review the transparency note to understand about usage, limitations and ways to improve Copilot Chat during the technical preview.

Please refer to our Privacy Statement to learn about the data we collect, how we use it, and the controls available to you.

To get the latest security fixes, please use the latest version of the Copilot extension and VS Code.

Resources & next steps

Data and telemetry

The GitHub Copilot Extension for Visual Studio Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. This extension respects the telemetry.telemetryLevel setting which you can learn more about at https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT license.