Skip to content

Fix runSymbol empty-body regression for Salesforce metadata, add extractor dispatch table#10

Merged
Zelys-DFKH merged 1 commit into
mainfrom
fix/salesforce-symbol-read-and-dispatch-table
Jul 9, 2026
Merged

Fix runSymbol empty-body regression for Salesforce metadata, add extractor dispatch table#10
Zelys-DFKH merged 1 commit into
mainfrom
fix/salesforce-symbol-read-and-dispatch-table

Conversation

@Zelys-DFKH

Copy link
Copy Markdown
Collaborator

Follow-up to #9.

What's fixed

wholeFileSpan() in salesforce_metadata.ts stores body: '' for every metadata kind (CustomObject, CustomField, ValidationRule, PermissionSet, Profile, CustomMetadata, and the generic fallback), not just profiles. #9 added a disk-reconstruction fallback to runRead for this, but runSymbol (token-goat symbol NAME) still read sym.body directly with no fallback, so it showed an empty preview for every Salesforce metadata symbol. This mirrors the same disk-reconstruction fallback into runSymbol, with a test.

What's refactored

extractSymbolsNoTreeSitter in parser.ts was a 19-branch if chain dispatching Language to its extractor function, growing by one branch per language added. Replaced with a Partial<Record<Language, extractor>> lookup table. html/liquid keep their extra sectionsToHeadingSymbols composition as inline lambda values, unchanged behavior.

Verification

  • npm run typecheck
  • npm run lint
  • npm test (4747 passed, 4 skipped)
  • Built dist/token-goat.mjs and dogfooded against real fixtures: token-goat symbol and token-goat read both correctly reconstruct the body from disk for a .profile-meta.xml symbol; token-goat symbol still resolves an Apex method through the new dispatch table.

…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 Zelys-DFKH merged commit 7c461a2 into main Jul 9, 2026
4 checks passed
@Zelys-DFKH Zelys-DFKH deleted the fix/salesforce-symbol-read-and-dispatch-table branch July 9, 2026 20:46
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.

1 participant