Example #1
0
 public CommentUncommentSelectionCommandHandler(
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     EditorOptionsService editorOptionsService)
     : base(undoHistoryRegistry, editorOperationsFactoryService, editorOptionsService)
 {
 }
Example #2
0
        /// <summary>
        /// format given snapshot and apply text changes to buffer
        /// </summary>
        public static void FormatAndApplyToBuffer(
            this ITextBuffer textBuffer,
            TextSpan span,
            EditorOptionsService editorOptionsService,
            CancellationToken cancellationToken)
        {
            var document = textBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();

            if (document == null)
            {
                return;
            }

            var documentSyntax = ParsedDocument.CreateSynchronously(document, cancellationToken);
            var rules          = FormattingRuleUtilities.GetFormattingRules(documentSyntax, document.Project.LanguageServices, span, additionalRules: null);

            var formatter = document.GetRequiredLanguageService <ISyntaxFormattingService>();

            var options = textBuffer.GetSyntaxFormattingOptions(editorOptionsService, document.Project.LanguageServices, explicitFormat: false);
            var result  = formatter.GetFormattingResult(documentSyntax.Root, SpecializedCollections.SingletonEnumerable(span), options, rules, cancellationToken);
            var changes = result.GetTextChanges(cancellationToken);

            using (Logger.LogBlock(FunctionId.Formatting_ApplyResultToBuffer, cancellationToken))
            {
                textBuffer.ApplyChanges(changes);
            }
        }
Example #3
0
 public DocumentationCommentCommandHandler(
     IUIThreadOperationExecutor uiThreadOperationExecutor,
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     EditorOptionsService editorOptionsService)
     : base(uiThreadOperationExecutor, undoHistoryRegistry, editorOperationsFactoryService, editorOptionsService)
 {
 }
Example #4
0
 public SnippetCommandHandler(
     IThreadingContext threadingContext,
     IExpansionServiceProvider expansionServiceProvider,
     IExpansionManager expansionManager,
     EditorOptionsService editorOptionsService)
     : base(threadingContext, expansionServiceProvider, expansionManager, editorOptionsService)
 {
 }
 public CSharpToggleBlockCommentCommandHandler(
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     ITextStructureNavigatorSelectorService navigatorSelectorService,
     EditorOptionsService editorOptionsService)
     : base(undoHistoryRegistry, editorOperationsFactoryService, navigatorSelectorService, editorOptionsService)
 {
 }
Example #6
0
 public SnippetExpansionClient(
     IContentType languageServiceGuid,
     ITextView textView,
     ITextBuffer subjectBuffer,
     IExpansionServiceProvider expansionServiceProvider,
     EditorOptionsService editorOptionsService)
     : base(languageServiceGuid, textView, subjectBuffer, expansionServiceProvider, editorOptionsService)
 {
 }
Example #7
0
 public CSharpCodeModelServiceFactory(
     EditorOptionsService editorOptionsService,
     [ImportMany] IEnumerable <IRefactorNotifyService> refactorNotifyServices,
     IThreadingContext threadingContext)
 {
     _editorOptionsService   = editorOptionsService;
     _refactorNotifyServices = refactorNotifyServices;
     _threadingContext       = threadingContext;
 }
Example #8
0
 public SplitStringLiteralCommandHandler(
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     EditorOptionsService editorOptionsService)
 {
     _undoHistoryRegistry            = undoHistoryRegistry;
     _editorOperationsFactoryService = editorOperationsFactoryService;
     _editorOptionsService           = editorOptionsService;
 }
Example #9
0
 protected AbstractAutomaticLineEnderCommandHandler(
     ITextUndoHistoryRegistry undoRegistry,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     EditorOptionsService editorOptionsService)
 {
     _undoRegistry = undoRegistry;
     _editorOperationsFactoryService = editorOperationsFactoryService;
     EditorOptionsService            = editorOptionsService;
 }
 protected InteractiveCommandHandler(
     IContentTypeRegistryService contentTypeRegistryService,
     EditorOptionsService editorOptionsService,
     IEditorOperationsFactoryService editorOperationsFactoryService)
 {
     _contentTypeRegistryService     = contentTypeRegistryService;
     _editorOptionsService           = editorOptionsService;
     _editorOperationsFactoryService = editorOperationsFactoryService;
 }
