# Editor support

Install the [Prisma VS Code extension](https://marketplace.visualstudio.com/items?itemName=Prisma.prisma) to get error checking, formatting, and completion in your `.prisma` file.

In Prisma ORM 8 that file is the [data contract](/guides/contract-authoring-the-data-contract): the description of your models that Prisma ORM 7 called the schema. Its path is the `contract` setting in your `prisma.config.ts`, which is `prisma/contract.prisma` in the config [`orm init`](/guides/orm-orm-init) writes; see [Configuration](/guides/introduction-5-configuration#config-file).

Coming from Prisma ORM 7? Start with [Coming from Prisma ORM 7](/guides/introduction-orm-coming-from-prisma-orm-7). This page covers VS Code only.

## [The file header](#the-file-header)

The extension only works on `.prisma` files whose first non-blank line is:

```title="prisma/contract.prisma"
// use prisma-8
```

A file without that line gets no error checking, no completion, and no formatting. [`prisma contract emit`](/guides/orm-contract-emit) also skips it without a warning, and when none of the files that the `contract` setting names has the line, `contract emit` fails with `CONTRACT.SOURCE_LOAD_FAILED`. [`orm init`](/guides/orm-orm-init) and [`contract infer`](/guides/orm-contract-infer) write the line for you. Add it yourself when you create a contract by hand.

## [What the editor does](#what-the-editor-does)

- **Errors** appear inline as you type. They are the same errors you would get from [`prisma contract emit`](/guides/orm-contract-emit), the command that checks the contract and writes `contract.json` and `contract.d.ts`.
- **Formatting** reformats the whole file. In VS Code, run **Format Document**.
- **Completion** starts when you type `@` or `@@`. The editor lists attribute names such as `@id`, `@default`, and `@@index`, each with a short description. Inside an attribute, it lists the names of the arguments you have not filled in yet and suggests values for them. It also suggests values inside `[ ]` and `{ }`. In a MongoDB index's field list, it suggests the option and its values in the parentheses after a field name, such as `sort` and `Desc` in `@@index([createdAt(sort: Desc)])`. Where an attribute expects a field name, it suggests only scalar fields. When an attribute has required arguments, VS Code inserts them as placeholders named after each argument, which you tab through.
- **Signature help** appears when you type `(` or `,` inside an attribute. It shows the attribute's arguments and describes the one you are typing.

The list of attributes comes from your `prisma.config.ts`: the database it declares and the Prisma extension packs listed under `extensions`; see [Extension packs](/guides/introduction-5-configuration#extension-packs) for that config. Extension packs are add-on packages for database features such as [pgvector](/guides/extensions-using-extensions). If your config lists the pgvector pack, the editor also suggests pgvector's attributes. No database connection is needed.

## [False errors after an upgrade](#false-errors-after-an-upgrade)

If the editor marks attributes as errors in a contract that `prisma contract emit` accepts, the likely cause is an old ORM package. That is the `@prisma/orm-postgres`, `@prisma/orm-mongo`, or `@prisma/orm-sqlite` package your project installs for its database. Check the installed version:

```bash
npm ls @prisma/orm-postgres
```

If it prints a version below `8.0.0-rc.9`, update it to the current release:

:::code-group
```bash title="bun"
bun add @prisma/orm-postgres@latest
```

```bash title="pnpm"
pnpm add @prisma/orm-postgres@latest
```

```bash title="yarn"
yarn add @prisma/orm-postgres@latest
```

```bash title="npm"
npm install @prisma/orm-postgres@latest
```
:::

Replace `orm-postgres` with `orm-mongo` or `orm-sqlite` to match your database. Then reload the editor window. In VS Code, run **Developer: Reload Window** from the Command Palette.

## Related pages

- [Authentication & Tools](./authentication-tools-index.md)
- [Build](./build-index.md)
- [Changelog](../changelog.md)
- [Concepts](./concepts-index.md)
- [Console commands](./console-commands-index.md)
- [Contract Authoring](./contract-authoring-index.md)
- [Core Concepts](./core-concepts-index.md)
- [Data Modeling](./data-modeling-index.md)
- [Database](./database-index.md)
- [DB commands](./db-commands-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
