mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-16 18:29:15 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
44 lines
969 B
C#
44 lines
969 B
C#
using System;
|
|
|
|
namespace Sandbox.CodeUpgrader;
|
|
|
|
/// <summary>
|
|
/// Wraps CodeFixProvider to make it less of a pain in the ass
|
|
/// </summary>
|
|
public abstract partial class Fixer : CodeFixProvider
|
|
{
|
|
public virtual Task RunTests( IFixerTest tester ) => Task.CompletedTask;
|
|
|
|
public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create( Target.Rule.Id );
|
|
public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;
|
|
|
|
|
|
Analyzer _analyzer;
|
|
|
|
public Analyzer Target
|
|
{
|
|
get
|
|
{
|
|
return _analyzer ??= (Analyzer)Activator.CreateInstance( Analyzer );
|
|
}
|
|
}
|
|
|
|
public abstract Type Analyzer { get; }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Wraps CodeFixProvider to make it less of a pain in the ass
|
|
/// </summary>
|
|
public abstract partial class Fixer<T> : Fixer where T : Analyzer
|
|
{
|
|
public override Type Analyzer => typeof( T );
|
|
|
|
}
|
|
|
|
|
|
public interface IFixerTest
|
|
{
|
|
public Task Test( string oldcode, string fixedcode );
|
|
}
|