Adds syntax highlighting, formatting, jump-to-definition and linting for [Prisma Schema](https://www.prisma.io/docs/concepts/components/prisma-schema) files.
You can find both the stable and Insider extension on the Marketplace.
You can find both the stable and Insider extension on the Open VSX Registry.
- Syntax highlighting of
schema.prisma
- Linting
- Diagnostic tools are used to surface errors and warnings in your schema file as you type.
- Code Completion
- Completion results appear for symbols as you type.
- You can trigger this manually with the Ctrl+Space shortcut.
- Symbols for schema blocks
datasource
,generator
,model
,enum
andtype
- They are listed in the Outline view of VS Code and clicking them will go to their definition.
- Documentation help
- Documentation of a completion result pops up as completion results are provided.
- Quick info on hover
- Documentation Comments (
///
) ofmodel
,enum
ortype
appear anywhere you hover over their usages. - CMD + hover on a field whose type is a
model
,enum
ortype
will show the corresponding block in a popup.
- Documentation Comments (
- Go to Definition
- Jump to or peek a
model
,enum
ortype
definition. (CMD + left click)
- Jump to or peek a
- Formatting
- Format code either manually or on save (if configured).
- To automatically format on save, add the following to your
settings.json
file:"editor.formatOnSave": true
- To enable formatting in combination with
prettier
, add the following to yoursettings.json
file:or use the Prettier plugin for Prisma"[prisma]": { "editor.defaultFormatter": "Prisma.prisma" },
- To automatically format on save, add the following to your
- Format code either manually or on save (if configured).
- Rename
- Rename models, enums, fields and enum values
- Click into the model or enum, press F2 and then type the new desired name and press Enter
- All usages will be renamed
- Automatically applies
@map
or@@map
on the schema
- Rename models, enums, fields and enum values
- Quick-fixes
- Quickly fix typos in model and enum names
- Create new models and enums with a single click
- Add
@unique
on model fields for a@relation
where thereferences
value is pointing to a field missing it.
Linting and autocompletion
Linting shows inline errors in the schema, and autocompletion assists in defining the correct type.
Contextual suggestions
Contextual suggestions assist in defining field types, models, and relations while formatting automatically defines back relations.
Read more about how to contribute to the Prisma VS Code extension
If you have a security issue to report, please contact us at security@prisma.io