-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #753 from DustinCampbell/handle-nested-code-actions
Handle nested code actions
- Loading branch information
Showing
6 changed files
with
132 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
src/OmniSharp.Roslyn.CSharp/Extensions/CodeActionExtensions.cs
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/AvailableCodeAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Immutable; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis.CodeActions; | ||
|
||
namespace OmniSharp.Roslyn.CSharp.Services.Refactoring.V2 | ||
{ | ||
public class AvailableCodeAction | ||
{ | ||
public CodeAction CodeAction { get; } | ||
public CodeAction ParentCodeAction { get; } | ||
|
||
public AvailableCodeAction(CodeAction codeAction, CodeAction parentCodeAction = null) | ||
{ | ||
if (codeAction == null) | ||
{ | ||
throw new ArgumentNullException(nameof(codeAction)); | ||
} | ||
|
||
this.CodeAction = codeAction; | ||
this.ParentCodeAction = parentCodeAction; | ||
} | ||
|
||
public string GetIdentifier() | ||
{ | ||
return CodeAction.EquivalenceKey ?? GetTitle(); | ||
} | ||
|
||
public string GetTitle() | ||
{ | ||
return ParentCodeAction != null | ||
? $"{ParentCodeAction.Title} -> {CodeAction.Title}" | ||
: CodeAction.Title; | ||
} | ||
|
||
public Task<ImmutableArray<CodeActionOperation>> GetOperationsAsync(CancellationToken cancellationToken) | ||
{ | ||
return CodeAction.GetOperationsAsync(cancellationToken); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters