Skip to content

Commit

Permalink
chore: Updates for the latest dprint CLI.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jul 16, 2020
1 parent afe7b39 commit 1d4c98f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 35 deletions.
5 changes: 2 additions & 3 deletions dprint.config.json → .dprintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"projectType": "openSource",
"typescript": {
},
"json": {
"indentWidth": 2
},
Expand All @@ -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"
]
}
61 changes: 33 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1d4c98f

Please sign in to comment.