本文整理汇总了C#中ParsedDocument.GetErrorsAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ParsedDocument.GetErrorsAsync方法的具体用法?C# ParsedDocument.GetErrorsAsync怎么用?C# ParsedDocument.GetErrorsAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParsedDocument
的用法示例。
在下文中一共展示了ParsedDocument.GetErrorsAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateQuickTasks
async Task UpdateQuickTasks (DocumentContext ctx, ParsedDocument doc, CancellationToken token)
{
if (isDisposed)
return;
var newTasks = ImmutableArray<QuickTask>.Empty.ToBuilder ();
if (doc != null) {
foreach (var cmt in await doc.GetTagCommentsAsync(token).ConfigureAwait (false)) {
if (token.IsCancellationRequested)
return;
int offset;
try {
offset = textEditor.LocationToOffset (cmt.Region.Begin.Line, cmt.Region.Begin.Column);
} catch (Exception) {
return;
}
var newTask = new QuickTask (cmt.Text, offset, DiagnosticSeverity.Info);
newTasks.Add (newTask);
}
foreach (var error in await doc.GetErrorsAsync(token).ConfigureAwait (false)) {
if (token.IsCancellationRequested)
return;
if (ctx.IsAdHocProject && !lexicalError.Contains (error.Id))
continue;
int offset;
try {
offset = textEditor.LocationToOffset (error.Region.Begin.Line, error.Region.Begin.Column);
} catch (Exception) {
return;
}
var newTask = new QuickTask (error.Message, offset, error.ErrorType == MonoDevelop.Ide.TypeSystem.ErrorType.Error ? DiagnosticSeverity.Error : DiagnosticSeverity.Warning);
newTasks.Add (newTask);
}
}
if (token.IsCancellationRequested)
return;
Application.Invoke (delegate {
if (token.IsCancellationRequested || isDisposed)
return;
tasks = newTasks.ToImmutable ();
OnTasksUpdated (EventArgs.Empty);
});
}
示例2: UpdateErrorUndelines
async Task UpdateErrorUndelines (DocumentContext ctx, ParsedDocument parsedDocument, CancellationToken token)
{
if (!DefaultSourceEditorOptions.Instance.UnderlineErrors || parsedDocument == null || isDisposed)
return;
try {
var errors = await parsedDocument.GetErrorsAsync(token).ConfigureAwait (false);
Application.Invoke (delegate {
if (token.IsCancellationRequested || isDisposed)
return;
RemoveErrorUndelinesResetTimerId ();
const uint timeout = 500;
resetTimerId = GLib.Timeout.Add (timeout, delegate {
if (token.IsCancellationRequested) {
resetTimerId = 0;
return false;
}
RemoveErrorUnderlines ();
// Else we underline the error
if (errors != null) {
foreach (var error in errors) {
if (ctx.IsAdHocProject && !lexicalError.Contains (error.Id))
continue;
UnderLineError (error);
}
}
resetTimerId = 0;
return false;
});
});
} catch (OperationCanceledException) {
// ignore
}
}