Example #1
0
        private IDocumentMarkup TryGetDocumentMarkup()
        {
            IVsTextBuffer bufferAdapter = _editorAdaptersFactoryService.GetBufferAdapter(_textBuffer);

            if (bufferAdapter == null)
            {
                return(null);
            }

            IDocument document = new JetVsTextBuffer(bufferAdapter).JetDocument.Value;

            if (document == null)
            {
                return(null);
            }

            IDocumentMarkup documentMarkup = DocumentMarkupManagerBase.TryGetMarkupModel(document);

            if (documentMarkup == null || !documentMarkup.GetType().Name.StartsWith("Vs", StringComparison.Ordinal))
            {
                return(null);
            }

            return(documentMarkup);
        }
Example #2
0
        private IDocumentMarkup TryGetDocumentMarkup()
        {
            VSIVsTextBuffer bufferAdapter = _editorAdaptersFactoryService.GetBufferAdapter(_textBuffer);

            if (bufferAdapter == null)
            {
                return(null);
            }

            IDocument document = new JetIVsTextBuffer(bufferAdapter).JetDocument.Value;

            if (document == null)
            {
                return(null);
            }

            IDocumentMarkup documentMarkup = DocumentMarkupManagerBase.TryGetMarkupModel(document);

            return(documentMarkup is IVsDocumentMarkup ? documentMarkup : null);
        }