Skip to content

fix(csharp): preserve namespace scope chain for ref resolution#374

Open
RodgeFu wants to merge 2 commits intoalloy-framework:mainfrom
RodgeFu:fix/csharp-namespace-scope-chain-373
Open

fix(csharp): preserve namespace scope chain for ref resolution#374
RodgeFu wants to merge 2 commits intoalloy-framework:mainfrom
RodgeFu:fix/csharp-namespace-scope-chain-373

Conversation

@RodgeFu
Copy link
Contributor

@RodgeFu RodgeFu commented Mar 4, 2026

Summary

  • fix C# Namespace rendering inside SourceFile to preserve full namespace scope chain for dotted namespaces
  • avoid incorrect symbol resolution side effects (unnecessary using and over-qualified member access)
  • update/add namespace tests covering the resolved behavior

Validation

  • npx vitest run packages/csharp/src/components/namespace/namespace.test.tsx packages/csharp/src/components/namespace.ref.test.tsx

Closes #373

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

All changed packages have been documented.

  • @alloy-js/csharp
Show changes

@alloy-js/csharp - fix ✏️

Fix namespace scope-chain construction for dotted namespaces declared inside SourceFile so refkey resolution no longer emits incorrect qualification or unnecessary using directives. Adds regression coverage for sibling and multi-level nested namespace scenarios.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/csharp@374

commit: 760799f

* hierarchy, stopping at the `stopAt` namespace symbol (which is already in
* scope from an enclosing NamespaceScopes).
*/
function wrapWithNamespaceScopes(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we already do that in NamespaceScopes can we maybe reuse that component instead?

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.

[csharp] Namespace inside SourceFile with dotted namespace builds incomplete scope chain for refkey resolution

2 participants