Example #11
0
 public StructureTaggerProvider(
     IThreadingContext threadingContext,
     EditorOptionsService editorOptionsService,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     [Import(AllowDefault = true)] ITextBufferVisibilityTracker?visibilityTracker,
     IAsynchronousOperationListenerProvider listenerProvider)
     : base(threadingContext, editorOptionsService, projectionBufferFactoryService, visibilityTracker, listenerProvider)
 {
 }
 protected AbstractStructureTaggerProvider(
     IThreadingContext threadingContext,
     EditorOptionsService editorOptionsService,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     ITextBufferVisibilityTracker?visibilityTracker,
     IAsynchronousOperationListenerProvider listenerProvider)
     : base(threadingContext, editorOptionsService.GlobalOptions, visibilityTracker, listenerProvider.GetListener(FeatureAttribute.Outlining))
 {
     EditorOptionsService           = editorOptionsService;
     ProjectionBufferFactoryService = projectionBufferFactoryService;
 }
Example #13
0
 public AbstractSnippetCommandHandler(
     IThreadingContext threadingContext,
     IExpansionServiceProvider expansionServiceProvider,
     IExpansionManager expansionManager,
     EditorOptionsService editorOptionsService)
 {
     ThreadingContext         = threadingContext;
     ExpansionServiceProvider = expansionServiceProvider;
     ExpansionManager         = expansionManager;
     EditorOptionsService     = editorOptionsService;
 }
Example #14
0
 public CSharpInteractiveCommandHandler(
     CSharpVsInteractiveWindowProvider interactiveWindowProvider,
     ISendToInteractiveSubmissionProvider sendToInteractiveSubmissionProvider,
     IContentTypeRegistryService contentTypeRegistryService,
     EditorOptionsService editorOptionsService,
     IEditorOperationsFactoryService editorOperationsFactoryService)
     : base(contentTypeRegistryService, editorOptionsService, editorOperationsFactoryService)
 {
     _interactiveWindowProvider           = interactiveWindowProvider;
     _sendToInteractiveSubmissionProvider = sendToInteractiveSubmissionProvider;
 }
Example #15
0
 public TestInteractiveCommandHandler(
     IInteractiveWindow interactiveWindow,
     ISendToInteractiveSubmissionProvider sendToInteractiveSubmissionProvider,
     IContentTypeRegistryService contentTypeRegistryService,
     EditorOptionsService editorOptionsService,
     IEditorOperationsFactoryService editorOperationsFactoryService)
     : base(contentTypeRegistryService, editorOptionsService, editorOperationsFactoryService)
 {
     _interactiveWindow = interactiveWindow;
     _sendToInteractiveSubmissionProvider = sendToInteractiveSubmissionProvider;
 }
 public BraceCompletionSessionProvider(
     IThreadingContext threadingContext,
     ITextBufferUndoManagerProvider undoManager,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     EditorOptionsService editorOptionsService)
 {
     _threadingContext = threadingContext;
     _undoManager      = undoManager;
     _editorOperationsFactoryService = editorOperationsFactoryService;
     _editorOptionsService           = editorOptionsService;
 }
Example #17
0
 public TestResetInteractive(
     IUIThreadOperationExecutor uiThreadOperationExecutor,
     EditorOptionsService editorOptionsService,
     Func <string, string> createReference,
     Func <string, string> createImport,
     bool buildSucceeds)
     : base(editorOptionsService, createReference, createImport)
 {
     _uiThreadOperationExecutor = uiThreadOperationExecutor;
     _buildSucceeds             = buildSucceeds;
 }
