public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            string source = textViewHost.TextView.TextBuffer.CurrentSnapshot.GetText();
            ITextDocument document;

            if (textViewHost.TextView.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document))
            {
                switch (textViewHost.TextView.TextBuffer.ContentType.DisplayName)
                {
                    case "LESS":
                        bool showLess = WESettings.GetBoolean(WESettings.Keys.ShowLessPreviewWindow);
                        return new LessMargin("CSS", source, showLess, document);

                    //case "scss":
                    //    return new ScssMargin("CSS", source, true, document);

                    case "CoffeeScript":
                        bool showCoffee = WESettings.GetBoolean(WESettings.Keys.ShowCoffeeScriptPreviewWindow);
                        return new CoffeeScriptMargin("JavaScript", source, showCoffee, document);

                    //case "TypeScript":
                    //    if (!document.FilePath.EndsWith(".d.ts"))
                    //    {
                    //        bool showType = WESettings.GetBoolean(WESettings.Keys.ShowTypeScriptPreviewWindow);
                    //        return new TypeScriptMargin("TypeScript", source, showType, document);
                    //    }
                    //    break;

                    case "markdown":
                        return new MarkdownMargin("text", source, true, document);
                }
            }

            return null;
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost view_host, IWpfTextViewMargin container_margin)
        {
            IWpfTextView text_view = view_host.TextView;

            try
            {
                Utils.VSVersion = Assembly.GetCallingAssembly().GetName().Version.Major.ToString();
            }
            catch { }

            if (!PresenceSent)
            {
                PresenceSent = true;
                MonitoringService.SendPresense();
            }

            if (!SettingsLoaded)
                ReadSettings(OptionsService.GlobalOptions);

            RemoveVerticalScrollBar(container_margin);

            var navigator = TextStructureNavigatorService.GetTextStructureNavigator(text_view.TextBuffer);
            var format = FormatMapService.GetEditorFormatMap(text_view);
            var tagger = HighlightWordTagger.Instance(text_view, format, TextSearchService, navigator);
            var marks_enumerator = new MarksEnumerator(AggregatorFactoryService, text_view);
            var change_enumerator = new ChangeEnumerator(AggregatorFactoryService, text_view);
            var words_enumerator = new HighlightedWordsEnumerator(text_view, tagger);

            return new RockMargin(text_view, marks_enumerator, change_enumerator, words_enumerator, tagger);
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            if (!ExtensibilityToolsPackage.Options.ShowBottomMargin)
                return null;

            return new BottomMargin(wpfTextViewHost.TextView, _classifierService, _documentService);
        }
 public GlyphMouseProcessor(IWpfTextViewHost host, IWpfTextViewMargin margin, ITagAggregator<IGlyphTag> aggregator)
 {
     this.theHost = host;
     this.theMargin = margin;
     this.tagAggregator = aggregator;
     this.theHost.Closed += OnTextViewHostClosed;
 }
        IWpfTextViewMargin IWpfTextViewMarginProvider.CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            // If the notification has occured then there is nothing else to do.  We are done
            if (_vimApplicationSettings.HaveNotifiedBackspaceSetting)
            {
                return null;
            }

            // On the very first IVimBuffer creation the vimrc will be loaded.  Go ahead and
            // attempt to get / create the buffer to ensure the vimrc load has been attempted
            var wpfTextView = wpfTextViewHost.TextView;
            IVimBuffer vimBuffer;
            if (!_vim.TryGetOrCreateVimBufferForHost(wpfTextView, out vimBuffer))
            {
                return null;
            }

            // If there is no vimrc or the load does allow backspace over start then there
            // is no need to display the warning
            if (_vim.GlobalSettings.IsBackspaceStart || _vimApplicationSettings.UseEditorTabAndBackspace)
            {
                return null;
            }

            var editorFormatMap = _editorFormatMapService.GetEditorFormatMap(wpfTextView);
            var linkBanner = new LinkBanner();
            linkBanner.MarginName = Name;
            linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#wiki-backspace";
            linkBanner.LinkText = "FAQ";
            linkBanner.BannerText = "You may want to change the backspace setting in your vimrc";
            linkBanner.Background = editorFormatMap.GetBackgroundBrush(EditorFormatDefinitionNames.Margin, MarginFormatDefinition.DefaultColor);
            linkBanner.CloseClicked += (sender, e) => { _vimApplicationSettings.HaveNotifiedBackspaceSetting = true; };
            return linkBanner;
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            int iErrStat;

            //_contentTypeRegistryService = ContentTypeRegistryService;
            //_textBufferFactoryService = TextBufferFactoryService;

            //DTE2 dte = (DTE2)serviceProvider.GetService(typeof(DTE));

            //iErrStat = GetHiddenTextManager(serviceProvider);


            //IComponentModel componentModel = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));
            //IVsEditorAdaptersFactoryService adapterFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();

            
            ////System.Diagnostics.Trace.WriteLine(":" + _textBufferFactoryService.TextContentType.ToString());
            //_curTextBuf = _textBufferFactoryService.CreateTextBuffer("test", _textBufferFactoryService.PlaintextContentType);

            foreach (IViewTaggerProvider vtp in viewTaggerProviderCollection)
            {
                if (vtp is TextInvisTaggerProvider)
                {
                    _titp = vtp as TextInvisTaggerProvider;
                    break;
                }
            }
            if (_titp == null)
            {
                System.Diagnostics.Trace.WriteLine("no valid tagger, exit");
                return null;
            }
            return new TestMargin(textViewHost.TextView, _titp.GetThyTagger());
        }
