public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin parent) { try { if (wpfTextViewHost == null || !wpfTextViewHost.TextView.HasValidMarginRoles()) { return(null); } if (!TextDocumentExtensions.TryGetTextDocument(TextDocumentFactoryService, wpfTextViewHost.TextView.TextBuffer, out var textDocument)) { return(null); } using (Log.CriticalOperation($"{nameof(DocumentMarkMarginProvider)} {nameof(CreateMargin)}", LogEventLevel.Debug)) { TextViewMargin = new DocumentMarkMargin( _viewTagAggregatorFactoryService, _glyphFactoryProviders, wpfTextViewHost, SessionService.Value, SettingsServiceFactory.Value.GetOrCreate (nameof(DocumentMarkMarginProvider)) ); return(TextViewMargin); } } catch (Exception ex) { Log.Error(ex, nameof(CreateMargin)); System.Diagnostics.Debug.WriteLine(ex); #if DEBUG System.Diagnostics.Debugger.Break(); #endif return(null); } }
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin parent) { try { if (wpfTextViewHost == null || !wpfTextViewHost.TextView.HasValidRoles()) { return(null); } if (!TextDocumentExtensions.TryGetTextDocument(TextDocumentFactoryService, wpfTextViewHost.TextView.TextBuffer, out var textDocument)) { return(null); } var componentModel = Package.GetGlobalService(typeof(SComponentModel)) as IComponentModel; var sessionService = componentModel?.GetService <ISessionService>(); var settingsServiceFactory = componentModel?.GetService <ISettingsServiceFactory>(); TextViewMargin = new DocumentMarkMargin( _viewTagAggregatorFactoryService, _glyphFactoryProviders, wpfTextViewHost, sessionService, settingsServiceFactory.Create() ); return(TextViewMargin); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); #if DEBUG System.Diagnostics.Debugger.Break(); #endif return(null); } }