public static IList <TextSpan> GetHiddenRegions(this IVsEnumHiddenRegions enumHiddenRegions)
        {
            IList <TextSpan> regions = null;

            uint count = GetCount(enumHiddenRegions);

            if (count > 0)
            {
                regions = new List <TextSpan>((int)count);

                var hiddenRegions = new IVsHiddenRegion[count];

                enumHiddenRegions.Reset();
                enumHiddenRegions.Next(count, hiddenRegions, out count);

                for (int i = 0; i < count; i++)
                {
                    IVsHiddenRegion hiddenRegion = hiddenRegions[i];

                    uint state = 0;
                    hiddenRegion.GetState(out state);
                    if ((state & (uint)HIDDEN_REGION_STATE.hrsExpanded) == 0)
                    {
                        TextSpan[] pSpan = new TextSpan[1];
                        hiddenRegion.GetSpan(pSpan);
                        regions.Add(pSpan[0]);
                    }
                }
            }

            return(regions);
        }
        public int GetTipText(IVsHiddenRegion pHidReg, string[] pbstrText = null)
        {
            //pHidReg.Invalidate((uint)CHANGE_HIDDEN_REGION_FLAGS.chrNonUndoable);
            TextSpan[] textSpans = new TextSpan[1];
            pHidReg.GetSpan(textSpans);
            pbstrText[0] = DateTime.Now.ToString();

            return VSConstants.S_OK;
        }
Exemple #3
0
        public int GetTipText(IVsHiddenRegion pHidReg, string[] pbstrText = null)
        {
            //pHidReg.Invalidate((uint)CHANGE_HIDDEN_REGION_FLAGS.chrNonUndoable);
            TextSpan[] textSpans = new TextSpan[1];
            pHidReg.GetSpan(textSpans);
            pbstrText[0] = DateTime.Now.ToString();

            return(VSConstants.S_OK);
        }
Exemple #4
0
 public int GetTipText(IVsHiddenRegion region, string[] result)
 {
     if (result != null && result.Length > 0)
     {
         TextSpan[] aspan = new TextSpan[1];
         NativeMethods.ThrowOnFailure(region.GetSpan(aspan));
         result[0] = this.GetText(aspan[0]);
     }
     return NativeMethods.S_OK;
 }
Exemple #5
0
        /// <include file='doc\Source.uex' path='docs/doc[@for="Source.GetTipText"]/*' />
        public virtual int GetTipText(IVsHiddenRegion region, string[] result)
        {
            if (result != null && result.Length > 0) {
                TextSpan[] aspan = new TextSpan[1];
                NativeMethods.ThrowOnFailure(region.GetSpan(aspan));

                // Limit lines.
                TextSpan span = aspan[0];
                int spanLineCount = span.iEndLine - span.iStartLine + 1;
                bool truncated = spanLineCount > lineCountLimitForGetTipText;
                StringBuilder stringBuilder =
                    GetLineSpans(span)
                        .Take(lineCountLimitForGetTipText)
                        .Select(s => LimitLineSpan(s, lineLengthLimitForGetTipText))
                        .Select(lineSpan => this.GetText(lineSpan.span) + (lineSpan.truncated ? "..." : String.Empty))
                        .Aggregate(new StringBuilder(), (sb, lineText) => sb.AppendLine(lineText));

                result[0] = stringBuilder.ToString() + (truncated ? " ..." : String.Empty);
            }
            return NativeMethods.S_OK;
        }