Beispiel #7
0
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            IWpfTextView view = textViewHost.TextView;

            // Files larger than 1 MB should be skipped to avoid hangs.
            if (view.TextSnapshot.Length > (1024 * 1024))
                return null;

            ITextDocument document;
            if (!_TextDocumentFactoryService.TryGetTextDocument(view.TextDataModel.DocumentBuffer, out document))
                return null;

            IVsExtensionManager manager = _serviceProvider.GetService(typeof(SVsExtensionManager)) as IVsExtensionManager;
            if (manager == null)
                return null;

            IInstalledExtension extension;
            manager.TryGetInstalledExtension("FixMixedTabs", out extension);
            if (extension != null)
                return null;

            ITextUndoHistory history;
            if (!_UndoHistoryRegistry.TryGetHistory(view.TextBuffer, out history))
            {
                Debug.Fail("Unexpected: couldn't get an undo history for the given text buffer");
                return null;
            }

            return new InformationBarMargin(view, document, _OperationsFactory.GetEditorOperations(view), history);
        }
        public SimpleScrollBar(IWpfTextViewHost host, IWpfTextViewMargin containerMargin, FrameworkElement container,
            IScrollMapFactoryService scrollMapFactoryService)
        {
            _textView = host.TextView;

            _realScrollBarMargin =
                containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IWpfTextViewMargin;
            if (_realScrollBarMargin != null)
            {
                _realScrollBar = _realScrollBarMargin as IVerticalScrollBar;
                if (_realScrollBar != null)
                {
                    _realScrollBarMargin.VisualElement.IsVisibleChanged += OnScrollBarIsVisibleChanged;
                    _realScrollBar.TrackSpanChanged += OnScrollBarTrackSpanChanged;
                }
            }
            ResetTrackSpan();

            _scrollMapFactory = scrollMapFactoryService;
            _useElidedCoordinates = false;
            ResetScrollMap();

            _scrollMap.MappingChanged += delegate { RaiseTrackChangedEvent(); };

            container.SizeChanged += OnContainerSizeChanged;
        }
 public IMouseProcessor GetAssociatedMouseProcessor(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
 {
     return new GlyphMouseProcessor(
     wpfTextViewHost, margin,
     aggregatorFactory.CreateTagAggregator<IGlyphTag>(wpfTextViewHost.TextView.TextBuffer)
     );
 }
		public GlyphTextMarkerServiceMouseProcessor(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin) {
			if (glyphTextMarkerServiceImpl == null)
				throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
			if (wpfTextViewHost == null)
				throw new ArgumentNullException(nameof(wpfTextViewHost));
			if (margin == null)
				throw new ArgumentNullException(nameof(margin));
			glyphTextViewMarkerService = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextViewHost.TextView);
			this.wpfTextViewHost = wpfTextViewHost;
			this.margin = margin;
			toolTipDispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, margin.VisualElement.Dispatcher);
			popup = new Popup { AllowsTransparency = true };

			var list = new List<IGlyphTextMarkerMouseProcessor>();
			foreach (var lazy in glyphTextMarkerServiceImpl.GlyphTextMarkerMouseProcessorProviders) {
				if (lazy.Metadata.TextViewRoles != null && !wpfTextViewHost.TextView.Roles.ContainsAny(lazy.Metadata.TextViewRoles))
					continue;
				var mouseProcessor = lazy.Value.GetAssociatedMouseProcessor(wpfTextViewHost, margin);
				if (mouseProcessor != null)
					list.Add(mouseProcessor);
			}
			glyphTextMarkerMouseProcessors = list.ToArray();
			wpfTextViewHost.TextView.Closed += TextView_Closed;
			wpfTextViewHost.TextView.LayoutChanged += TextView_LayoutChanged;
			toolTipDispatcherTimer.Tick += ToolTipDispatcherTimer_Tick;
			popup.Closed += Popup_Closed;
			glyphTextViewMarkerService.AddGlyphTextMarkerListener(this);
		}
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            string source = textViewHost.TextView.TextBuffer.CurrentSnapshot.GetText();
            ITextDocument document;

            if (TextDocumentFactoryService.TryGetTextDocument(textViewHost.TextView.TextDataModel.DocumentBuffer, out document))
            {
                switch (textViewHost.TextView.TextBuffer.ContentType.DisplayName.ToLowerInvariant())
                {
                    case "less":
                        bool showLess = WESettings.GetBoolean(WESettings.Keys.ShowLessPreviewWindow);
                        return new LessMargin("CSS", source, showLess, document);

                    case "coffeescript":
                        bool showCoffee = WESettings.GetBoolean(WESettings.Keys.ShowCoffeeScriptPreviewWindow);
                        return new CoffeeScriptMargin("JavaScript", source, showCoffee, document);

                    case "markdown":
                        bool showMarkdown = WESettings.GetBoolean(WESettings.Keys.MarkdownShowPreviewWindow);
                        return new MarkdownMargin("text", source, showMarkdown, document);
                }
            }

            return null;
        }
        public override IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            var marginCore = TryGetMarginCore(textViewHost);
            if (marginCore == null)
                return null;

            return new EditorDiffMargin(textViewHost.TextView, marginCore);
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            string fileName = GetFileNameFromTextBuffer(wpfTextViewHost.TextView.TextBuffer);

            IEnumerable<SonarIssue> issues = _sonarIssuesService.GetIssuesForFile(fileName);

            return new SonarIssueTextViewMargin(issues, wpfTextViewHost, marginContainer, _scrollMapFactoryService);
        }
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
 {
     return new RelativeNumber(
         textViewHost.TextView, 
         FormatMapService.GetEditorFormatMap(textViewHost.TextView), 
         containerMargin,
         OutliningManagerService.GetOutliningManager(textViewHost.TextView));
 }
