protected bool Equals(GCCErrorListItem other) { return(ProjectNumber == other.ProjectNumber && string.Equals(Filename, other.Filename) && Line == other.Line && Column == other.Column && string.Equals(Text, other.Text) && ErrorType == other.ErrorType); }
private static void AddTask(GCCErrorListItem item, TaskErrorCategory category) { try { // Visual studio has a bug of showing each gcc message twice. Make sure this error list item doesn't exist already if (item == null || CurrentListItems.Contains(item)) { return; } var task = new ErrorTask { Category = TaskCategory.BuildCompile, ErrorCategory = category, Text = item.Text }; switch (item.ErrorType) { case GCCErrorType.Full: task.Navigate += TaskOnNavigate; task.Line = item.Line - 1; // Visual studio starts counting from 0 task.Column = item.Column - 1; // Visual studio starts counting from 0 task.Document = GetFileByProjectNumber(item.ProjectNumber, item.Filename); task.HierarchyItem = GetItemHierarchy(task.Document); break; case GCCErrorType.GCCOnly: task.Document = item.Filename; var project = GetProjectByNumber(item.ProjectNumber); task.HierarchyItem = GetProjectHierarchy(project); break; case GCCErrorType.NoDetails: break; default: throw new ArgumentOutOfRangeException(); } _errorListProvider.Tasks.Add(task); CurrentListItems.Add(item); } catch (Exception e) { // eat it Log.LogError(e.ToString()); } }
public IList <ClassificationSpan> GetClassificationSpans(SnapshotSpan span) { try { var spans = new List <ClassificationSpan>(); var snapshot = span.Snapshot; if (snapshot == null || snapshot.Length == 0) { return(spans); } if (_classifiers == null) { UpdateClassifiers(); } var classifiers = _classifiers ?? new List <Classifier>(); var start = span.Start.GetContainingLine().LineNumber; var end = (span.End - 1).GetContainingLine().LineNumber; for (var i = start; i <= end; i++) { var line = snapshot.GetLineFromLineNumber(i); if (line == null) { continue; } var snapshotSpan = new SnapshotSpan(line.Start, line.Length); var text = line.Snapshot.GetText(snapshotSpan); if (string.IsNullOrEmpty(text)) { continue; } var classificationName = classifiers.FirstOrDefault(classifier => classifier.Test(text)).Type; if (classificationName == null) { continue; } switch (classificationName) { case ClassificationTypeDefinitions.LogError: GCCErrorGenerator.AddError(GCCErrorListItem.Parse(text)); break; case ClassificationTypeDefinitions.LogWarn: GCCErrorGenerator.AddWarning(GCCErrorListItem.Parse(text)); break; case ClassificationTypeDefinitions.LogInfo: GCCErrorGenerator.AddMessage(GCCErrorListItem.Parse(text)); break; } } return(spans); } catch (FormatException) { // eat it. return(new List <ClassificationSpan>()); } catch (RegexMatchTimeoutException) { // eat it. return(new List <ClassificationSpan>()); } catch (NullReferenceException) { // eat it. return(new List <ClassificationSpan>()); } catch (Exception ex) { Log.LogError(ex.ToString()); throw; } }
public static void AddMessage(GCCErrorListItem item) { AddTask(item, TaskErrorCategory.Message); }
public static void AddWarning(GCCErrorListItem item) { AddTask(item, TaskErrorCategory.Warning); }
public static void AddError(GCCErrorListItem item) { AddTask(item, TaskErrorCategory.Error); }