Fix runSymbol empty-body regression for Salesforce metadata, add extractor dispatch table#10
Merged
Conversation
…h table for symbol extraction wholeFileSpan() in salesforce_metadata.ts stores body: '' for every metadata kind (not just profiles), but only runRead got the disk-reconstruction fallback added alongside it. runSymbol read sym.body directly, so every Salesforce metadata symbol showed an empty preview. Mirrors the same fallback into runSymbol. Also replaces extractSymbolsNoTreeSitter's 19-branch if-chain with a lookup table so adding a language adapter is one map entry instead of a new branch.
Zelys-DFKH
added a commit
that referenced
this pull request
Jul 9, 2026
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.
Follow-up to #9.
What's fixed
wholeFileSpan()insalesforce_metadata.tsstoresbody: ''for every metadata kind (CustomObject, CustomField, ValidationRule, PermissionSet, Profile, CustomMetadata, and the generic fallback), not just profiles. #9 added a disk-reconstruction fallback torunReadfor this, butrunSymbol(token-goat symbol NAME) still readsym.bodydirectly with no fallback, so it showed an empty preview for every Salesforce metadata symbol. This mirrors the same disk-reconstruction fallback intorunSymbol, with a test.What's refactored
extractSymbolsNoTreeSitterinparser.tswas a 19-branchifchain dispatchingLanguageto its extractor function, growing by one branch per language added. Replaced with aPartial<Record<Language, extractor>>lookup table.html/liquidkeep their extrasectionsToHeadingSymbolscomposition as inline lambda values, unchanged behavior.Verification
npm run typechecknpm run lintnpm test(4747 passed, 4 skipped)dist/token-goat.mjsand dogfooded against real fixtures:token-goat symbolandtoken-goat readboth correctly reconstruct the body from disk for a.profile-meta.xmlsymbol;token-goat symbolstill resolves an Apex method through the new dispatch table.