Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current minimization approach with
syn
has many flaws. For example, it's impossible to nicely identify syn nodes. Syn nodes are also heterogeneous, which can make it more annoying to write more generic minimization steps.After looking a bit at Langston Barrett's cool [treereducehttps://github.com/langston-barrett/treereduce), it became clear that tree-sitter is the better solution. It has first-class support for node IDs, making every homogeneous node unique, which is great and fixes all of these silly AstPath tracking garbage things.
Langston Barrett has also written a neat helper crate
tree-sitter-edit
that helps with editing tree-sitter trees and makes that very nice.I won't be literally coping their approach, as treereduce is a bit different in scope (I can imagine integrating treereduce in the future though), being more generic and file-based while cargo-minimize is more focused on minimizing entire projects quickly using more specialized approaches.