Repository navigation
rust: index the items written inside item-level macro bodies - #6
Merged
Merged
Conversation
tree-sitter leaves a macro invocation's body as an unparsed token tree, so
every item tokio writes inside cfg_rt! { ... }, pin_project! { ... } and
similar wrappers had no symbol (AsyncReadExt, TcpStream::set_zero_linger,
FramedWrite). A brace body at item level is now re-parsed as Rust over its
own byte range, so positions stay those of the file, and visited like any
item list; nested wrappers recurse on a strictly smaller range. Bodies
inside function bodies and macro_rules templates are not read, and neither
are call-like m!(a, b) arguments: a name a macro generates (rgtest!(r16, ..)
-> fn r16) is left to the compiler pass.
tokio: 12021 -> 13277 symbols; extraction 1.06s -> 1.12s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXa6Cv1ZUXcdMqXcJfQFhX
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.
tree-sitter leaves a macro body as an unparsed token tree, so every item tokio writes inside
cfg_rt! { ... },pin_project! { ... }and similar wrappers had no symbol (AsyncReadExt,TcpStream::set_zero_linger,FramedWrite).A brace body at item level is now re-parsed as Rust over its own byte range (positions stay those of the file) and visited like any item list; nested wrappers recurse on a strictly smaller range. Not read: bodies inside function bodies, macro_rules templates, and call-like
m!(a, b)arguments. A name a macro generates (rgtest!(r16, ..)->fn r16) is left to grove's rust-analyzer pass.TestRustItemMacroBodiesAreIndexed,TestRustItemMacroBodyWithHelperMacro; full suite green; grove's full suite green against this branch; engine gate (all invariants incl. decoy) held.🤖 Generated with Claude Code
https://claude.ai/code/session_01KXa6Cv1ZUXcdMqXcJfQFhX