--- title: Visual Studio description: LocalPilot in Visual Studio 2022 and Visual Studio 2026, the local AI coding agent with chat, approvals, edits through the editor with Undo, and right-click Explain and Fix, on Ollama, LM Studio or your own key. permalink: /docs/visual-studio/ keywords: Visual Studio AI agent, Visual Studio 2026 extension, Visual Studio local LLM, Ollama Visual Studio, Copilot alternative Visual Studio, offline AI Visual Studio --- The **LocalPilot** extension for Visual Studio runs the same agent as VS Code and the `localpilot` CLI, with the same tools, skills, rules, memory, MCP servers, providers and settings, in a chat window inside Visual Studio. The extension bundles the CLI and talks to it over the [Agent Client Protocol](acp.md), so nothing else needs installing except Node.js. ## Install You need: - **Visual Studio 2022 version 17.14 or later, or Visual Studio 2026**: Community, Professional or Enterprise, on x64 or Arm64. - **[Node.js](https://nodejs.org/en/download) 18.17 or newer.** The LTS is recommended (22.13 or newer also reads PDFs). Visual Studio Code's own runtime cannot be used for this. - **A model.** For example [Ollama](https://ollama.com) with `ollama pull qwen3:8b`, LM Studio, llama.cpp or vLLM, or a cloud key (OpenAI, Claude, Gemini, OpenRouter, Groq and others). LocalPilot finds local servers on their usual ports. Then install the extension in one of two ways: - **Visual Studio Marketplace.** In Visual Studio, open **Extensions > Manage Extensions**, search for **LocalPilot**, choose **Install** and restart Visual Studio. - **GitHub release.** Download `localpilot-visualstudio-.vsix` from the [latest release](https://github.com/isathish/localpilot/releases/latest), close Visual Studio and double-click the file. ## First run Open a solution or a folder, then **Tools > LocalPilot Chat** (also under **View > Other Windows**). The window docks next to Solution Explorer and starts the agent in the solution's folder. The line at the top shows its state: - **Starting LocalPilot…** while the agent starts. - **LocalPilot 1.x · C:\src\MyApp** (green) when it is ready. - **LocalPilot is not running** (red), with the reason and the agent's last log lines, plus **Restart**. When Node.js is missing or too old, **Download Node.js** opens nodejs.org. The agent's log is in the **Output** window, under **LocalPilot**. Providers and models come from LocalPilot's own settings (see [Settings](#settings)). If you already use LocalPilot in VS Code or the terminal, Visual Studio uses the same servers, keys and default model. ## Chat Type in the box at the bottom and press **Send** (or Ctrl+Enter). The answer streams in as text, with code blocks you can select and copy. Below it you see: - **Thinking**: the model's reasoning, collapsed. Click it to expand. - **Tool calls**: one row each (*Read Program.cs*, *Edit Program.cs*, *$ dotnet build*…) with its status: ○ waiting, ◐ running, ✓ done, ✗ failed. Expand a row for the output, or use **Open** to open its file. - **Plan**: the agent's checklist, above the box, updated as it works. - **Changed files**: every file the agent wrote in this chat, with **Open diff** and **Open**. Below the box: - **Mode**: **Agent** (reads, edits, runs commands), **Ask** (read-only answers), **Plan** (read-only, writes a plan), **Debug** (reproduces a bug and proves the fix) or **Multitask** (splits work across background workers). - **Model**: any model of your providers. It applies to this chat. - **Stop**: ends the current turn (replaces **Send** while the agent works). - **New chat**: starts a new conversation. Chats are saved like CLI sessions, so `localpilot -r` in the solution folder and VS Code's history (marked **CLI**) list them. The window's toolbar repeats **New chat**, **Stop**, **Restart LocalPilot** and **Open LocalPilot Settings**. ## Approvals Nothing is changed without asking. Before an edit, a command, a network call or an MCP tool, an approval card appears in the chat with what the agent wants to do (a diff of the edit, the command line…) and: - **Allow once**: this action only. - **Always for this chat**: this kind of action (edits, commands, network, MCP) for the rest of the chat. Never offered for deletes. - **Deny**: the agent is told you declined and continues without it. **Stop** while a card is open answers it as cancelled. Your organization's LocalPilot policy still applies, and a kind set to `never` in your settings stays refused. To approve everything without asking, add `--yes` to **Extra CLI arguments** (not recommended). ## Edits and Undo The agent reads and writes files through Visual Studio, not behind its back: - **Reads** see your unsaved changes: if a file is open with edits you have not saved, the agent reads the editor's text. - **Writes** go through the editor: the file is opened (unless you turn that off), its text is replaced as one edit and saved. Ctrl+Z in that file undoes the agent's change, and source control, the solution and the Error List see it like any edit. - **New files** are created on disk and opened. - **Open diff** in *Changed files* opens Visual Studio's diff viewer: the file before the agent's first edit in this chat against the file now. Commands the agent runs (`dotnet build`, `dotnet test`, `npm test`…) run in the solution folder on your machine, after your approval. ## Context menu commands Right-click in the editor and open **LocalPilot**, or right-click a file in Solution Explorer: | Command | What it does | |---|---| | **Ask LocalPilot about Selection** (editor) | Attaches the selected lines (or the whole file when nothing is selected) to the chat box as a chip; type your question and send. | | **Explain This File with LocalPilot** | Asks the agent to explain the file and how it fits into the project, without changing anything. | | **Fix Errors in This File with LocalPilot** | Asks the agent to fix the file's errors and warnings. Extensions cannot read the Error List, so the agent builds or type-checks the project to see them, fixes them and builds again to confirm. | | **LocalPilot Chat** | Opens the chat. | ## Settings **Tools > Options > LocalPilot** holds what Visual Studio needs to start the agent: | Setting | Default | What it does | |---|---|---| | **Node.js path** | empty | `node.exe` (or its folder) to run LocalPilot with. Empty: Node.js 18.17 or newer is found on `PATH` and in the usual install folders (nodejs.org installer, nvm-windows, Volta, fnm, Scoop, Chocolatey). | | **Extra CLI arguments** | empty | Added after `--acp`, for example `-m ollama/qwen3:8b`, `--no-mcp`, `--trust-workspace` or `--data-dir D:\lp`. **Restart LocalPilot** to apply. | | **Default mode** | Agent | The mode a new chat starts in. | | **Open edited files in the editor** | on | Edits go through the editor (with Undo) by opening each file the agent changes. Off: files that are not open are written on disk. | Everything else (providers, models, approvals, MCP servers, rules, memory) is LocalPilot's own configuration, shared with the CLI and VS Code. **Tools > Open LocalPilot Settings** (or the toolbar button) opens `%USERPROFILE%\.localpilot\config.json` in Visual Studio, with a commented example when it does not exist yet. The keys are listed in [Terminal & CLI](terminal-and-cli.md#settings). Settings made in VS Code's LocalPilot Settings are read too. After a change, press **Restart LocalPilot**. ## Troubleshooting **"LocalPilot needs Node.js 18.17 or newer"**: install the LTS from [nodejs.org](https://nodejs.org/en/download), then **Restart**. If Node.js is installed somewhere unusual, set **Node.js path** in **Tools > Options > LocalPilot**. The message lists every `node.exe` it tried. **The status stays red after starting**: the box shows the agent's last log lines. Common causes are a broken `config.json` (fix it or rename it) and an unknown option in **Extra CLI arguments**. The full log is in **Output > LocalPilot** and in `%USERPROFILE%\.localpilot\cli.log`. **No models in the picker, or "no model reachable"**: start your model server (for example `ollama serve`) or add a provider to `config.json`, then **Restart**. `localpilot doctor` in a terminal checks every server. **The agent works in the wrong folder**: it starts in the open solution's folder (or the active file's folder when no solution is open). After switching solutions, **New chat** restarts it in the new folder. **Open diff does nothing**: it uses Visual Studio's `vsDiffMerge.exe`, which ships with Visual Studio. A minimal installation without the Team Explorer component may not have it; open the file and use Git's diff instead. **The chat does not scroll to the newest message**: Visual Studio's out-of-process UI cannot scroll a list from the extension; scroll down to follow a long answer. Report problems at [GitHub issues](https://github.com/isathish/localpilot/issues) with the **Output > LocalPilot** log.