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