private void AddTask(ITextSnapshot snapshot, ErrorListProvider errorListProvider, CompilerMessage msg) { var startPos = msg.Location.Span.StartPos; if (startPos > snapshot.Length) { return; } var line = snapshot.GetLineFromPosition(startPos); var col = startPos - line.Start.Position; var text = VsUtils.ToText(msg.Text); var task = new ErrorTask() { Text = text, Category = TaskCategory.CodeSense, ErrorCategory = VsUtils.ConvertMessageType(msg.Type), Priority = TaskPriority.High, HierarchyItem = Hierarchy, Line = line.LineNumber, Column = col, Document = FullPath, }; task.Navigate += Task_Navigate; errorListProvider.Tasks.Add(task); foreach (var nested in msg.NestedMessages) { AddTask(snapshot, errorListProvider, nested); } }