Skip to content

v1.0.0-alpha.9

Choose a tag to compare

@github-actions github-actions released this 08 Feb 19:44
577cf6d

Changes

  • Add support for #gsub! Neovim directive in 726b39b

    The 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.indented for embeddings in e149980

    This 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 2f8cb04

    The Neovim #trim! directive allows trimming a captures range to remove
    leading or trailing newlines and/or whitespace.

  • Support the injection.combined capture property in 83bf691

    Currently 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.combined query 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_aliases where 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.marker query captures in 07559cc

    The current pruner-ignore marker 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_block and 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.marker captures
    discovered via ignore.scm queries. This allows users to define their
    own markers for ignoring nodes.

  • Add @pruner.ignore query captures in 577cf6d

    This works like @pruner.ignore.marker but 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