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
18 changes: 18 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,23 @@
},
"problemMatcher": "$msCompile"
}
{
"label": "build hc types analyzer",
"command": "dotnet",
"type": "shell",
"args": [
"build",
"src/HotChocolate/Core/test/Types.Analyzers.Tests",
// Ask dotnet build to generate full paths for file names.
"/property:GenerateFullPaths=true",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,31 @@ namespace HotChocolate;
/// with the HotChocolate.Types.Analyzers source generators.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class ModuleNameAttribute : Attribute
public sealed class ModuleAttribute : Attribute
{
/// <summary>
/// Initializes new instance of <see cref="ModuleNameAttribute"/>.
/// Initializes new instance of <see cref="ModuleAttribute"/>.
/// </summary>
/// <param name="name">
/// The module name.
/// </param>
public ModuleNameAttribute(string name)
/// <param name="options">
/// The source generator features.
/// </param>
public ModuleAttribute(string name, ModuleOptions options = ModuleOptions.Default)
{
Name = name;
Options = options;
}

/// <summary>
/// Gets the module name.
/// </summary>
/// <value></value>
public string Name { get; }

/// <summary>
/// Gets the selected source generator options.
/// </summary>
public ModuleOptions Options { get; }
}
25 changes: 25 additions & 0 deletions src/HotChocolate/Core/src/Abstractions/ModuleOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;

namespace HotChocolate;

/// <summary>
/// The source generator module options.
/// </summary>
[Flags]
public enum ModuleOptions
{
/// <summary>
/// Default options.
/// </summary>
Default = RegisterDataLoader | RegisterTypes,

/// <summary>
/// Register types with the source generated module.
/// </summary>
RegisterTypes = 1,

/// <summary>
/// Register DataLoader with the source generated module.
/// </summary>
RegisterDataLoader = 2
}
Loading