-
Notifications
You must be signed in to change notification settings - Fork 1
Formatting
Ashwin Shenoy edited this page Mar 19, 2022
·
2 revisions
You can easily format your prisma files using LSP's format
feature. There are several ways to invoke it.
- Using the context menu. Right click in your schema file & select
LSP -> Format File
to format. This option is also available from the main menu asEdit -> LSP: Format File
. - Using the command palette. Open the command palette and select
LSP: Format File
.
The command for LSP's format is lsp_format_document
. So you can bind it to any key binding you want. As an example,
{
"keys": ["shift+alt+f"],
"command": "lsp_format_document"
}
If you want to automatically format your schema files on save, then:
- Open any Prisma schema file.
- From the main menu, go to
Preferences -> Settings -- Syntax Specific
. This should open a split layout window. - On the right hand side, paste the following and save the file.
// These settings override both User and Default settings for the Prisma syntax
{
"lsp_format_on_save": true
}
Your Prisma schema files will now automatically be formatted everytime you save them.
The lsp_format_on_save
is a setting that automatically invokes LSP's format
feature (provided by the language server) on your document on save.