コード例 #1
0
        public void ConstructMenu(GetSmartTagItemsEventArgs ea)
        {
            var artifacts = new ApprovalArtifacts(CodeRush.Source.ActiveMethod);

            ea.Add(new RunTestItem("Test"));

            if (artifacts.HasReceivedFile())
            {
                var received = new SmartTagItem("Received File");
                received.AddItem(new OpenFileItem("View", artifacts.Received));
                received.AddItem(new CopyPathItem("Copy File Path", artifacts.Received));
                received.AddItem(new OpenInExplorerItem("Show in Explorer", artifacts.Received));
                ea.Add(received);
            }

            var approved = new SmartTagItem("Approved File");
            approved.AddItem(new OpenFileItem("View", artifacts.Approved));
            approved.AddItem(new CopyPathItem("Copy File Path", artifacts.Approved));
            approved.AddItem(new OpenInExplorerItem("Show in Explorer", artifacts.Approved));
            approved.AddItem(new LoadApproveItem("Set Approval", artifacts.Approved));
            ea.Add(approved);

            if (artifacts.HasReceivedFile() && artifacts.HasApprovalFile())
                ea.Add(new DiffItem("Diff", artifacts.Received, artifacts.Approved));

            if (artifacts.HasReceivedFile()) {
                ea.Add(new OpenFileItem("View Received", artifacts.Received));
                ea.Add(new ApproveItem("Approve", artifacts.Received, artifacts.Approved));
            }
        }
コード例 #2
0
        private void ApprovalTestsPlugin_EditorPaintLanguageElement(EditorPaintLanguageElementEventArgs ea)
        {
            LanguageElement element = ea.LanguageElement;

            if (IsApproveCall(element) && element.ElementType == LanguageElementType.MethodCall)
            {
                var approvalFiles = new ApprovalArtifacts(element.GetMethod());
                Color lineColor = GetColorForApproval(approvalFiles.TestStatus);

                SourceRange range = element.Range;
                ea.PaintArgs.DrawLine(range.Start.Line, range.Start.Offset, range.End.Offset - range.Start.Offset, lineColor,
                                      LineStyle.SolidUnderline);
            }
        }