Example #18
0
 public SnippetCommandHandler(
     IThreadingContext threadingContext,
     SignatureHelpControllerProvider signatureHelpControllerProvider,
     IEditorCommandHandlerServiceFactory editorCommandHandlerServiceFactory,
     IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
     SVsServiceProvider serviceProvider,
     [ImportMany] IEnumerable <Lazy <ArgumentProvider, OrderableLanguageMetadata> > argumentProviders,
     EditorOptionsService editorOptionsService)
     : base(threadingContext, signatureHelpControllerProvider, editorCommandHandlerServiceFactory, editorAdaptersFactoryService, editorOptionsService, serviceProvider)
 {
     _argumentProviders = argumentProviders.ToImmutableArray();
 }
        internal AbstractCommentSelectionBase(
            ITextUndoHistoryRegistry undoHistoryRegistry,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            EditorOptionsService editorOptionsService)
        {
            Contract.ThrowIfNull(undoHistoryRegistry);
            Contract.ThrowIfNull(editorOperationsFactoryService);

            _undoHistoryRegistry            = undoHistoryRegistry;
            _editorOperationsFactoryService = editorOperationsFactoryService;
            _editorOptionsService           = editorOptionsService;
        }
Example #20
0
 public ContentControlService(
     IThreadingContext threadingContext,
     ITextEditorFactoryService textEditorFactoryService,
     IContentTypeRegistryService contentTypeRegistryService,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     EditorOptionsService editorOptionsService)
 {
     _threadingContext               = threadingContext;
     _textEditorFactoryService       = textEditorFactoryService;
     _contentTypeRegistryService     = contentTypeRegistryService;
     _projectionBufferFactoryService = projectionBufferFactoryService;
     _editorOptionsService           = editorOptionsService;
 }
 public RawStringLiteralCommandHandler(
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IGlobalOptionService globalOptions,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     EditorOptionsService editorOptionsService,
     IIndentationManagerService indentationManager)
 {
     _undoHistoryRegistry            = undoHistoryRegistry;
     _globalOptions                  = globalOptions;
     _editorOperationsFactoryService = editorOperationsFactoryService;
     _editorOptionsService           = editorOptionsService;
     _indentationManager             = indentationManager;
 }
Example #22
0
 public SplitCommentCommandHandler(
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     EditorOptionsService editorOptionsService,
     IIndentationManagerService indentationManager,
     IGlobalOptionService globalOptions)
 {
     _undoHistoryRegistry            = undoHistoryRegistry;
     _editorOperationsFactoryService = editorOperationsFactoryService;
     _editorOptionsService           = editorOptionsService;
     _indentationManager             = indentationManager;
     _globalOptions = globalOptions;
 }
 public DiagnosticsClassificationTaggerProvider(
     IThreadingContext threadingContext,
     IDiagnosticService diagnosticService,
     ClassificationTypeMap typeMap,
     EditorOptionsService editorOptionsService,
     [Import(AllowDefault = true)] ITextBufferVisibilityTracker?visibilityTracker,
     IAsynchronousOperationListenerProvider listenerProvider)
     : base(threadingContext, diagnosticService, editorOptionsService.GlobalOptions, visibilityTracker, listenerProvider.GetListener(FeatureAttribute.Classification))
 {
     _typeMap              = typeMap;
     _classificationTag    = new ClassificationTag(_typeMap.GetClassificationType(ClassificationTypeDefinitions.UnnecessaryCode));
     _editorOptionsService = editorOptionsService;
 }
 public AbstractSnippetExpansionClient(
     IContentType languageServiceGuid,
     ITextView textView,
     ITextBuffer subjectBuffer,
     IExpansionServiceProvider expansionServiceProvider,
     EditorOptionsService editorOptionsService)
 {
     LanguageServiceGuid      = languageServiceGuid;
     TextView                 = textView;
     SubjectBuffer            = subjectBuffer;
     ExpansionServiceProvider = expansionServiceProvider;
     EditorOptionsService     = editorOptionsService;
 }
 public AbstractSnippetCommandHandler(
     IThreadingContext threadingContext,
     SignatureHelpControllerProvider signatureHelpControllerProvider,
     IEditorCommandHandlerServiceFactory editorCommandHandlerServiceFactory,
     IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
     EditorOptionsService editorOptionsService,
     SVsServiceProvider serviceProvider)
     : base(threadingContext)
 {
     SignatureHelpControllerProvider    = signatureHelpControllerProvider;
     EditorCommandHandlerServiceFactory = editorCommandHandlerServiceFactory;
     EditorAdaptersFactoryService       = editorAdaptersFactoryService;
     EditorOptionsService = editorOptionsService;
     ServiceProvider      = serviceProvider;
 }
        protected AbstractDocumentationCommentCommandHandler(
            IUIThreadOperationExecutor uiThreadOperationExecutor,
            ITextUndoHistoryRegistry undoHistoryRegistry,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            EditorOptionsService editorOptionsService)
        {
            Contract.ThrowIfNull(uiThreadOperationExecutor);
            Contract.ThrowIfNull(undoHistoryRegistry);
            Contract.ThrowIfNull(editorOperationsFactoryService);

            _uiThreadOperationExecutor      = uiThreadOperationExecutor;
            _undoHistoryRegistry            = undoHistoryRegistry;
            _editorOperationsFactoryService = editorOperationsFactoryService;
            _editorOptionsService           = editorOptionsService;
        }