Beispiel #15
0
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            if (!VisualDHelper.setFactory(editorFactory))
                return null;

            //MessageBox.Show("CreateMargin");
            return new CoverageMargin(textViewHost.TextView, FormatMapService.GetEditorFormatMap(textViewHost.TextView));
        }
        public IGlyphFactory GetGlyphFactory(IWpfTextView view, IWpfTextViewMargin margin)
        {
            AccentGlyphFactory factory = new AccentGlyphFactory();
            factory.View = view;
            factory.FormatMapService = FormatMapService;

            return factory;
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            var generalOptions = Utils.GetGeneralOptionsPage(serviceProvider);
            if (!generalOptions.UnusedDeclarationsEnabled) return null;

 	        var textView = wpfTextViewHost.TextView;
            return new UnusedDeclarationMargin(textView, marginContainer,
                           classifierAggregatorService.GetClassifier(textView.TextBuffer));
        }
		public IWpfTextViewMarginProviderCollection Create(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer, string marginContainerName) {
			if (wpfTextViewHost == null)
				throw new ArgumentNullException(nameof(wpfTextViewHost));
			if (marginContainer == null)
				throw new ArgumentNullException(nameof(marginContainer));
			if (marginContainerName == null)
				throw new ArgumentNullException(nameof(marginContainerName));
			return new WpfTextViewMarginProviderCollection(wpfTextViewMarginProviders, wpfTextViewHost, marginContainer, marginContainerName);
		}
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            var generalOptions = Setting.getGeneralOptions(_serviceProvider);
            if (generalOptions == null || !(generalOptions.UnusedReferencesEnabled || generalOptions.UnusedOpensEnabled)) return null;

             	        var textView = wpfTextViewHost.TextView;
            var tagAggregator = _viewTagAggregatorFactoryService.CreateTagAggregator<UnusedDeclarationTag>(textView);
            return new UnusedDeclarationMargin(textView, marginContainer, tagAggregator);
        }
