public IEditorCommandHandlerService GetService(ITextView textView)
 {
     return(textView.Properties.GetOrCreateSingletonProperty(() =>
     {
         var bufferResolverProvider = GuardedOperations.InvokeBestMatchingFactory(_bufferResolverProviders, textView.TextBuffer.ContentType, _contentTypeRegistryService, errorSource: this);
         ICommandingTextBufferResolver bufferResolver = null;
         GuardedOperations.CallExtensionPoint(() => bufferResolver = bufferResolverProvider.CreateResolver(textView));
         bufferResolver = bufferResolver ?? new DefaultBufferResolver(textView);
         return new EditorCommandHandlerService(this, textView, _commandHandlers, bufferResolver);
     }));
 }
 public EditorCommandHandlerService(EditorCommandHandlerServiceFactory factory,
                                    ITextView textView,
                                    IEnumerable <ICommandHandlerAndMetadata> commandHandlers,
                                    ICommandingTextBufferResolver bufferResolver)
 {
     _commandHandlers = commandHandlers ?? throw new ArgumentNullException(nameof(commandHandlers));
     _factory         = factory ?? throw new ArgumentNullException(nameof(factory));
     _textView        = textView ?? throw new ArgumentNullException(nameof(textView));
     _isOldGtkEditor  = _textView.GetType().FullName == "MonoDevelop.SourceEditor.ExtensibleTextEditor";
     _commandHandlersByTypeAndContentType = new Dictionary <(Type commandArgType, IContentType contentType), IReadOnlyList <ICommandHandlerAndMetadata> >();
     _bufferResolver = bufferResolver ?? throw new ArgumentNullException(nameof(bufferResolver));
     _textView.Properties.TryGetProperty(typeof(ITypingTelemetrySession), out _telemetrySession);
 }