Experiment B: refactor shared tree building helpers - #7
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This is experiment B for #1: refactor the repeated analyzer tree-building logic by extracting a dedicated
src/tree.rshelper module.The current project structure is small and layered:
src/main.rs: CLI entry point and argument handlingsrc/analyzer.rs: language dispatch and shared analyzer model helperssrc/rust.rs,src/javascript.rs,src/markdown.rs: language-specific tree-sitter extractionsrc/model.rs,src/render.rs,src/util.rs: shared data model, rendering, and utility codetests/fixtures/*: language fixture coverage used by the existing test suiteA/B analysis report
Goal: evaluate two implementations of issue #1 and compare the usefulness of the
sviewskill for navigating the refactor.Experiment A:
sviewskill enabledComparison branch/PR keeps the shared helper in
src/analyzer.rs.Observed navigation characteristics:
sviewoutline pass plus targeted reads was enough to identify the repeated shape across analyzer modulesExperiment B: no
sviewskillImplementation in this PR:
src/tree.rsmodulesrc/lib.rsObserved navigation characteristics:
rg/sedexploration was sufficient for this small repositoryRecommendation
Both implementations solve #1 and pass tests. I slightly prefer this B PR for long-term module boundaries (
src/tree.rs), while the A PR is useful evidence thatsviewimproves structural navigation and reduces unnecessary full-file reading.Verification
cargo fmt --checkcargo test --quiet