Exemple #1
0
            private ContentControl CreateToolTipContent(ITextBuffer textBuffer)
            {
                var regionSpan   = this.GetRegionSpanForReference();
                var snapshotSpan = textBuffer.CurrentSnapshot.GetSpan(regionSpan);

                var contentType = Presenter.ContentTypeRegistryService.GetContentType(
                    IProjectionBufferFactoryServiceExtensions.RoslynPreviewContentType);

                var roleSet = Presenter.TextEditorFactoryService.CreateTextViewRoleSet(
                    TextViewRoles.PreviewRole,
                    PredefinedTextViewRoles.Analyzable,
                    PredefinedTextViewRoles.Document,
                    PredefinedTextViewRoles.Editable);

                var content = new ProjectionBufferDeferredContent(
                    snapshotSpan,
                    Presenter.ProjectionBufferFactoryService,
                    Presenter.EditorOptionsFactoryService,
                    Presenter.TextEditorFactoryService,
                    contentType,
                    roleSet);

                var element = content.Create();

                return(element);
            }
Exemple #2
0
        private IWpfTextView CreateView(ProjectionBufferDeferredContent deferredContent, ITextBuffer buffer)
        {
            var view = _textEditorFactoryService.CreateTextView(
                buffer, deferredContent.RoleSet ?? _textEditorFactoryService.NoRoles);

            view.SizeToFit();
            view.Background = Brushes.Transparent;

            // Zoom out a bit to shrink the text.
            view.ZoomLevel *= 0.75;

            return(view);
        }
Exemple #3
0
 private IProjectionBuffer CreateBuffer(ProjectionBufferDeferredContent deferredContent)
 {
     return(_projectionBufferFactoryService.CreateProjectionBufferWithoutIndentation(
                _editorOptionsFactoryService.GlobalOptions, deferredContent.ContentType, deferredContent.Span));
 }