Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 9 additions & 2 deletions .github/workflows/ci.generate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as yaml from "https://deno.land/[email protected]/encoding/yaml.ts";

enum OperatingSystem {
Macx86 = "macos-12",
Macx86 = "macos-13",
MacArm = "macos-latest",
Windows = "windows-latest",
Linux = "ubuntu-20.04",
Linux = "ubuntu-22.04",
}

interface ProfileData {
Expand Down Expand Up @@ -91,6 +91,13 @@ const ci = {
RUST_BACKTRACE: "full",
},
steps: [
{
name: "Prepare git",
run: [
"git config --global core.autocrlf false",
"git config --global core.eol lf",
].join("\n"),
},
{ uses: "actions/checkout@v4" },
{ uses: "dsherret/rust-toolchain-file@v1" },
{
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
config:
- os: macos-12
- os: macos-13
run_tests: 'true'
target: x86_64-apple-darwin
cross: 'false'
Expand All @@ -32,23 +32,23 @@ jobs:
run_tests: 'true'
target: x86_64-pc-windows-msvc
cross: 'false'
- os: ubuntu-20.04
- os: ubuntu-22.04
run_tests: 'true'
target: x86_64-unknown-linux-gnu
cross: 'false'
- os: ubuntu-20.04
- os: ubuntu-22.04
run_tests: 'false'
target: x86_64-unknown-linux-musl
cross: 'false'
- os: ubuntu-20.04
- os: ubuntu-22.04
run_tests: 'false'
target: aarch64-unknown-linux-gnu
cross: 'false'
- os: ubuntu-20.04
- os: ubuntu-22.04
run_tests: 'false'
target: aarch64-unknown-linux-musl
cross: 'false'
- os: ubuntu-20.04
- os: ubuntu-22.04
run_tests: 'false'
target: riscv64gc-unknown-linux-gnu
cross: 'true'
Expand All @@ -65,6 +65,10 @@ jobs:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- name: Prepare git
run: |-
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- name: Cache cargo
Expand Down
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dprint-core = { version = "0.67.0", features = ["process"] }
globset = "0.4.14"
handlebars = "5.1.2"
serde = { version = "1.0.204", features = ["derive"] }
sha2 = "0.10.9"
splitty = "1.0.1"
tokio = { version = "1.38.0", features = ["time"] }

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ This plugin executes CLI commands to format code via stdin (recommended) or via
General config:

- `cacheKey` - Optional value used to bust dprint's incremental cache (ex. provide `"1"`). This is useful if you want to force formatting to occur because the underlying command's code has changed.
- If you want to automatically calculate the cache key, consider using `command.cacheKeyFiles`.
- `timeout` - Number of seconds to allow an executable format to occur before a timeout error occurs (default: `30`).
- `cwd` - Recommend setting this to `${configDir}` to force it to use the cwd of the current config file.

Expand All @@ -61,6 +62,7 @@ Command config:
- You may have associations match multiple binaries in order to format a file with multiple binaries instead of just one. The order in the config file will dictate the order the formatting occurs in.
- `stdin` - If the text should be provided via stdin (default: `true`)
- `cwd` - Current working directory to use when launching this command (default: dprint's cwd or the root `cwd` setting if set)
- `cacheKeyFiles` - A list of paths (relative to `cwd`) to files used to automatically compute a `cacheKey`. This allows automatic invalidation of dprint's incremental cache when any of these files are changed.

Command templates (ex. see the prettier example above):

Expand Down Expand Up @@ -118,7 +120,12 @@ Use the `rustfmt` binary so you can format stdin.
"cwd": "${configDir}",
"commands": [{
"command": "rustfmt --edition 2021",
"exts": ["rs"]
"exts": ["rs"],
// add the config files for automatic cache invalidation when the rust version or rustfmt config changes
"cacheKeyFiles": [
"rustfmt.toml",
"rust-toolchain.toml"
]
}]
},
"plugins": [
Expand All @@ -139,7 +146,11 @@ Consider using [dprint-plugin-prettier](https://dprint.dev/plugins/prettier/) in
"commands": [{
"command": "prettier --stdin-filepath {{file_path}} --tab-width {{indent_width}} --print-width {{line_width}}",
// add more extensions that prettier should format
"exts": ["js", "ts", "html"]
"exts": ["js", "ts", "html"],
// add the config files for automatic cache invalidation when the prettier config config changes
"cacheKeyFiles": [
".prettierrc.json"
]
}]
},
"plugins": [
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.79.0"
channel = "1.82.0"
components = ["clippy", "rustfmt"]
Loading
Loading