Giter VIP home page Giter VIP logo

dprint-vscode's Introduction

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 configuration file.
  2. Set the default formatter in your vscode settings and consider turning on "format on save":
    {
      "editor.defaultFormatter": "dprint.dprint",
      "editor.formatOnSave": true,
      // or specify per language, for example
      "[javascript]": {
        "editor.defaultFormatter": "dprint.dprint",
        "editor.formatOnSave": true
      }
    }

Features

Formats code in the editor using dprint.

Plugins are currently resolved based on the dprint configuration file in the current workspace folder.

Requirements

You must have dprint installed globally on the path.

Follow the instructions here: Install

Extension Settings

{
  // By default it will use `dprint` found on the path,
  // but use this when you want to specify a custom location.
  // Include the executable name (ex. on windows "C:\\some-dir\\dprint.exe")
  "dprint.path": "/home/david/otherPath/dprint",
  // Change this to `true` to get verbose logging
  "dprint.verbose": false
}

Known Issues

  • No support for custom config locations.

Developing and Testing Locally

  1. npm install
  2. Go to "Run and debug" in VS code and run the "Run Extension" task.

Release Notes

0.13.5

  • fix: regression opening a descendant directory of a folder with a config file

0.13.4

  • perf: reduce startup cpu usage with multiple workspace folders

0.13.3

  • fix: regression where dprint versions <= 0.28 stopped formatting

0.13.2

  • fix: ensure large files get formatted on Mac

0.13.1

  • fix: handle dprint process being killed by an outside force

0.13.0

  • feat: expand ~/ in the dprint.path configuration to the home directory

0.12.1

  • fix: support folders with spaces when resolving node_modules path and in "dprint.path" configuration

0.12.0

  • feat: prefer resolving dprint executable in node_modules
  • feat: support for editor schema v5 (#30)

0.11.0

  • Support sub directories with dprint configuration files.

0.10.0

  • Support multiple workspace folders.
  • Do not show notification for formatting errors (it only outputs to the output tab).
  • Better handling when default schema can't be downloaded.
  • Extension is bundled to single JS file to improve load times.

0.9.0

  • Support config files in ancestor directories of the workspace.

0.8.0

  • Support for dprint 0.17
  • Get config file schema from plugins.

0.7.0

  • Add logging to "output" tab in vscode (under "dprint").
  • Add "dprint.verbose" config for outputting verbose logging.

0.6.0

  • Support dprint 0.13

0.5.0

  • Support dprint 0.12

0.4.0

  • Added dprint.path setting.

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 configuration 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.