From 1d4c98f04bdd8446c47f785b275a119ae994ba61 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 16 Jul 2020 10:22:45 -0400 Subject: [PATCH] chore: Updates for the latest dprint CLI. --- dprint.config.json => .dprintrc.json | 5 +-- README.md | 61 +++++++++++++++------------- package.json | 7 ++-- src/extension.ts | 2 +- 4 files changed, 40 insertions(+), 35 deletions(-) rename dprint.config.json => .dprintrc.json (73%) diff --git a/dprint.config.json b/.dprintrc.json similarity index 73% rename from dprint.config.json rename to .dprintrc.json index 31ea07f..0f20373 100644 --- a/dprint.config.json +++ b/.dprintrc.json @@ -1,8 +1,6 @@ { "$schema": "https://dprint.dev/schemas/v0.json", "projectType": "openSource", - "typescript": { - }, "json": { "indentWidth": 2 }, @@ -13,7 +11,8 @@ "out" ], "plugins": [ - "https://plugins.dprint.dev/typescript-0.19.2.wasm", + "https://plugins.dprint.dev/typescript-0.19.9.wasm", + "https://plugins.dprint.dev/markdown-0.2.4.wasm", "https://plugins.dprint.dev/json-0.4.1.wasm" ] } diff --git a/README.md b/README.md index d3ac294..a187474 100644 --- a/README.md +++ b/README.md @@ -11,33 +11,34 @@ Visual Studio Code formatting extension for [dprint](https://dprint.dev/)—a pl 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: - ```jsonc - { - "editor.defaultFormatter": "dprint.dprint", - // or specify per language (recommended) - "[javascript]": { - "editor.defaultFormatter": "dprint.dprint" - }, - "[typescript]": { - "editor.defaultFormatter": "dprint.dprint" - }, - "[json]": { - "editor.defaultFormatter": "dprint.dprint" - }, - "[jsonc]": { - "editor.defaultFormatter": "dprint.dprint" - }, - "[rust]": { - "editor.defaultFormatter": "dprint.dprint" - } - } - ``` + ```json + { + "editor.defaultFormatter": "dprint.dprint", + // or specify per language (recommended) + "[javascript]": { + "editor.defaultFormatter": "dprint.dprint" + }, + "[typescript]": { + "editor.defaultFormatter": "dprint.dprint" + }, + "[json]": { + "editor.defaultFormatter": "dprint.dprint" + }, + "[jsonc]": { + "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](https://dprint.dev/). -Plugins are currently resolved based on the `dprint.config.json` in the current workspace folder or `config` sub directory. +Plugins are currently resolved based on the `.dprintrc.json` in the current workspace folder or `config` sub directory. ## Requirements @@ -51,20 +52,24 @@ Respects formatting on save: ```jsonc { - "editor.formatOnSave": true, - // or per language - "[typescript]": { - "editor.formatOnSave": true - } + "editor.formatOnSave": true, + // or per language + "[typescript]": { + "editor.formatOnSave": true + } } ``` ## Known Issues -* No support for custom config locations. +- No support for custom config locations. ## Release Notes +### 0.1.3 + +Updates based on latest dprint CLI. + ### 0.1.2 Fix error text. diff --git a/package.json b/package.json index 875db40..b15c6be 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Formats code in VSCode using dprint.", "author": "David Sherret", "publisher": "dprint", - "version": "0.1.3", + "version": "0.1.4", "license": "MIT", "repository": { "type": "git", @@ -21,14 +21,15 @@ "onLanguage:jsonc", "onLanguage:typescript", "onLanguage:javascript", + "onLanguage:markdown", "onLanguage:rust" ], "main": "./out/extension.js", "contributes": { "commands": [ { - "command": "dprint.restart", - "title": "Dprint: Restart" + "command": "dprint.reset", + "title": "Dprint: Reset" } ] }, diff --git a/src/extension.ts b/src/extension.ts index 280d0ed..5464d72 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -31,7 +31,7 @@ export function activate(context: vscode.ExtensionContext) { }, }; - context.subscriptions.push(vscode.commands.registerCommand("dprint.restart", initializePluginInfos)); + context.subscriptions.push(vscode.commands.registerCommand("dprint.reset", initializePluginInfos)); context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders(initializePluginInfos)); initializePluginInfos();