Skip to content

Conversation

@marlon-costa-dc
Copy link
Contributor

Summary

Makes the inner tree_sitter::Node field public to allow direct access to the underlying tree-sitter API for advanced use cases.

This enables users to:

  • Access tree-sitter node methods not exposed by rust-code-analysis
  • Integrate with other tree-sitter-based tools
  • Perform advanced AST manipulations when needed

Changes

  • src/node.rs: Changed Node<'a>(OtherNode<'a>) to Node<'a>(pub OtherNode<'a>)
  • Added documentation explaining the public field

Attribution

Based on WalkerKnapp/rust-code-analysis@026e424 - "Allow conversion from tree-sitter AST"

Test plan

  • cargo check passes
  • Backward compatible (existing code continues to work)

Makes the inner tree_sitter::Node field public to allow direct access
to the underlying tree-sitter API for advanced use cases.

Based on WalkerKnapp/rust-code-analysis@026e424
Copilot AI review requested due to automatic review settings January 19, 2026 22:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes the inner tree_sitter::Node field to allow advanced users direct access to the underlying tree-sitter API. This enables integration with other tree-sitter-based tools and access to methods not wrapped by rust-code-analysis.

Changes:

  • Made the inner field of the Node tuple struct public
  • Added documentation explaining the exposed field's purpose

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Fix mismatched_lifetime_syntaxes warnings by adding explicit <'_>
lifetime annotations to return types where the lifetime is elided.

Files modified:
- src/node.rs: get_root(), child_by_field_name()
- src/traits.rs: ParserTrait::get_root()
- src/parser.rs: TSParser::get_root()
@marlon-costa-dc marlon-costa-dc force-pushed the feature/ast-conversion branch 2 times, most recently from 21d1c0a to f7ea18e Compare January 19, 2026 23:27
@marlon-costa-dc
Copy link
Contributor Author

⚠️ CI Failure Note

This PR is failing CI due to 18 pre-existing clippy warnings in the upstream codebase (e.g., collapsible_if in src/find.rs:68).

These warnings are not introduced by this PR - they exist in the current master branch and are fixed by PR #1211.

Dependency: This PR requires #1211 to be merged first for CI to pass.

What this PR actually changes:

  • src/node.rs: Exposes inner tree_sitter::Node field as public for advanced use cases
  • src/tools.rs: Removes unnecessary parentheses (the only clippy fix in this PR)

Once #1211 is merged, this PR's CI should pass.

@Luni-4
Copy link
Collaborator

Luni-4 commented Jan 20, 2026

You can rebase this PR

@marco-c marco-c merged commit 2e167b0 into mozilla:master Jan 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants