feat: extract php symbols with structure awareness - #91
Open
GrzegorzDrozd wants to merge 2 commits into
Open
GrzegorzDrozd wants to merge 2 commits into
GrzegorzDrozd wants to merge 2 commits into
Conversation
web-tree-sitter 0.20.8 rejects grammars built with tree-sitter CLI 0.24 and
newer ("Incompatible language version 15. Compatibility range 13 through 14"),
which pins every grammar to its 2024 revision.
Move the runtime to 0.27 and take grammars from @repomix/tree-sitter-wasms,
a maintained fork of tree-sitter-wasms whose last release still ships
tree-sitter-php 0.22 and tree-sitter-cli 0.20.8. All ten formats the extractor
supports are present in the fork with the same output layout.
The 0.25 module restructure renames SyntaxNode to Node and moves Language out
of the Parser namespace. Go renamed the interface method node from method_spec
to method_elem, which the extraction test for Go scopes covers.
Second step to support more languages in code extraction. See issue zvec-ai#88.
PHP files fell back to plain-text chunks. Every PHP declaration carries a name field and the shared classifier already maps trait, enum and namespace nodes correctly, so the adapter only adds what PHP does differently. Properties and constants declare several names per statement, and promoted constructor parameters declare properties from inside a signature. Both are handled by resolveEntities, which keeps promoted properties on the class breadcrumb rather than the constructor's, since the walk never descends into an entity node. Modifiers read PHP's modifier nodes rather than the shared signature regex, which otherwise reports a promoted parameter's visibility as the constructor's own. Covers namespaces, classes, interfaces, traits, enums, methods, functions, properties, constants, enum cases and promoted constructor properties. Third, and final, step to support php in code extraction. See issue zvec-ai#88.
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.
PHP files fell back to plain-text chunks. Every PHP declaration carries a name
field and the shared classifier already maps trait, enum and namespace nodes
correctly, so the adapter only adds what PHP does differently.
Properties and constants declare several names per statement, and promoted
constructor parameters declare properties from inside a signature. Both are
handled by resolveEntities, which keeps promoted properties on the class
breadcrumb rather than the constructor's, since the walk never descends into an
entity node.
Modifiers read PHP's modifier nodes rather than the shared signature regex,
which otherwise reports a promoted parameter's visibility as the constructor's
own.
Covers namespaces, classes, interfaces, traits, enums, methods, functions,
properties, constants, enum cases and promoted constructor properties.
Third, and final, step to support php in code extraction. See issue #88.
This branch requires and contains code from #90. It should be updated when it is
merged into main.