Releases: pruner-formatter/pruner
v1.0.0-alpha.11
Changes
- Preserve indentation of trailing injection content in 5a878e9
Tree-sitter's code_fence_content node for indented markdown fenced code
blocks captures trailing indent spaces as part of the content range
(e.g.\n). When strip_leading_indent removed those spaces, the
resulting bare newline was lost because trailing_newlines was computed
from the original slice (which ended in spaces, not newlines). This
caused the closing fence to collapse onto the last line of code.Add trailing_newlines_with_indent to look past exact-indent trailing
spaces when detecting trailing newlines, and re-apply indent spaces
after the final newline during recomposition so that subsequent content
in the parent document stays at the correct column.
v1.0.0-alpha.10
Changes
- Add support for formatter temp file configuration in 462e2e8
Support formatters that read/write files instead of stdin/stdout by
adding new formatter config options (stdout,file_ext, and
colocate_temp_file) and threading a source file path through
formatting calls.Also add
--stdin-filepathto associate stdin content with a path,
improve temp file naming/location behavior for non-stdin formatters, and
expand tests to cover the new config parsing and temp-file behavior. - Print diffs for dirty files in check mode in a895bd4
If a file is dirty when running with
--check=true, print a unified
diff to stderr so the formatting changes are visible without modifying
files.This adds a dedicated
api::diffmodule for diff generation and
colorized rendering, and wires check-mode file processing to emit diffs
as dirty files are discovered.
Full Changelog: v1.0.0-alpha.9...v1.0.0-alpha.10
v1.0.0-alpha.9
Changes
- Add support for
#gsub!Neovim directive in 726b39bThe neovim
#gsub!directive allows replacing the part of a string that
matches a given lua-pattern.Support for this directive has been added in order to expand support for
nvim-treesitter's large corpus of injection queries. - Add
pruner.injection.indentedfor embeddings in e149980This directive instructs Pruner to treat the surrounding whitespace in
nix-style embeddings as not part of the injection content.This could theoretically be completely replaced with a
#trim!
directive, but the semantics aren't entirely the same.The
#trim!directive would remove all leading/trailing
whitespace/newlines while nix-style embeddings only treat the first
leading/trailing whitespace as excluded.For now, this is added as an experimental property and will most likely
be removed/replaced with just#trim!in the future. - Add support for
#trim!Neovim directive in 2f8cb04The Neovim
#trim!directive allows trimming a captures range to remove
leading or trailing newlines and/or whitespace. - Support the
injection.combinedcapture property in 83bf691Currently Pruner completely fails to handle embedded regions that
contain templating. In these cases treesitter grammars typically produce
multiple injected region fragments which surround the templated host
regions.This patch adds support for the
injection.combinedquery capture
property which instructs the parser to combine all related regions into
a contiguous whole. - Add support for language aliases in 30d1301
Currently Pruner requires embedded regions to be annotated with their
full, canonical language name. Many languages however make use of
aliases like the file extension to tag an embedded region.In these cases Pruner won't know how to handle the region, even if it
would be able to handle that language in its canonical form.To resolve this, this patch introduces a new config entry called
language_aliaseswhere mappings between a canonical language and it's
aliases can be defined.In the future we can also ship Pruner with pre-defined mappings for
common languages.[language_aliases] typescript = ["ts", "tsx"]
- Add support for pruner-ignore in 3986550
- Add
@pruner.ignore.markerquery captures in 07559ccThe current
pruner-ignoremarker heuristic relies on the underlying
grammar defining nodes as type = "comment". Surprisingly, not all
grammars do this!Most notably Markdown, which marks comment blocks as
html_blockand relies
on the injected grammar to define this document region as a comment.This breaks pruners ignore marker heuristics.
The solution is to add support for
pruner.ignore.markercaptures
discovered viaignore.scmqueries. This allows users to define their
own markers for ignoring nodes. - Add
@pruner.ignorequery captures in 577cf6dThis works like
@pruner.ignore.markerbut allows directly defining the
target node to ignore instead of a marker which is then used as an
anchor to discover the ignore target.
Full Changelog: v1.0.0-alpha.8...v1.0.0-alpha.9
v1.0.0-alpha.8
Merge pull request #1 from armed/master Fix UTF-8 multi-byte character handling in injection range calculation
v1.0.0-alpha.7
Changes
- Add formatter conditionals in language pipelines in 936384c
This expands the [languages] pipeline syntax to allow passing a table
instead of a formatter name.When a table is passed, additional conditionals can be set:
run_in_root: true|false- Whether or not this formatter should be
executed when formatting the root documentrun_in_injections: true|false- Whether or not this formatter should be
executed when formatting injected regions within the document
One might want to apply different formatter settings in different
contexts and this is the start to enabling this.
Full Changelog: v1.0.0-alpha.6...v1.0.0-alpha.7
v1.0.0-alpha.6
Changes
- New WASM formatter for aligning clojure comments in 6929198
- Separate config used internally from file format in 5beec90
- Run formatters before checking grammar in ca6662b
Currently pruner will only run formatters for languages for which there
are defined grammars.This commit makes sure to always run any configured formatters before
moving on to the grammar parsing phase. - Add config profiles for conditional overrides in 8e58454
This adds support for defining profiles in the config file which contain
defined overrides to the config.These profiles can be specified at runtime through the
--profileflag
which will then apply them over the base config. - Rename wasm_formatters to plugins in c1c3a77
- Reduce test boilerplate in 0d2e1fb
- Turn into a workspace and add a plugin-api crate in 4c42ee7
- Refine plugin-api wit interface in 0af1be8
- Fix incorrectly lower-cased Cargo.toml file in e9eb1c1
- Fully automate align-comments plugin building in 6164636
- Fix incorrectly lower-cased Cargo.toml file in fe5fbe7
- Fix github actions runner images in 3775fc4
- Prepare plugin-api for release in 4a47be9
- Extract plugins into dedicated repos in 5ffd74c
- Include WIT files in release artifacts in 9a5b677
- Expand project documentation in b46ff45
- Fix test fixtures in 1ba025f
- Fix some broken doc links in 92c89e9
Full Changelog: v1.0.0-alpha.5...v1.0.0-alpha.6
v1.0.0-alpha.5
Changes
- Support loading config files relative to cwd in 40d885b
This will recursively search up from the cwd for a
pruner.tomlfile
and merge this with the global.config/pruner/config.tomlfile.If
--configis specified then this is used instead. - Add support for wasm formatter components in bb33627
This change bakes in an embedded wasmtime engine which can load and run
wasm components implementing theformatterwit interface.This allows extending pruner with 'native' formatters which can be
written in any language that can compile to wasm, and can operate on any
language source code.As an example, an initial
trim_newlineswasm formatter is included in
this repo. - Fix indent bug in non-formatted injected region in b46a009
- Improve initial README description in c6d4864
Full Changelog: v1.0.0-alpha.4...v1.0.0-alpha.5
v1.0.0-alpha.4
Changes
- Update README with install and usage instructions in 747a6fa
- Allow passing explicit true|false to args in e4409c2
- Mark --config arg as a global in 1d3edc2
- Handle empty output from formatter as a failure in dfbbb16
- Handle various escape/unescape scenarios better in adf449c
- Map indent offset for formatted result correctly in 0ff6d5b
Full Changelog: v1.0.0-alpha.3...v1.0.0-alpha.4
v1.0.0-alpha.3
Release checksums with binaries
v1.0.0-alpha.2
Changes
- Ensure tmp file is always removed after formatting in 64d636f
- Add support for formatting files on disk in 1181370
- Add help text to format command in 6dbf559
Full Changelog: v1.0.0-alpha.1...v1.0.0-alpha.2