public static Result <IVsEnumLineMarkers> GetLineMarkersEnum(this IVsTextLines lines, TextSpan span)
        {
            IVsEnumLineMarkers markers;
            var hresult = lines.EnumMarkers(span.iStartLine, span.iStartIndex, span.iEndLine, span.iEndIndex, 0, (uint)ENUMMARKERFLAGS.EM_ALLTYPES, out markers);

            return(Result.CreateSuccessOrError(markers, hresult));
        }
Beispiel #2
0
        ArrayList GetTextMarkers()
        {
            ArrayList          markers = new ArrayList();
            TextSpan           docSpan = this.source.GetDocumentSpan();
            IVsTextLines       buffer  = this.source.GetTextLines();
            IVsEnumLineMarkers ppEnum;
            int  iMarkerType = 0;
            uint dwFlags     = (uint)ENUMMARKERFLAGS.EM_ALLTYPES;
            int  hr          = buffer.EnumMarkers(docSpan.iStartLine, docSpan.iStartIndex, docSpan.iEndLine, docSpan.iEndIndex, iMarkerType, dwFlags, out ppEnum);

            if (hr == NativeMethods.S_OK)
            {
                IVsTextLineMarker marker;
                TextSpan[]        pSpan = new TextSpan[1];
                while (ppEnum.Next(out marker) == NativeMethods.S_OK)
                {
                    if (marker != null)
                    {
                        if (marker.GetCurrentSpan(pSpan) == NativeMethods.S_OK)
                        {
                            markers.Add(pSpan[0]);
                        }
                    }
                }
            }
            return(markers);
        }
        private static void cleanupMarkers(IVsTextLines textLines, int markerType)
        {
            IVsEnumLineMarkers markers;

            textLines.EnumMarkers(0, 0, 0, 0, markerType, (uint)ENUMMARKERFLAGS.EM_ENTIREBUFFER, out markers);

            int count;

            markers.GetCount(out count);

            for (int i = 0; i < count; ++i)
            {
                IVsTextLineMarker marker;
                markers.Next(out marker);
                if (marker != null)
                {
                    marker.Invalidate();
                }
            }
        }
Beispiel #4
0
 public int EnumMarkers(
     int iStartLine, int iStartIndex, int iEndLine, int iEndIndex, int iMarkerType, uint dwFlags, out IVsEnumLineMarkers ppEnum)
 {
     return(_textBuffer.EnumMarkers(iStartLine, iStartIndex, iEndLine, iEndIndex, iMarkerType, dwFlags, out ppEnum));
 }