Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that version 3 is not bundled yet #3513

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ Install through VS Code extensions. Search for `Prettier - Code formatter`

Can also be installed in VS Code: Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.

```
```shell
ext install esbenp.prettier-vscode
```

### Default Formatter

To ensure that this extension is used over other extensions you may have installed, be sure to set it as the default formatter in your VS Code settings. This setting can be set for all languages or by a specific language.

```json
```jsonc
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
Expand All @@ -83,7 +83,7 @@ If you want to disable Prettier on a particular language you can either create a

The following will use Prettier for all languages except Javascript.

```json
```jsonc
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
Expand All @@ -94,7 +94,7 @@ The following will use Prettier for all languages except Javascript.

The following will use Prettier for only Javascript.

```json
```jsonc
{
"editor.defaultFormatter": "<another formatter>",
"[javascript]": {
Expand All @@ -105,7 +105,7 @@ The following will use Prettier for only Javascript.

Additionally, you can disable format on save for specific languages if you don't want them to be automatically formatted.

```json
```jsonc
{
"[javascript]": {
"editor.formatOnSave": false
Expand All @@ -119,18 +119,20 @@ This extension will use prettier from your project's local dependencies (recomme

To install prettier in your project and pin its version [as recommended](https://prettier.io/docs/en/install.html), run:

```
```shell
npm install prettier -D --save-exact
```

> NOTE: You will be prompted to confirm that you want the extension to load a Prettier module. This is done to ensure that you are not loading a module or script that is not trusted.

### Prettier Version 3

Prettier's preview version 3 is supported as of version 9.12.0. It is not included in the extension by default, but can be used by installing locally in your project. Version 10.0.0 of this extension will include prettier 3.0.0 after it is out of preview. To try version 3 now run the following in your project:
Prettier's version 3 is supported as of version 9.12.0. However, this extension ships with prettier 2.8.8 and uses its default configuration. Version 3 and its defaults will be included with this extension when some issues are resolved. To use version 3 now, you can install it locally in your project as described above. To match the default configuration of prettier 3, set

```base
npm i [email protected] -D
```jsonc
{
"prettier.trailingComma": "all"
}
```

### Plugins
Expand Down Expand Up @@ -180,7 +182,7 @@ Respects `editor.formatOnSave` setting.

You can turn on format-on-save on a per-language basis by scoping the setting:

```json
```jsonc
// Set the default
"editor.formatOnSave": false,
// Enable per-language
Expand Down Expand Up @@ -298,15 +300,15 @@ A list of [glob patterns](https://code.visualstudio.com/api/references/vscode-ap

It is likely you will need to also update your prettier config. For example, if I register the following document selector by itself, Prettier still won't know what to do with that file. I either need a Prettier extension that formats `.abc` file format or I need to configure Prettier.

```json
```jsonc
{
"prettier.documentSelectors": ["**/*.abc"]
}
```

To tell Prettier how to format a file of type `.abc` I can set an override in the prettier config that makes this file type use the `babel` parser.

```json
```jsonc
{
"overrides": [
{
Expand Down