# VS Code Extension Reference

The Courier extension's snippets, every command and setting it adds, how it finds the calls in your code, how Studio takes you to the code, and what it keeps on your machine.

The Courier extension for VS Code, item by item. What it does for you is on [VS Code Extension](/docs/studio/editor).

## Snippets

| Type | For |
| --- | --- |
| `courier-endpoint` | An endpoint of a group: its method, path, variables and response |
| `courier-group` | A group of endpoints under one path |
| `courier-api` | An API: its base address and its groups |
| `courier-routes` | Routes a page's proxy client takes, written by hand where Courier writes none |
| `courier-query`, `courier-mutation` | A read and a write with React Query |
| `courier-subscription`, `courier-channel` | A stream followed and a channel joined while a component is mounted |
| `courier-call` | A call made directly, on the server or in a script |

## Commands and settings

| Command | What it does |
| --- | --- |
| **Courier: Open in Courier Studio** | Opens Studio for the project of the file in front |
| **Courier: Open Studio in Editor** | Opens Studio in a tab of the editor's own |
| **Courier: Open Studio in Browser** | Opens Studio in your browser |
| **Courier: Start Studio** | Starts Studio for the project of the file in front, or the one you pick |
| **Courier: Set Up Courier** | Runs Create Courier in a terminal, in the workspace folder you pick |
| **Courier: New Endpoint…** | Adds an endpoint to a group, as its file writes them |
| **Courier: Import an API…** | Imports an OpenAPI, Swagger or Postman document into the project |
| **Courier: Show OpenAPI Document…** | Opens a source's OpenAPI document |
| **Courier: Check API Changes…** | Reports what a change to the API breaks, against a git ref |
| **Courier: Show Courier's Icons in the File Icon Theme** | Puts Courier's icons into Material Icon Theme or vscode-icons — from Courier File Icons |
| **Courier: Remove Courier's Icons from the File Icon Theme** | Takes them out again — from Courier File Icons |
| **Courier: Refresh Endpoint Hints** | Finds the calls again and brings the figures up to date |
| **Courier: Show Log** | Opens Courier's log in the Output panel |

| Setting | What it does |
| --- | --- |
| `courier.hints.enabled` | Show the figures over endpoint calls (default: on) |
| `courier.hints.style` | `codeLens`: a line above each call (default); `inlay`: at the end of the call's line |
| `courier.hints.refreshSeconds` | How often the figures are brought up to date while the window has focus (default: 5) |
| `courier.studio.openIn` | Where Studio's pages open: `editor`, a tab of the editor's own (default), or `browser` |
| `courier.audit.diagnostics` | Mark the audit's findings at the calls they concern (default: on) |
| `courier.notifications.failures` | Tell with a notification when a call fails while you work (default: off) |
| `courier.agents.mcpServers` | Offer VS Code's agent each project's MCP servers (default: on) |
| `courier.fileIcons.automatic` | Put Courier's icons into the icon theme in use by themselves, and into each one you pick (default: on); off once you take them out, on again once you show them, read from your user settings only — a setting of Courier File Icons |
| `courier.studio.url` | Studio's address, when it runs for a project outside the workspace — on this machine, in your user settings |

Courier's log, under **Courier** in the Output panel, says when each project's Studio starts answering or stops, and why a question to Studio found no answer — written once, not again each time the views ask.

## How a call is found

Studio writes where it runs to `.courier/studio.json` in your project while it runs, and takes it away when it stops; the extension reads the nearest one above the file you are in, so each project of a monorepo finds its own Studio. The extension sends Studio the file as it stands in the editor, saved or not, and Studio reads the calls in it against the endpoints your config defines:

| A call | Is read as |
| --- | --- |
| `api.orders.place({ sku })` | `orders.place`: a call that ends with an endpoint's names, after whatever it is made on |
| `backend.payments.account.me()` | `payments`' `account.me`: the source's name written before the endpoint's settles which source |
| `const shop = createProxyCaller(shopRoutes)` then `shop.account.me()` | `shop`'s `account.me`: a caller the file creates names its source, by its routes or its API |
| `q.orders.useQuery("list")` | `orders.list`: a query hook names its endpoint as its first argument |

When two sources define an endpoint of the same name and nothing settles which one a call reaches, the extension shows both. A top-level endpoint is matched only through a caller the file creates or its source's name — its one name, `get` or `list`, is too common to tell a call by. TypeScript and JavaScript files are read, and the scripts of Vue, Svelte and Astro components.

## From Studio to the code

Every request's **Overview** in the inspector, and every endpoint in the Explorer, has a **Called from** section: the files and lines that call the endpoint, each with its line of code. A click opens the file at that line in your editor — choose which in **Settings → Editor**: VS Code, Cursor, Windsurf, VSCodium, Zed, WebStorm or IntelliJ IDEA. In Studio's tab inside the editor, it opens the file beside Studio. Studio looks through the files Git tracks, so whatever `.gitignore` leaves out is left out; outside Git, everything but dependencies, builds and caches.

## What stays on your machine

The extension talks only to Studio, on this machine. What it shows — the figures, the requests, the mocks, the audit — it reads as any page of Studio's does. It uses the token Studio keeps in your project's `.courier/studio-token` for what reads your code or changes something: where an endpoint is called and declared, and the groups a new endpoint can go in, which Studio reads from your project's files only for a caller with the token; switching a mock's scenario or its delays and faults in the Mocks view; and Studio's own tab, which opens with the token as Studio's own link does. A Studio named in the settings for a project outside the workspace has no token the extension can read: its call sites and declarations then show in Studio itself, opened from the link it printed, and the extension says so. The token goes nowhere but to that Studio.

The extension sends Studio the text of the files you open, so an address naming another host — in a project's `.courier/studio.json`, or in `courier.studio.url` — is ignored, and the setting is read from your user settings alone: a repository you clone cannot point the extension elsewhere. Studio reads the files you send it and your project's own, and keeps nothing of them. A Studio serving a [public demo](/docs/studio/overview) writes no address file and answers neither the extension nor **Called from**: it reads no project's code for its visitors.

A question to `@courier` in words goes to the model you picked in the chat, with Studio's figures for this session — endpoint names, statuses, error messages, the audit's findings — as any question in that chat goes to it with your code. The four commands answer from Studio alone, and ask no model.

Courier File Icons writes Courier's icons to your user settings as it puts them in — and keeps them as you left them on your other machines — to a folder's settings only when you agree to add the icons there, and takes back what it wrote to your settings when you remove them, leaving `courier.fileIcons.automatic` off. Neither extension sends anything anywhere else, and neither keeps telemetry.

The extension starts Studio, Create Courier and the agent's servers from the project's folder, so it stays off in a workspace you have not trusted: VS Code's Restricted Mode turns it off until you trust the folder.
