public void AddTask(TaskItem item) { items.Add(item); }
// helper methods. public TaskItem CreateErrorTaskItem(TextSpan span, string message, Severity severity) { //normalize text span TextSpanHelper.TextSpanNormalize(ref span, textLines); //remove control characters StringBuilder sb = new StringBuilder(); for (int i = 0, n = message.Length; i<n; i++) { char ch = message[i]; sb.Append( System.Convert.ToInt32(ch) < 0x20 ? ' ' : ch); } message = sb.ToString(); //set options VsShellInterop.VSTASKPRIORITY priority = VsShellInterop.VSTASKPRIORITY.TP_NORMAL; VsShellInterop._vstaskbitmap bitmap = VsShellInterop._vstaskbitmap.BMP_SQUIGGLE; VsShellInterop.VSTASKCATEGORY category = VsShellInterop.VSTASKCATEGORY.CAT_CODESENSE; MARKERTYPE markerType = MARKERTYPE.MARKER_CODESENSE_ERROR; if (severity == Severity.SevFatal) { priority = VsShellInterop.VSTASKPRIORITY.TP_HIGH; } else if (severity == Severity.SevHint) { if (this.taskProvider != null) { if (!taskProvider.IsTaskToken(message, out priority )) return null; } bitmap = VsShellInterop._vstaskbitmap.BMP_COMMENT; category = VsShellInterop.VSTASKCATEGORY.CAT_COMMENTS; markerType = MARKERTYPE.MARKER_INVISIBLE; } // create marker so task item navigation works even after file is edited. IVsTextLineMarker textLineMarker = TextMarkerClient.CreateMarker(textLines, span, markerType, message); string fileName = this.GetFilePath(); // create task item TaskItem taskItem = new TaskItem(this.service.site, textLineMarker, fileName, message, true, category, priority, bitmap, null ); return taskItem; }
public TaskEnumerator(TaskItem[] items) { this.items = items; }