本文整理汇总了C#中Microsoft.VisualStudio.Shell.ErrorTask类的典型用法代码示例。如果您正苦于以下问题:C# ErrorTask类的具体用法?C# ErrorTask怎么用?C# ErrorTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorTask类属于Microsoft.VisualStudio.Shell命名空间,在下文中一共展示了ErrorTask类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddError
public void AddError(DiagnosticBase diagnostic, TextSpan span)
{
lock (_lockObject)
{
if (_disposed)
return;
var sourceText = span.SourceText as VisualStudioSourceText;
if (sourceText == null)
return;
var line = sourceText.Snapshot.GetLineFromPosition(span.Start);
var task = new ErrorTask
{
Text = diagnostic.Message,
Line = line.LineNumber,
Column = span.Start - line.Start.Position,
Category = TaskCategory.CodeSense,
ErrorCategory = (diagnostic.Severity == DiagnosticSeverity.Error)
? TaskErrorCategory.Error
: TaskErrorCategory.Warning,
Priority = TaskPriority.Normal,
Document = span.Filename ?? _textDocument.FilePath
};
task.Navigate += OnTaskNavigate;
_errorListProvider.Tasks.Add(task);
}
}
开发者ID:tgjones,项目名称:HlslTools,代码行数:31,代码来源:ErrorListHelper.cs
示例2: AddError
public void AddError(Project project, string path, string errorText, TaskErrorCategory category, int iLine, int iColumn)
{
ErrorTask task;
IVsSolution solution;
IVsHierarchy hierarchy;
if (project != null)
{
try
{
solution = (IVsSolution)GetService(typeof(IVsSolution));
ErrorHandler.ThrowOnFailure(solution.GetProjectOfUniqueName(project.UniqueName, out hierarchy));
task = new ErrorTask();
task.ErrorCategory = category;
task.HierarchyItem = hierarchy;
task.Document = path;
// VS uses indexes starting at 0 while the automation model uses indexes starting at 1
task.Line = iLine - 1;
task.Column = iColumn;
task.Text = errorText;
task.Navigate += ErrorTaskNavigate;
if (ContainsLink(errorText))
{
task.Help += new EventHandler(task_Help);
}
_errorListProvider.Tasks.Add(task);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
开发者ID:sunday-out,项目名称:SharePoint-Software-Factory,代码行数:35,代码来源:ErrorListProvider.cs
示例3: CreateErrors
private void CreateErrors()
{
var errors = errorListProvider.GetErrors(textView.TextBuffer);
// Check if we should update the error list based on the error count to avoid refreshing the list without changes
if (errors.Count != this.previousErrors.Count)
{
// remove any previously created errors to get a clean start
ClearErrors();
foreach (ValidationError error in errors)
{
// creates the instance that will be added to the Error List
ErrorTask task = new ErrorTask();
task.Category = TaskCategory.All;
task.Priority = TaskPriority.Normal;
task.Document = textView.TextBuffer.Properties.GetProperty<ITextDocument>(typeof(ITextDocument)).FilePath;
task.ErrorCategory = TranslateErrorCategory(error.Severity);
task.Text = error.Description;
task.Line = textView.TextSnapshot.GetLineNumberFromPosition(error.Span.Start);
task.Column = error.Span.Start - textView.TextSnapshot.GetLineFromLineNumber(task.Line).Start;
task.Navigate += OnTaskNavigate;
errorList.Tasks.Add(task);
previousErrors.Add(task);
ITrackingSpan span = textView.TextSnapshot.CreateTrackingSpan(error.Span, SpanTrackingMode.EdgeNegative);
squiggleTagger.CreateTagSpan(span, new ErrorTag("syntax error", error.Description));
previousSquiggles.Add(new TrackingTagSpan<IErrorTag>(span, new ErrorTag("syntax error", error.Description)));
}
}
}
开发者ID:smartmobili,项目名称:parsing,代码行数:31,代码来源:ErrorListPresenter.cs
示例4: LogError
public void LogError(Exception ex)
{
ErrorTask task = new ErrorTask(ex);
task.ErrorCategory = TaskErrorCategory.Error;
task.Category = TaskCategory.Misc;
m_errorListPrivider.Tasks.Add(task);
}
开发者ID:vandro,项目名称:MVCVisualDesigner,代码行数:7,代码来源:Logger.cs
示例5: AddHierarchyItem
public static void AddHierarchyItem(ErrorTask task, EnvDTE.Project project)
{
IVsHierarchy hierarchyItem = null;
IVsSolution solution = BundlerMinifierPackage.GetGlobalService(typeof(SVsSolution)) as IVsSolution;
if (solution != null && project != null)
{
int flag = -1;
try
{
flag = solution.GetProjectOfUniqueName(project.FullName, out hierarchyItem);
}
catch (COMException ex)
{
if ((uint)ex.ErrorCode != DISP_E_MEMBERNOTFOUND)
{
throw;
}
}
if (0 == flag)
{
task.HierarchyItem = hierarchyItem;
}
}
}
开发者ID:rsaladrigas,项目名称:BundlerMinifier,代码行数:27,代码来源:ErrorList.cs
示例6: Show
public static void Show(Diagnostic diag)
{
var task = new ErrorTask
{
Text = string.Format(@"[N] {0,4} : {1}", diag.ID, diag.Message),
Category = TaskCategory.CodeSense,
ErrorCategory =
diag.Level == DiagnosticLevel.Warning
? TaskErrorCategory.Warning
: TaskErrorCategory.Error,
Column = diag.StartColumn,
Line = diag.StartLine - 1,
Document = diag.FilePath,
HierarchyItem = (IVsHierarchy)(AVRStudio.GetProjectItem(dte, diag.FilePath).ContainingProject != null ? AVRStudio.GetProjectItem(dte, diag.FilePath).ContainingProject.Object : null),
};
task.Navigate += (sender, args) =>
{
task.Line++;
errorListProvider.Navigate(task, Guid.Parse(EnvDTE.Constants.vsViewKindCode));
task.Line--;
};
errorListProvider.Tasks.Add(task);
}
开发者ID:saaadhu,项目名称:naggy,代码行数:25,代码来源:ErrorList.cs
示例7: ShowError
public virtual void ShowError(string error)
{
var errorTask = new ErrorTask
{
Category = TaskCategory.Misc,
Text = error,
CanDelete = true,
};
errorProvider.Tasks.Add(errorTask);
}
开发者ID:paulcbetts,项目名称:Fody,代码行数:10,代码来源:MessageDisplayer.cs
示例8: Add
public void Add(Project project, TaskErrorCategory category, string file, int line, int column, string description)
{
var task = new ErrorTask
{
ErrorCategory = category,
Document = file,
Line = Math.Max(line - 1, 0),
Column = Math.Max(column - 1, 0),
Text = description,
};
this.Add(project, task);
}
开发者ID:cbilson,项目名称:chirpy,代码行数:12,代码来源:TaskList.cs
示例9: AddMessage
/// <summary>
/// Adds a message of the given document to the error list.
/// </summary>
public void AddMessage(string message, string document, ErrorCategory errorCategory)
{
var errorTask = new ErrorTask
{
ErrorCategory = (TaskErrorCategory)errorCategory,
Text = message,
Document = document,
};
this.ErrorListProvider.Tasks.Add(errorTask);
this.ErrorListProvider.Show();
this.ErrorListProvider.BringToFront();
}
开发者ID:NuPattern,项目名称:NuPattern,代码行数:16,代码来源:ErrorList.cs
示例10: Can_add_clear_error_list_tasks
public void Can_add_clear_error_list_tasks()
{
var mockServiceProvider = new Mock<IServiceProvider>();
mockServiceProvider.Setup(p => p.GetService(typeof(SVsTaskList))).Returns(new Mock<IVsTaskList>().Object);
var task = new ErrorTask();
var errorList = new DesignerErrorList(mockServiceProvider.Object);
Assert.Empty(errorList.Provider.Tasks);
errorList.AddItem(task);
Assert.Equal(new[] { task }, errorList.Provider.Tasks.Cast<ErrorTask>());
errorList.Clear();
Assert.Empty(errorList.Provider.Tasks);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:14,代码来源:DesignerErrorListTests.cs
示例11: CreateTask
/// <summary>
/// Creates task from occurence
/// </summary>
/// <param name="occurence"> occurence of defect</param>
/// <param name="fileName">file name of occurence</param>
/// <returns></returns>
Task CreateTask(Occurence occurence, string fileName)
{
var defectTask = new ErrorTask()
{
Category = TaskCategory.User,
ErrorCategory = TaskErrorCategory.Warning,
CanDelete = false,
Text = occurence.Message,
Document = fileName,
Line = int.Parse(occurence.StartLine)
};
defectTask.Navigate += navigateEventHandler;
return defectTask;
}
开发者ID:KarolAntczak,项目名称:Dexter,代码行数:20,代码来源:DexterTaskProvider.cs
示例12: ShowError
/// <summary>
/// Adds an error message to the Visual Studio tasks pane
/// </summary>
private void ShowError(string path, string text)
{
_message = new ErrorTask
{
ErrorCategory = TaskErrorCategory.Error,
Category = TaskCategory.Comments,
Document = path,
Line = 0,
Column = 0,
Text = text
};
_messageList.Tasks.Add(_message);
_messageList.Show();
}
开发者ID:octoberclub,项目名称:editorconfig-visualstudio,代码行数:18,代码来源:SettingsManager.cs
示例13: AddHierarchyItem
public void AddHierarchyItem(ErrorTask task)
{
IVsHierarchy HierarchyItem;
IVsSolution solution = EditorExtensionsPackage.GetGlobalService<IVsSolution>(typeof(SVsSolution));
if (solution != null)
{
int flag = solution.GetProjectOfUniqueName(_connection.Project.FullName, out HierarchyItem);
if (0 == flag)
{
task.HierarchyItem = HierarchyItem;
}
}
}
开发者ID:ncl-dmoreira,项目名称:WebEssentials2013,代码行数:15,代码来源:BestPracticesBrowserLink.cs
示例14: ProduceErrorListTask
public static Task ProduceErrorListTask(this IStylingRule rule, TaskErrorCategory category, Project project, string format)
{
var item = ResolveVsHierarchyItem(project.UniqueName);
var task = new ErrorTask
{
Document = rule.File,
Line = rule.Line - 1,
Column = rule.Column,
ErrorCategory = category,
Category = TaskCategory.Html,
Text = string.Format(format, project.Name, rule.DisplaySelectorName, rule.File, rule.Line, rule.Column),
HierarchyItem = item
};
task.Navigate += NavigateToItem;
return task;
}
开发者ID:robert-hoffmann,项目名称:WebEssentials2013,代码行数:18,代码来源:RuleExtensions.cs
示例15: AddError
public void AddError(ITextSnapshot snapshot, Diagnostic diagnostic, TextSpan span)
{
var line = snapshot.GetLineFromPosition(span.Start);
var task = new ErrorTask
{
Text = diagnostic.Message,
Line = line.LineNumber,
Column = span.Start - line.Start.Position,
Category = TaskCategory.CodeSense,
ErrorCategory = TaskErrorCategory.Error,
Priority = TaskPriority.Normal,
Document = span.Filename
};
task.Navigate += OnTaskNavigate;
_errorListProvider.Tasks.Add(task);
}
开发者ID:davidlee80,项目名称:HlslTools,代码行数:19,代码来源:ErrorListHelper.cs
示例16: BuildErrorTask
private IEnumerable<IGooseErrorTask> BuildErrorTask(ShellCommand command, string content)
{
var output = this.logParser.Parse(content);
return output.Results
.Where(error => error.Type.Equals(CommandOutputItemType.Error))
.Select(error =>
{
var errorTask = new ErrorTask
{
CanDelete = true,
Column = 0,
Line = (int) error.Line,
Document = error.FullPath,
Text = string.Format("{0}{1}{2}", error.Message, Environment.NewLine, error.Excerpt)
};
return new GooseErrorTask(command, errorTask);
});
}
开发者ID:sebastianhallen,项目名称:Goose,代码行数:19,代码来源:CommandErrorReporter.cs
示例17: add_Task
public static ErrorTask add_Task(this ErrorListProvider errorListProvider, TaskErrorCategory errorCategory, string text, string file = null, int line = 1, int column= 1)
{
var errorTask = new ErrorTask()
{
ErrorCategory = errorCategory,
Category = TaskCategory.BuildCompile,
Text = text,
Document = file,
Line = line -1,
Column = column -1,
//HierarchyItem = hierarchyItem
};
errorListProvider.Tasks.Add(errorTask);
errorTask.Navigate += (sender,e)=> {
file.open_Document();
(VisualStudio_2010.DTE2.ActiveDocument.Selection as EnvDTE.TextSelection).GotoLine(line, true);
};
return errorTask;
}
开发者ID:o2platform,项目名称:O2.Platform.VisualStudio,代码行数:19,代码来源:VisualStudio_2010_ExtensionMethods_ErrorList.cs
示例18: Write
public void Write(TaskCategory category, TaskErrorCategory errorCategory, string text, string document, int? line = null, int? column = null)
{
ErrorTask task = new ErrorTask();
task.Text = text;
task.ErrorCategory = errorCategory;
int? startLine, startColumn, endLine, endColumn;
ParseErrorLocation(text, out startLine, out startColumn, out endLine, out endColumn);
task.Line = (line ?? startLine ?? 1) - 1;
task.Column = (column ?? startColumn ?? 1) - 1;
task.Document = document;
task.Category = category;
if (!string.IsNullOrEmpty(document))
{
task.Navigate += NavigateDocument;
}
_errorListProvider.Tasks.Add(task);
}
开发者ID:rpete4130,项目名称:vsClojure,代码行数:20,代码来源:ErrorListHelper.cs
示例19: AddHierarchyItem
private static void AddHierarchyItem(ErrorTask task, EnvDTE.Project project)
{
IVsSolution solution = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution;
if (solution == null || project == null)
return;
try
{
IVsHierarchy hierarchyItem = null;
if (solution.GetProjectOfUniqueName(project.FullName, out hierarchyItem) == 0)
{
task.HierarchyItem = hierarchyItem;
}
}
catch (COMException ex)
{
Logger.Log(ex);
}
}
开发者ID:QuinntyneBrown,项目名称:WebLinter,代码行数:20,代码来源:ErrorList.cs
示例20: Add
private IErrorItem Add(string text, Action<IErrorItem> handler, bool isWarning)
{
var errorTask = new ErrorTask();
errorTask.Category = TaskCategory.Misc;
errorTask.ErrorCategory = isWarning ? TaskErrorCategory.Warning : TaskErrorCategory.Error;
errorTask.Text = text;
var errorItem = new ErrorItem(this.errorListProvider, errorTask);
errorTask.Navigate += (sender, e) =>
{
if (handler != null)
handler(errorItem);
};
this.errorListProvider.Tasks.Add(errorTask);
return errorItem;
}
开发者ID:joj,项目名称:clide,代码行数:20,代码来源:ErrorsManager.cs
注:本文中的Microsoft.VisualStudio.Shell.ErrorTask类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论