Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ Corresponding generated source (interceptor):
```csharp
#nullable enable

namespace DotNetCampus.CommandLine.Compiler
namespace DotNetCampus.Cli.Compiler
{
file static class Interceptors
{
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-hans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ _ = CommandLine.Parse(args, CommandLineParsingOptions.DotNet).As<Options>();
```csharp
#nullable enable

namespace DotNetCampus.CommandLine.Compiler
namespace DotNetCampus.Cli.Compiler
{
file static class Interceptors
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private string GenerateCode(Dictionary<ISymbol, ImmutableArray<InterceptorGenera
return $$"""
#nullable enable

namespace {{GeneratorInfo.RootNamespace}}.Compiler
namespace DotNetCampus.Cli.Compiler
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

Hardcoding the namespace here removes flexibility for projects that customize the root namespace. Consider constructing it using GeneratorInfo.RootNamespace (e.g., ${GeneratorInfo.RootNamespace}.Compiler) to keep it in sync with the project’s actual root namespace.

Suggested change
namespace DotNetCampus.Cli.Compiler
namespace {{GeneratorInfo.RootNamespace}}.Compiler

Copilot uses AI. Check for mistakes.
{
file static class Interceptors
{
Expand Down
4 changes: 2 additions & 2 deletions src/DotNetCampus.CommandLine/Package/build/Package.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<DotNetCampusCommandLineUseInterceptor Condition="'$(DotNetCampusCommandLineUseInterceptor)' == ''">true</DotNetCampusCommandLineUseInterceptor>
<InterceptorsNamespaces>$(InterceptorsNamespaces);DotNetCampus.CommandLine.Compiler</InterceptorsNamespaces>
<InterceptorsNamespaces>$(InterceptorsNamespaces);DotNetCampus.Cli.Compiler</InterceptorsNamespaces>
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

The DotNetCampus.Cli.Compiler string is duplicated in both InterceptorsNamespaces and InterceptorsPreviewNamespaces. Consider defining a single MSBuild property for the CLI compiler namespace to avoid repetition and simplify future updates.

Suggested change
<InterceptorsNamespaces>$(InterceptorsNamespaces);DotNetCampus.Cli.Compiler</InterceptorsNamespaces>
<DotNetCampusCliCompilerNamespace>DotNetCampus.Cli.Compiler</DotNetCampusCliCompilerNamespace>
<InterceptorsNamespaces>$(InterceptorsNamespaces);$(DotNetCampusCliCompilerNamespace)</InterceptorsNamespaces>

Copilot uses AI. Check for mistakes.

<!--
https://github.com/dotnet/roslyn/blob/main/docs/features/interceptors.md
Expand All @@ -12,7 +12,7 @@
为了兼容性,属性 <InterceptorsPreviewNamespaces> 可用作 <InterceptorsNamespaces> 的别名。
如果两个属性都具有非空值,则它们在传递给编译器时将按 $(InterceptorsNamespaces);$(InterceptorsPreviewNamespaces) 的顺序连接在一起。
-->
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);DotNetCampus.CommandLine.Compiler</InterceptorsPreviewNamespaces>
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);DotNetCampus.Cli.Compiler</InterceptorsPreviewNamespaces>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading