Skip to content

feat(parser): C# language pack via optional extra - #63

Merged
ggrace519 merged 1 commit into
mainfrom
feat/csharp-pack
Sep 4, 2026
Merged

feat(parser): C# language pack via optional extra#63
ggrace519 merged 1 commit into
mainfrom
feat/csharp-pack

Conversation

@ggrace519

Copy link
Copy Markdown
Owner

Summary

Adds graphlm[csharp] — the next language pack by GitHub Octoverse popularity after the shipped Python / JS+TS / Java / Rust set.

  • Extra pulls tree-sitter-c-sharp; resolver is in-tree (graphlm/parsers/csharp.py).
  • using static Ns.Type / using Alias = Ns.Type resolve to Ns/Type.cs (then Ns.cs for a nested type). kind is static / import.
  • A namespace using Ns; resolves only when exactly one scanned .cs lives in that namespace directory. Two or more files are dropped (GRAPH_DIFF fan-out — same reason as Java wildcards, ADR-007) and mark the list not exhaustive.
  • using System; and other misses are third-party, not partial.
  • Missing extra: zero C# edges, one log line, never a crash; Python/JS/Java/Rust edges intact. graphlm[all] now includes csharp.

Why

C# using names a namespace, not a file. Fan-out to every file in the namespace would churn every importer's edge set when a type is added. Unique-or-drop is the honest v1; the model still infers the rest.

Verification

  • uv run pytest -q732 passed, 5 skipped (with --extra mcp --extra all)
  • uv run mypy graphlm --ignore-missing-imports — clean
  • Fixture tests/fixtures/csharp_project/: exact 4-edge set, User↔UserService cycle, multi-file TooMany namespace produces no edge + partial, using System; dropped

graphlm[csharp] pulls tree-sitter-c-sharp; the resolver lives in-tree
(graphlm/parsers/csharp.py). using static Ns.Type and using Alias = Type
resolve to Ns/Type.cs. A namespace using Ns; resolves only when exactly
one scanned file lives in that namespace directory — two or more files
are dropped (GRAPH_DIFF fan-out, same reason as Java wildcards) and mark
the list not exhaustive (ADR-007). using System; misses are third-party,
not partial.

Without the extra: zero C# edges, one log line, never a crash. graphlm[all]
now includes csharp.

Verified: csharp_project exact edge set (4 edges + cycle); pytest 732
passed / 5 skipped with extras; mypy clean.

Co-authored-by: Grok 4.6 <noreply@x.ai>
@ggrace519
ggrace519 merged commit 6158c7c into main Sep 4, 2026
8 checks passed
@ggrace519
ggrace519 deleted the feat/csharp-pack branch September 4, 2026 22:32
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