Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Dprint Code FormatterNew to Visual Studio Code? Get it now.

Dprint Code Formatter

dprint

|
248 installs
| (0) | Free
Formats code in VSCode using dprint.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

dprint - Visual Studio Code Extension

Visual Studio Code formatting extension for dprint—a pluggable and configurable code formatting platform.

Install

  1. Install dprint's CLI
  2. Install extension via Visual Studio Marketplace

Setup

  1. Run dprint init in the root directory of your repository to create a dprint.config.json file.
  2. Set the default formatter in your vscode settings:
    {
      "editor.defaultFormatter": "dprint.dprint",
      // or specify per language
      "[javascript]": {
        "editor.defaultFormatter": "dprint.dprint"
      },
      "[typescript]": {
        "editor.defaultFormatter": "dprint.dprint"
      },
      "[json]": {
        "editor.defaultFormatter": "dprint.dprint"
      },
      "[jsonc]": {
        "editor.defaultFormatter": "dprint.dprint"
      },
      "[markdown]": {
        "editor.defaultFormatter": "dprint.dprint"
      },
      "[rust]": {
        "editor.defaultFormatter": "dprint.dprint"
      }
    }
    
  3. Consider turning on "format on save" (see below in Extension Settings)

Features

Formats code in the editor using dprint.

Plugins are currently resolved based on the .dprintrc.json in the current workspace folder or config sub directory.

Requirements

You must have dprint installed globally on the path.

Follow the instructions here: Install

Extension Settings

Respects formatting on save:

{
  "editor.formatOnSave": true,
  // or per language
  "[typescript]": {
    "editor.formatOnSave": true
  }
}

Known Issues

  • No support for custom config locations.

Release Notes

0.3.0

  • Update to work with dprint 0.10.0 (will be backwards compatible with 0.9.0 for now).
  • Plugin now re-initializes when the .dprintrc.json file changes.

0.2.0

Formatting is faster due to using a long-running background process for formatting.

0.1.6

  • Instructional message when dprint is not installed globally.
  • Fix encoding issue on error.

0.1.3-0.1.5

Updates based on latest dprint CLI.

0.1.2

Fix error text.

0.1.1

Auto-dismiss syntax error notifications.

0.1.0

Initial release.

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2019 Microsoft