fix(parser): resolve custom-language names via configurable name_field (#691)#702
Open
anusbutt wants to merge 1 commit into
Open
fix(parser): resolve custom-language names via configurable name_field (#691)#702anusbutt wants to merge 1 commit into
anusbutt wants to merge 1 commit into
Conversation
tirth8205#691) The generic walker only found a definition's name from an identifier-like child or a field literally named "name", so BibTeX/LaTeX/Markdown nodes whose name lives in a differently named or nested field were extracted unnamed and silently dropped. Add an optional `name_field` (string or ordered list) to languages.toml. For custom languages only, resolve each candidate field-first across all candidates, then by descendant node type, then descend to a clean text leaf. Built-in language extraction is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Linked issue
Closes #691
What & why
The generic walker's name heuristic only checked an identifier-like child or a
field literally named
name, so common BibTeX/LaTeX/Markdown node shapes wereextracted unnamed and silently dropped (losing the node and all its edges).
Adds an optional
name_fieldkey to.code-review-graph/languages.toml(string or ordered list). For custom languages only, each candidate is resolved
field-first across all candidates, then by descendant node type, then descended
to a cleaned text leaf. Two-pass ordering makes precise fields win over a
broader type match (e.g. LaTeX
\newcommandresolves viadeclaration, not thetextnode in its body). Anchoring on configured candidates avoids returningunrelated inner identifiers (e.g. BibTeX field labels
title/author).Built-in language extraction is byte-for-byte unchanged.
How it was tested