-
Notifications
You must be signed in to change notification settings - Fork 4k
/
CodeRefactoringProvider.cs
38 lines (34 loc) · 1.43 KB
/
CodeRefactoringProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeRefactorings
{
/// <summary>
/// Inherit this type to provide source code refactorings.
/// Remember to use <see cref="ExportCodeRefactoringProviderAttribute"/> so the host environment can offer your refactorings in a UI.
/// </summary>
public abstract class CodeRefactoringProvider
{
/// <summary>
/// Computes one or more refactorings for the specified <see cref="CodeRefactoringContext"/>.
/// </summary>
public abstract Task ComputeRefactoringsAsync(CodeRefactoringContext context);
/// <summary>
/// What priority this provider should run at.
/// </summary>
internal CodeActionRequestPriority RequestPriority
{
get
{
var priority = ComputeRequestPriority();
Contract.ThrowIfFalse(priority is CodeActionRequestPriority.Normal or CodeActionRequestPriority.High);
return priority;
}
}
private protected virtual CodeActionRequestPriority ComputeRequestPriority()
=> CodeActionRequestPriority.Normal;
}
}