Repository navigation
Conversation
The C# class-body walker only handled field_declaration, so a
property's type produced no references(field) edge. In idiomatic C#,
auto-properties (`public Widget Main { get; set; }`) — not bare fields
— are the standard way to declare state, so this silently dropped most
of a class's type relationships.
Add a property_declaration branch alongside the field_declaration
handler, guarded the same way (ts_module == tree_sitter_c_sharp,
parent_class_nid set). A property exposes its type on the node directly
(no variable_declaration wrapper), so read it via
child_by_field_name("type") and collect refs with
_csharp_collect_type_refs, mirroring the Java/PHP/Kotlin siblings so
List<Widget> yields both the List field ref and the Widget generic_arg
ref. Only emit when target != parent_class_nid.
Member
|
Merged as |
This was referenced Aug 24, 2026
Closed
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.
Summary
C# auto-properties drop their type references.
public Widget Main { get; set; }andpublic List<Widget> Items { get; set; }emit noreferences(field)edges — so a class whose state is declared as properties (idiomatic modern C#) has no field edges at all.Root cause
In
graphify/extract.py, the class-body walker has a C#field_declarationhandler but noproperty_declarationhandler (the existing property_declaration branches are guarded on the PHP/Kotlin/Swiftts_module, so none fire fortree_sitter_c_sharp).Fix
Add a C#
property_declarationbranch mirroring the field handler. A property exposes its type on the node directly (novariable_declarationwrapper), so readchild_by_field_name("type")and run_csharp_collect_type_refs(like the Java/PHP/Kotlin siblings) — yielding both the container field ref and the generic_arg ref, with the sameref_token/qualified/ref_qualifiermetadata as the field path.Verification
Owner/Workersproperties to the fixture andtest_csharp_property_type_references_have_field_context(fails before the fix, passes after).test_languages.py+test_multilang.py: 343 passed, 0 failed.ruffclean.Before → after:
DataProcessor → Processor(field),DataProcessor → List(field), andDataProcessor → Processor(generic_arg) are now emitted.Note: fully-qualified generic names (
System.Collections.Generic.List<T>) still drop the type argument — a pre-existing limitation of_csharp_collect_type_refs'squalified_namebranch, out of scope for this change.