feat(treesitter): add ,imports and ,signatures flags to :symbol fences#9
Merged
Merged
Conversation
The :symbol fence could scope to a member but always dropped the file's
import context, and there was no way to show a type's shape without
dumping every body. Add two opt-in, comma-combinable flags:
- ,imports prepends the file's top-of-file using/import/require lines
- ,signatures elides member bodies to { … } for an outline view
Both extend the existing config-driven tree walk. A shared TreeWalker,
lifted from NamePathResolver, now drives name resolution, import
collection, and outline elision. Flags flow through parsing → service →
extractor in a new FragmentOptions record (replacing the bare bodyOnly
bool); per-language ImportNodeTypes seed import collection. Imports and
signatures apply to :symbol only — :symbol-diff still honors just
,bodyonly.
Docs: new how-to sections with live examples, updated fence grammar and
suffix table, and retired the now-false "no using prepend" caveat.
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.
What
Two opt-in, comma-combinable flags for
:symbolcode fences:,imports— prepends the file's top-of-fileusing/import/requirelines above the snippet (all of them, blank-line separated). Composes with,bodyonly; no-op for whole-file embeds and import-less languages (Ruby).,signatures— elides member bodies to{ … }(…for non-brace bodies) for an at-a-glance outline of a type's shape. Inverse of,bodyonly.