Beispiel #20
0
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            if (!(textViewHost.TextView.TextBuffer is IProjectionBuffer))
            {
                return null;
            }

            return new VenusMargin(textViewHost.TextView, _textEditorFactory);
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            var generalOptions = Setting.getGeneralOptions(serviceProvider);
            if (generalOptions == null || !(generalOptions.UnusedReferencesEnabled || generalOptions.UnusedOpensEnabled)) return null;

             	        var textView = wpfTextViewHost.TextView;
            return new UnusedDeclarationMargin(textView, marginContainer,
                           classifierAggregatorService.GetClassifier(textView.TextBuffer));
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            InitSolutionCoverageEngine();

            return new TestDotsCoverageVsPlugin(_vsSolutionTestCoverage,
                _taskCoverageManager,
                textViewHost.TextView,
                _statusBar,
                _dte.Solution);
        }
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
 {
     if (Utils.IsPerspexMarkup(wpfTextViewHost.TextView))
     {
         var editor = new PerspexEditorMargin(wpfTextViewHost.TextView);
         wpfTextViewHost.TextView.TextBuffer.Properties[typeof (PerspexDesigner)] = editor.Designer;
         return editor;
     }
     return null;
 }
Beispiel #24
0
        IWpfTextViewMargin IWpfTextViewMarginProvider.CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            IVimBuffer vimBuffer;
            if (!_vim.TryGetOrCreateVimBufferForHost(wpfTextViewHost.TextView, out vimBuffer))
            {
                return null;
            }

            return CreateCommandMargin(vimBuffer);
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            MarkdownPackage package = null;

            // If there is a shell service (which there should be, in VS), force the markdown package to load
            IVsShell shell = GlobalServiceProvider.GetService(typeof(SVsShell)) as IVsShell;
            if (shell != null)
                package = MarkdownPackage.ForceLoadPackage(shell);

            return new Margin(wpfTextViewHost.TextView, package);
        }
Beispiel #26
0
        IWpfTextViewMargin IWpfTextViewMarginProvider.CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            IVimBuffer vimBuffer;
            if (!_vim.TryGetOrCreateVimBufferForHost(wpfTextViewHost.TextView, out vimBuffer))
            {
                return null;
            }

            var editorFormatMap = _editorFormatMapService.GetEditorFormatMap(wpfTextViewHost.TextView);
            return new CommandMargin(wpfTextViewHost.TextView.VisualElement, vimBuffer, editorFormatMap, _optionsProviderFactories);
        }
        internal ScrollDiffMargin(IWpfTextView textView, UnifiedDiff unifiedDiff, IMarginCore marginCore, IWpfTextViewMargin containerMargin)
            : base(textView)
        {
            var scrollBarMargin = containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar);
            // ReSharper disable once SuspiciousTypeConversion.Global
            _scrollBar = (IVerticalScrollBar)scrollBarMargin;

            ViewModel = new ScrollDiffMarginViewModel(marginCore, unifiedDiff, UpdateDiffDimensions);

            UserControl = new ScrollDiffMarginControl { DataContext = ViewModel, Width = MarginWidth, MaxWidth = MarginWidth, MinWidth = MarginWidth};
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            "In WpfTextViewMarginProvider CreateMargin".info();
            IWpfTextViewHost = textViewHost;
            IWpfTextViewMargin_Container = containerMargin;
            

            var IWpfTextViewMargin_New  = new EditorMargin(textViewHost.TextView);

            return IWpfTextViewMargin_New; 
        }
 /// <summary>
 /// Create an instance of the StructureMargin in the specified <see cref="IWpfTextViewHost"/>.
 /// </summary>
 /// <param name="textViewHost">The <see cref="IWpfTextViewHost"/> in which the StructureMargin will be displayed.</param>
 /// <param name="parentMargin">The scrollBar used to translate between buffer positions and y-coordinates.</param>
 /// <returns>The newly created StructureMargin.</returns>
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
 {
     IOverviewMargin containerMarginAsOverviewMargin = containerMargin as IOverviewMargin;
     if (containerMarginAsOverviewMargin != null)
     {
         //Create the caret margin, passing it a newly instantiated text structure navigator for the view.
         return new StructureMargin(textViewHost, containerMarginAsOverviewMargin.ScrollBar, this);
     }
     else
         return null;
 }
        public override IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            // Visual Studio uses assembly binding redirection for the Shell assembly.
            if (typeof(ErrorHandler).Assembly.GetName().Version.Major >= 12)
                return null;

            var marginCore = TryGetMarginCore(textViewHost);
            if (marginCore == null)
                return null;

            return new ScrollDiffMargin(textViewHost.TextView, marginCore, containerMargin);
        }
 public static IWpfTextViewMargin CreateTextViewMargin(string filePath, IServiceProvider serviceProvider, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
 {
     return(GetObject <IWpfTextViewMargin>(filePath, t => typeof(IWpfTextViewMargin).IsAssignableFrom(t), serviceProvider, wpfTextViewHost, marginContainer, serviceProvider));
 }
Beispiel #32
0
        public IGlyphFactory GetGlyphFactory(IWpfTextView textView, IWpfTextViewMargin margin)
        {
            var classificationFormaptMap = _classificationFormatMapService.GetClassificationFormatMap(textView);

            return(new MarkGlyphFactory(_vim, classificationFormaptMap));
        }
Beispiel #33
0
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer) =>
 new WpfTextViewContainerMargin(wpfTextViewMarginProviderCollectionProvider, wpfTextViewHost, PredefinedMarginNames.RightControl, false);