Example #27
0
 private ProjectionBufferContent(
     IThreadingContext threadingContext,
     ImmutableArray <SnapshotSpan> spans,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     EditorOptionsService editorOptionsService,
     ITextEditorFactoryService textEditorFactoryService,
     IContentType contentType = null,
     ITextViewRoleSet roleSet = null)
     : base(threadingContext)
 {
     _spans = spans;
     _projectionBufferFactoryService = projectionBufferFactoryService;
     _editorOptionsService           = editorOptionsService;
     _textEditorFactoryService       = textEditorFactoryService;
     _contentType = contentType;
     _roleSet     = roleSet ?? _textEditorFactoryService.NoRoles;
 }
 public BraceCompletionSession(
     ITextView textView, ITextBuffer subjectBuffer,
     SnapshotPoint openingPoint, char openingBrace, char closingBrace, ITextUndoHistory undoHistory,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     EditorOptionsService editorOptionsService, IBraceCompletionService service, IThreadingContext threadingContext)
 {
     TextView              = textView;
     SubjectBuffer         = subjectBuffer;
     OpeningBrace          = openingBrace;
     ClosingBrace          = closingBrace;
     ClosingPoint          = SubjectBuffer.CurrentSnapshot.CreateTrackingPoint(openingPoint.Position, PointTrackingMode.Positive);
     _undoHistory          = undoHistory;
     _editorOperations     = editorOperationsFactoryService.GetEditorOperations(textView);
     _editorOptionsService = editorOptionsService;
     _service              = service;
     _threadingContext     = threadingContext;
 }
Example #29
0
 public StringCopyPasteCommandHandler(
     IThreadingContext threadingContext,
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IEditorOperationsFactoryService editorOperationsFactoryService,
     IGlobalOptionService globalOptions,
     ITextBufferFactoryService2 textBufferFactoryService,
     EditorOptionsService editorOptionsService,
     IIndentationManagerService indentationManager)
 {
     _threadingContext               = threadingContext;
     _undoHistoryRegistry            = undoHistoryRegistry;
     _editorOperationsFactoryService = editorOperationsFactoryService;
     _globalOptions            = globalOptions;
     _textBufferFactoryService = textBufferFactoryService;
     _editorOptionsService     = editorOptionsService;
     _indentationManager       = indentationManager;
 }
 public CSharpVsInteractiveWindowProvider(
     IThreadingContext threadingContext,
     SVsServiceProvider serviceProvider,
     IAsynchronousOperationListenerProvider listenerProvider,
     IVsInteractiveWindowFactory interactiveWindowFactory,
     IViewClassifierAggregatorService classifierAggregator,
     IContentTypeRegistryService contentTypeRegistry,
     IInteractiveWindowCommandsFactory commandsFactory,
     [ImportMany] IInteractiveWindowCommand[] commands,
     ITextDocumentFactoryService textDocumentFactoryService,
     EditorOptionsService editorOptionsService,
     VisualStudioWorkspace workspace)
     : base(serviceProvider, interactiveWindowFactory, classifierAggregator, contentTypeRegistry, commandsFactory, commands, workspace)
 {
     _threadingContext           = threadingContext;
     _listener                   = listenerProvider.GetListener(FeatureAttribute.InteractiveEvaluator);
     _textDocumentFactoryService = textDocumentFactoryService;
     _editorOptionsService       = editorOptionsService;
 }