Exemple #1
0
 public static Breakpoint CreateBreakpoint(Break breakpoint)
 {
     return(new Breakpoint
     {
         Filename = breakpoint.File,
         Line = breakpoint.FileLine,
         Enabled = breakpoint.Enabled
     });
 }
Exemple #2
0
 public BreakPoint(EnvDTE.Breakpoint bp)
 {
     this.Condition            = bp.Condition;
     this.File                 = bp.File;
     this.FileColumn           = bp.FileColumn;
     this.FileLine             = bp.FileLine;
     this.FunctionColumnOffset = bp.FunctionColumnOffset;
     this.FunctionLineOffset   = bp.FunctionLineOffset;
     this.FunctionName         = bp.FunctionName;
     this.Name                 = bp.Name;
     this.Enabled              = bp.Enabled;
 }
        List <Line> CollectLines(TextView textView, int width_divisor)
        {
            List <Line> lines = new List <Line>();

            if (shutting_down)
            {
                return(lines);
            }

            int    start = 0;
            int    end   = 0;
            string tabs  = new string(' ', textView.TextDocument.TabSize);

            string line_comment_start;

            if (textView.TextDocument.Language == "Basic")
            {
                line_comment_start = "'";
            }
            else
            {
                line_comment_start = "//";
            }

            for (int l = 0; l < textView.TextDocument.LineCount; l++)
            {
                string txt     = textView.TextDocument.GetLine(l).TrimEnd();
                string org_txt = txt;
                if (txt.IndexOf('\t') >= 0)
                {
                    txt = txt.Replace("\t", tabs);
                }

                string ltr = txt.TrimStart();
                start = (txt.Length - ltr.Length);
                end   = txt.Length;

                int start_of_comment = txt.IndexOf(line_comment_start);
                int end_of_comment   = -2;
                if (start_of_comment >= 0)
                {
                    end_of_comment = end;
                    end            = start_of_comment - 1;
                }
                //int word_start = txt.IndexOf(selected_double_click, StringComparison.InvariantCultureIgnoreCase);
                Line line = new Line(l, start, end, start_of_comment, end_of_comment, CollectWordIndexes(ref org_txt));

                line.DivideWidth(width_divisor);
                line.PressIntoWidth(Width);

                try
                {
                    EnvDTE.Breakpoint bp = CodeRush.Breakpoint.Get(textView.TextDocument.FullName, l);
                    if (bp != null && bp.Enabled)
                    {
                        line.HasBreakpoint = true;
                    }
                }
                catch (Exception)
                {
                }
                lines.Add(line);
            }

            foreach (IMarker item in CodeRush.Markers)
            {
                if (textView.TextDocument.FullName.Equals(item.FileName, StringComparison.InvariantCultureIgnoreCase))
                {
                    if (lines.Count >= item.Line && item.Hidden == false)
                    {
                        lines[item.Line].MarkerPosition = item.Column / width_divisor;
                    }
                }
            }

            return(lines);
        }