コード例 #1
0
        public override int ValidateBreakpointLocation(IVsTextBuffer buffer, int line, int col, TextSpan[] pCodeSpan)
        {
            int curline = line;
            int pos;
            int linelen;
            int nlines;

            buffer.GetLineCount(out nlines);


            do
            {
                buffer.GetPositionOfLine(curline, out pos);
                buffer.GetLengthOfLine(curline, out linelen);
                if (linelen == 0)
                {
                    curline++;
                    continue;
                }
                pCodeSpan[0].iStartLine  = curline;
                pCodeSpan[0].iStartIndex = 0;
                pCodeSpan[0].iEndLine    = curline;
                pCodeSpan[0].iEndIndex   = linelen;
                return(VSConstants.S_OK);
            }while (linelen == 0 && curline < nlines);
            //cannot find a better position, just use the one given even if doesn't make sense
            buffer.GetPositionOfLine(line, out pos);
            buffer.GetLengthOfLine(line, out linelen);
            pCodeSpan[0].iStartLine  = line;
            pCodeSpan[0].iStartIndex = 0;
            pCodeSpan[0].iEndLine    = line;
            pCodeSpan[0].iEndIndex   = linelen;

            return(VSConstants.S_FALSE);
        }