Beispiel #34
0
 public IWpfTextViewMarginProviderCollection Create(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer, string marginContainerName)
 {
     if (wpfTextViewHost == null)
     {
         throw new ArgumentNullException(nameof(wpfTextViewHost));
     }
     if (marginContainer == null)
     {
         throw new ArgumentNullException(nameof(marginContainer));
     }
     if (marginContainerName == null)
     {
         throw new ArgumentNullException(nameof(marginContainerName));
     }
     return(new WpfTextViewMarginProviderCollection(wpfTextViewMarginProviders, wpfTextViewHost, marginContainer, marginContainerName));
 }
Beispiel #35
0
        /// <summary>
        /// Creates an <see cref="IWpfTextViewMargin"/> for the given <see cref="IWpfTextViewHost"/>.
        /// </summary>
        /// <param name="textViewHost">The <see cref="IWpfTextViewHost"/> for which to create the <see cref="IWpfTextViewMargin"/>.</param>
        /// <param name="marginContainer">The container that will contain the newly-created margin.</param>
        /// <returns>The <see cref="EditorMargin"/> instance.</returns>
        public override IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin marginContainer)
        {
            var marginCore = GetMarginCore(textViewHost);

            return(new EditorMargin(textViewHost.TextView, UndoHistoryRegistry, marginCore));
        }
        public GlyphTextMarkerServiceMouseProcessor(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
        {
            if (glyphTextMarkerServiceImpl == null)
            {
                throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
            }
            if (wpfTextViewHost == null)
            {
                throw new ArgumentNullException(nameof(wpfTextViewHost));
            }
            if (margin == null)
            {
                throw new ArgumentNullException(nameof(margin));
            }
            this.glyphTextViewMarkerService = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextViewHost.TextView);
            this.wpfTextViewHost            = wpfTextViewHost;
            this.margin = margin;
            this.toolTipDispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, margin.VisualElement.Dispatcher);
            this.popup = new Popup {
                AllowsTransparency = true
            };

            var list = new List <IGlyphTextMarkerMouseProcessor>();

            foreach (var lazy in glyphTextMarkerServiceImpl.GlyphTextMarkerMouseProcessorProviders)
            {
                if (lazy.Metadata.TextViewRoles != null && !wpfTextViewHost.TextView.Roles.ContainsAny(lazy.Metadata.TextViewRoles))
                {
                    continue;
                }
                var mouseProcessor = lazy.Value.GetAssociatedMouseProcessor(wpfTextViewHost, margin);
                if (mouseProcessor != null)
                {
                    list.Add(mouseProcessor);
                }
            }
            this.glyphTextMarkerMouseProcessors     = list.ToArray();
            wpfTextViewHost.TextView.Closed        += TextView_Closed;
            wpfTextViewHost.TextView.LayoutChanged += TextView_LayoutChanged;
            toolTipDispatcherTimer.Tick            += ToolTipDispatcherTimer_Tick;
            popup.Closed += Popup_Closed;
            glyphTextViewMarkerService.AddGlyphTextMarkerListener(this);
        }
 public IMouseProcessor GetAssociatedMouseProcessor(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
 {
     if (margin.GetTextViewMargin(PredefinedMarginNames.Glyph) == margin)
     {
         return(wpfTextViewHost.TextView.Properties.GetOrCreateSingletonProperty(typeof(GlyphTextMarkerServiceMouseProcessor), () => new GlyphTextMarkerServiceMouseProcessor(glyphTextMarkerServiceImpl, wpfTextViewHost, margin)));
     }
     return(null);
 }
 public IMarginContextMenuHandler Create(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin) =>
 wpfTextViewHost.TextView.Properties.GetOrCreateSingletonProperty(typeof(GlyphTextMarkerServiceMouseProcessor), () => new GlyphTextMarkerServiceMouseProcessor(glyphTextMarkerServiceImpl, wpfTextViewHost, margin));
 public GlyphTextMarkerHandlerContext(IWpfTextViewHost host, IWpfTextViewMargin margin, IWpfTextViewLine line)
 {
     Host   = host;
     Margin = margin;
     Line   = line;
 }
 public IGlyphFactory GetGlyphFactory(IWpfTextView view, IWpfTextViewMargin margin)
 {
     return(new NugetPackageGlyphFactory());
 }
Beispiel #41
0
#pragma warning restore 0649

        /// <summary>
        /// Creates an <see cref="IWpfTextViewMargin"/> for the given <see cref="IWpfTextViewHost"/>.
        /// </summary>
        /// <param name="textViewHost">The <see cref="IWpfTextViewHost"/> for which to create the <see cref="IWpfTextViewMargin"/>.</param>
        /// <param name="marginContainer">The container that will contain the newly-created margin.</param>
        /// <returns>The <see cref="IWpfTextViewMargin"/> instance.</returns>
        public abstract IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin marginContainer);
 public IGlyphFactory GetGlyphFactory(IWpfTextView view, IWpfTextViewMargin margin)
 {
     return(new ScoreGlyphFactory());
 }
            public IGlyphFactory GetGlyphFactory(IWpfTextView /*!*/ view, IWpfTextViewMargin /*!*/ margin)
            {
                ReplWindow repl = ReplWindow.FromBuffer(view.TextBuffer);

                return((repl != null) ? new GlyphFactory(repl) : null);
            }
Beispiel #44
0
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            var scrollBar = marginContainer as IVerticalScrollBar;

            return(Config.Instance.Features.MatchFlags(Features.ScrollbarMarkers) && scrollBar != null ? new CSharpMembersMargin(wpfTextViewHost.TextView, scrollBar) : null);
        }
 public IGlyphFactory GetGlyphFactory(IWpfTextView view, IWpfTextViewMargin margin)
 {
     return(new MatchGlyphFactory(view));
 }
Beispiel #46
0
        public IMouseProcessor GetAssociatedMouseProcessor(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
        {
            ITagAggregator <ErrorGlyphTag> tagAggregator = AggregatorService.CreateTagAggregator <ErrorGlyphTag>(wpfTextViewHost.TextView.TextBuffer);
            IToolTipProvider tooltipProvider             = ToolTipProviderFactory.GetToolTipProvider(wpfTextViewHost.TextView);

            return(new ErrorGlyphMouseProcessor(wpfTextViewHost, margin, tagAggregator, tooltipProvider));
        }
        IWpfTextViewMargin CreateMargin <TGlyphTag>(IGlyphFactory <TGlyphTag> glyphFactory, Func <Grid> gridFactory,
                                                    IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin parent, IEditorFormatMap editorFormatMap) where TGlyphTag : ITag
        {
            var tagAggregator = tagAggregatorFactory.CreateTagAggregator <TGlyphTag>(wpfTextViewHost.TextView);
            var margin        = new GlyphMargin <TGlyphTag>(wpfTextViewHost, glyphFactory, gridFactory, tagAggregator, editorFormatMap,
                                                            IsMarginVisible, MarginPropertiesName, MarginName, true, 17.0);

            if (IsDiffView(wpfTextViewHost))
            {
                TrackCommentGlyph(wpfTextViewHost, margin.VisualElement);
            }

            return(margin);
        }
Beispiel #48
0
 /// <summary>
 /// Creates an <see cref="IWpfTextViewMargin"/> for the given <see cref="IWpfTextViewHost"/>.
 /// </summary>
 /// <param name="wpfTextViewHost">The <see cref="IWpfTextViewHost"/> for which to create the <see cref="IWpfTextViewMargin"/>.</param>
 /// <param name="marginContainer">The margin that will contain the newly-created margin.</param>
 /// <returns>The <see cref="IWpfTextViewMargin"/>.
 /// The value may be null if this <see cref="IWpfTextViewMarginProvider"/> does not participate for this context.
 /// </returns>
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
 {
     return(new EditorMargin1(wpfTextViewHost.TextView));
 }
Beispiel #49
0
 public IGlyphFactory GetGlyphFactory(IWpfTextView view, IWpfTextViewMargin margin)
 {
     return(new ProgressMarginGlyphFactory());
 }
Beispiel #50
0
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer) =>
 new HorizontalScrollBarMargin(wpfTextViewHost);
