Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
[CodeFix] Trigger fix all query on bg threads, as to not compute on U…
Browse files Browse the repository at this point in the history
…I thread. (#4247)
  • Loading branch information
Therzok committed Mar 21, 2018
1 parent 9c304a0 commit e5f1de4
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -74,6 +74,7 @@ public static async Task<CodeFixMenu> CreateFixMenu (TextEditor editor, CodeActi

var configureLabel = GettextCatalog.GetString ("_Options");
var configureMenu = new CodeFixMenu (configureLabel);
var fixAllTasks = new List<Task<CodeAction>> ();

foreach (var cfa in fixes.CodeFixActions) {
var state = cfa.FixAllState;
Expand Down Expand Up @@ -119,11 +120,15 @@ public static async Task<CodeFixMenu> CreateFixMenu (TextEditor editor, CodeActi
continue;

// FIXME: Use a real progress tracker.
var fixAll = await provider.GetFixAsync (fixState.CreateFixAllContext (new RoslynProgressTracker (), cancellationToken));
AddFixMenuItem (editor, fixAllMenu, ref mnemonic, fixAll);
var fixAll = Task.Run (() => provider.GetFixAsync (fixState.CreateFixAllContext (new RoslynProgressTracker (), cancellationToken)));
fixAllTasks.Add (fixAll);
}
}

var fixAllActions = await Task.WhenAll (fixAllTasks);
foreach (var fixAllAction in fixAllActions)
AddFixMenuItem (editor, fixAllMenu, ref mnemonic, fixAllAction);

bool first = true;
foreach (var refactoring in fixes.CodeRefactoringActions) {
if (options.TryGetRefactoringDescriptor (refactoring.GetType (), out var descriptor) && !descriptor.IsEnabled)
Expand Down

0 comments on commit e5f1de4

Please sign in to comment.