Skip to content

Instantly share code, notes, and snippets.

@decriptor
Created January 23, 2018 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save decriptor/309f4d4f6c44099191ae4e858a89d8ab to your computer and use it in GitHub Desktop.
Save decriptor/309f4d4f6c44099191ae4e858a89d8ab to your computer and use it in GitHub Desktop.
sshaw@shawmsxamthree:~/Projects/monodevelop (fix-3717-geterrorsasync *)$ git diff
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs
index c84f597875..0772b23ec5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs
@@ -81,9 +81,13 @@ namespace MonoDevelop.Ide.Editor.Extension
var ctx = DocumentContext;
if (ctx == null)
return;
- await UpdateErrorUndelines (ctx, parsedDocument, token).ConfigureAwait (false);
+
+ var docErrors = await parsedDocument.GetErrorsAsync (token).ConfigureAwait (false);
+ token.ThrowIfCancellationRequested ();
+
+ UpdateErrorUndelines (ctx, parsedDocument, docErrors, token);
token.ThrowIfCancellationRequested ();
- await UpdateQuickTasks (ctx, parsedDocument, token).ConfigureAwait (false);
+ await UpdateQuickTasks (ctx, parsedDocument, docErrors, token).ConfigureAwait (false);
} catch (OperationCanceledException) {
// ignore
}
@@ -116,12 +120,11 @@ namespace MonoDevelop.Ide.Editor.Extension
}
- async Task UpdateErrorUndelines (DocumentContext ctx, ParsedDocument parsedDocument, CancellationToken token)
+ void UpdateErrorUndelines (DocumentContext ctx, ParsedDocument parsedDocument, IReadOnlyList<Error> docErrors, CancellationToken token)
{
if (parsedDocument == null || isDisposed)
return;
try {
- var errors = await parsedDocument.GetErrorsAsync(token).ConfigureAwait (false);
Application.Invoke ((o, args) => {
if (token.IsCancellationRequested || isDisposed)
return;
@@ -134,8 +137,8 @@ namespace MonoDevelop.Ide.Editor.Extension
}
RemoveErrorUnderlines ();
// Else we underline the error
- if (errors != null) {
- foreach (var error in errors) {
+ if (docErrors != null) {
+ foreach (var error in docErrors) {
UnderLineError (error);
}
}
@@ -165,7 +168,7 @@ namespace MonoDevelop.Ide.Editor.Extension
}
}
- async Task UpdateQuickTasks (DocumentContext ctx, ParsedDocument doc, CancellationToken token)
+ async Task UpdateQuickTasks (DocumentContext ctx, ParsedDocument doc, IReadOnlyList<Error> docErrors, CancellationToken token)
{
if (isDisposed)
return;
@@ -184,7 +187,7 @@ namespace MonoDevelop.Ide.Editor.Extension
newTasks.Add (newTask);
}
- foreach (var error in await doc.GetErrorsAsync(token).ConfigureAwait (false)) {
+ foreach (var error in docErrors) {
if (token.IsCancellationRequested)
return;
int offset;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment