ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin
0.4.6
See the version list below for details.
dotnet add package ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin --version 0.4.6
NuGet\Install-Package ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin -Version 0.4.6
<PackageReference Include="ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin" Version="0.4.6" />
paket add ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin --version 0.4.6
#r "nuget: ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin, 0.4.6"
// Install ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin as a Cake Addin
#addin nuget:?package=ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin&version=0.4.6
// Install ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin as a Cake Tool
#tool nuget:?package=ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin&version=0.4.6
Syntax Tree Extensions Plugin
This is a ForgedOnce code generation pipeline plugin that allows to generate C# extensions for fluent modification for a set of input classes. Works with standard ForgedOnce.CSharp.CodeFileEnvironmentHandlerCSharp environment handler. Originally was created to extend syntax tree definitions.
For example for a given class
using System;
public class TestClass
{
public int PropA { get; set; }
public string PropB { get; set; }
}
it will generate the following extension
using System;
namespace YourTargetNamespace
{
public static partial class TestClassExtensions
{
public static TestClass WithPropA(this TestClass subject, int propA)
{
subject.PropA = propA;
return subject;
}
public static TestClass WithPropB(this TestClass subject, string propB)
{
subject.PropB = propB;
return subject;
}
}
}
that allows to modify the instance of TestClass like this
TestClass a = new TestClass().WithPropA(10).WithPropB("Some string.");
Configuration
In a pipeline this plugin can be configured with the following parameters:
- outputNamespace - output namespace for the extensions
- requiredClassBaseType (optional) - fully qualified .NET type that is required for input class to be or inherit or implement as interface.
- typesToUnfold (optional) - semicolon delimitered fully qualified .NET types that will be inlined in extension methods. No extensions are generated for those if encountreed in the input.
- ignorePropertyNames (optional) - semicolon delimitered list of property names for which no extension methods will be generated.
- unpluralizeVariables (optional, default=false) - boolean parameter allowing to unpluralize plural names for collection-like properties in extension methods that will add single item.
Example configuration:
"config": {
"outputNamespace": "ForgedOnce.TsLanguageServices.ModelBuilder.ExtensionMethods",
"requiredClassBaseType": "ForgedOnce.TsLanguageServices.ModelBuilder.DefinitionTree.Node",
"typesToUnfold": "ForgedOnce.TsLanguageServices.ModelBuilder.DefinitionTree.Identifier;ForgedOnce.TsLanguageServices.ModelBuilder.DefinitionTree.TypeReferenceId",
"ignorePropertyNames": "Parent",
"unpluralizeVariables": "true"
}
Input and Output
Plugin takes C# code files as inputs.
Output is a single C# code stream named PassThrough which will contain all output extension classes each placed in own code file.
Parameters and Settings
Plugin parameters and settings to use with custom preprocessor are represented by ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin.Parameters and ForgedOnce.TsLanguageServices.SyntaxTreeExtensionsPlugin.Settings and documented within a code.
Metadata
Plugin is recording two kinds of metadata in the output code files:
- Root level SymbolGenerated
- For each extension class SymbolGenerated with relation to source class
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- ForgedOnce.CSharp (>= 0.4.9)
- ForgedOnce.CSharp.Helpers (>= 0.1.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.