Beispiel #51
0
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
 {
     return(new CoverageMargin(textViewHost.TextView, FormatMapService.GetEditorFormatMap(textViewHost.TextView)));
 }
Beispiel #52
0
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer) =>
 new LeftSelectionMargin(wpfTextViewMarginProviderCollectionProvider, wpfTextViewHost, editorOperationsFactoryService.GetEditorOperations(wpfTextViewHost.TextView));
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer) =>
 new VerticalScrollBarMargin(scrollMapFactoryService, wpfTextViewHost);
Beispiel #54
0
 public WpfTextViewMarginProviderCollection(Lazy <IWpfTextViewMarginProvider, IWpfTextViewMarginMetadata>[] wpfTextViewMarginProviders, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer, string marginContainerName)
 {
     if (wpfTextViewMarginProviders is null)
     {
         throw new ArgumentNullException(nameof(wpfTextViewMarginProviders));
     }
     if (wpfTextViewHost is null)
     {
         throw new ArgumentNullException(nameof(wpfTextViewHost));
     }
     if (marginContainerName is null)
     {
         throw new ArgumentNullException(nameof(marginContainerName));
     }
     this.wpfTextViewMarginProviders = wpfTextViewMarginProviders.Where(a =>
                                                                        StringComparer.OrdinalIgnoreCase.Equals(marginContainerName, a.Metadata.MarginContainer) &&
                                                                        wpfTextViewHost.TextView.Roles.ContainsAny(a.Metadata.TextViewRoles)
                                                                        ).ToArray();
     this.wpfTextViewHost    = wpfTextViewHost;
     this.marginContainer    = marginContainer ?? throw new ArgumentNullException(nameof(marginContainer));
     currentMargins          = Array.Empty <WpfTextViewMarginInfo>();
     wpfTextViewHost.Closed += WpfTextViewHost_Closed;
     wpfTextViewHost.TextView.TextDataModel.ContentTypeChanged += TextDataModel_ContentTypeChanged;
     UpdateMargins();
 }
Beispiel #55
0
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin parent)
 {
     return(new PromptMargin(wpfTextViewHost, EditorFormatMapService.GetEditorFormatMap(wpfTextViewHost.TextView)));
 }
Beispiel #56
0
 public WpfTextViewMarginInfo(IWpfTextViewMarginProvider provider, IWpfTextViewMarginMetadata metadata, IWpfTextViewMargin margin)
 {
     Provider = provider;
     Metadata = metadata;
     Margin   = margin;
 }
Beispiel #57
0
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
 {
     return(new NSpecMargin(wpfTextViewHost.TextView));
 }
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
 {
     return(new GitDiffMargin(textViewHost.TextView, this));
 }
 public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer) =>
 new BottomRightCornerMargin(wpfTextViewHost);
        IWpfTextViewMargin IWpfTextViewMarginProvider.CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            if (!_vim.TryGetOrCreateVimBufferForHost(wpfTextViewHost.TextView, out IVimBuffer vimBuffer))
            {
                return(null);
            }

            return(CreateCommandMargin(vimBuffer));
        }