当前位置: 首页>>代码示例>>C#>>正文


C# ITextUndoHistoryRegistry类代码示例

本文整理汇总了C#中ITextUndoHistoryRegistry的典型用法代码示例。如果您正苦于以下问题:C# ITextUndoHistoryRegistry类的具体用法?C# ITextUndoHistoryRegistry怎么用?C# ITextUndoHistoryRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITextUndoHistoryRegistry类属于命名空间,在下文中一共展示了ITextUndoHistoryRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SmartTokenFormatterCommandHandler

 public SmartTokenFormatterCommandHandler(
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IEditorOperationsFactoryService editorOperationsFactoryService) :
     base(undoHistoryRegistry,
          editorOperationsFactoryService)
 {
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:SmartTokenFormatterCommandHandler.cs

示例2: CSharpRenameTrackingCodeFixProvider

 public CSharpRenameTrackingCodeFixProvider(
     IWaitIndicator waitIndicator,
     ITextUndoHistoryRegistry undoHistoryRegistry,
     [ImportMany] IEnumerable<IRefactorNotifyService> refactorNotifyServices)
     : base(waitIndicator, undoHistoryRegistry, refactorNotifyServices)
 {
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:CSharpRenameTrackingCodeFixProvider.cs

示例3: DocumentProvider

        public DocumentProvider(
            IVisualStudioHostProjectContainer projectContainer,
            IServiceProvider serviceProvider,
            bool signUpForFileChangeNotification)
        {
            var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));

            _projectContainer = projectContainer;
            this.RunningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable));
            this.EditorAdaptersFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();
            this.ContentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>();
            _textUndoHistoryRegistry = componentModel.GetService<ITextUndoHistoryRegistry>();
            _textManager = (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager));

            // In the CodeSense scenario we will receive file change notifications from the native
            // Language Services, so we don't want to sign up for them ourselves.
            if (signUpForFileChangeNotification)
            {
                _fileChangeService = (IVsFileChangeEx)serviceProvider.GetService(typeof(SVsFileChangeEx));
            }

            var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
            if (shell == null)
            {
                // This can happen only in tests, bail out.
                return;
            }

            int installed;
            Marshal.ThrowExceptionForHR(shell.IsPackageInstalled(Guids.RoslynPackageId, out installed));
            IsRoslynPackageInstalled = installed != 0;

            var runningDocumentTableForEvents = (IVsRunningDocumentTable)RunningDocumentTable;
            Marshal.ThrowExceptionForHR(runningDocumentTableForEvents.AdviseRunningDocTableEvents(new RunningDocTableEventsSink(this), out _runningDocumentTableEventCookie));
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:35,代码来源:DocumentProvider.cs

示例4: DocumentProvider

        /// <summary>
        /// Creates a document provider.
        /// </summary>
        /// <param name="projectContainer">Project container for the documents.</param>
        /// <param name="serviceProvider">Service provider</param>
        /// <param name="documentTrackingService">An optional <see cref="VisualStudioDocumentTrackingService"/> to track active and visible documents.</param>
        public DocumentProvider(
            IVisualStudioHostProjectContainer projectContainer,
            IServiceProvider serviceProvider,
            VisualStudioDocumentTrackingService documentTrackingService)
        {
            var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));

            _projectContainer = projectContainer;
            this._documentTrackingServiceOpt = documentTrackingService;
            this._runningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable));
            this._editorAdaptersFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();
            this._contentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>();
            _textUndoHistoryRegistry = componentModel.GetService<ITextUndoHistoryRegistry>();
            _textManager = (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager));

            _fileChangeService = (IVsFileChangeEx)serviceProvider.GetService(typeof(SVsFileChangeEx));

            var shell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
            if (shell == null)
            {
                // This can happen only in tests, bail out.
                return;
            }

            var runningDocumentTableForEvents = (IVsRunningDocumentTable)_runningDocumentTable;
            Marshal.ThrowExceptionForHR(runningDocumentTableForEvents.AdviseRunningDocTableEvents(new RunningDocTableEventsSink(this), out _runningDocumentTableEventCookie));
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:33,代码来源:DocumentProvider.cs

示例5: RenameTrackingCodeAction

 public RenameTrackingCodeAction(Document document, string title, IEnumerable<IRefactorNotifyService> refactorNotifyServices, ITextUndoHistoryRegistry undoHistoryRegistry)
 {
     _document = document;
     _title = title;
     _refactorNotifyServices = refactorNotifyServices;
     _undoHistoryRegistry = undoHistoryRegistry;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs

示例6: AutomaticLineEnderCommandHandler

 public AutomaticLineEnderCommandHandler(
     IWaitIndicator waitIndicator,
     ITextUndoHistoryRegistry undoRegistry,
     IEditorOperationsFactoryService editorOperations)
     : base(waitIndicator, undoRegistry, editorOperations)
 {
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:7,代码来源:AutomaticLineEnderCommandHandler.cs

示例7: GlobalUndoServiceFactory

 public GlobalUndoServiceFactory(
     ITextUndoHistoryRegistry undoHistoryRegistry,
     SVsServiceProvider serviceProvider,
     Lazy<VisualStudioWorkspace> workspace)
 {
     _singleton = new GlobalUndoService(undoHistoryRegistry, serviceProvider, workspace);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:7,代码来源:GlobalUndoServiceFactory.cs

示例8: CreateEditTransaction

 /// <summary>
 /// create caret preserving edit transaction with automatic code change undo merging policy
 /// </summary>
 public static CaretPreservingEditTransaction CreateEditTransaction(
     this ITextView view, string description, ITextUndoHistoryRegistry registry, IEditorOperationsFactoryService service)
 {
     return new CaretPreservingEditTransaction(description, view, registry, service)
     {
         MergePolicy = AutomaticCodeChangeMergePolicy.Instance
     };
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:11,代码来源:Extensions.cs

示例9: AbstractRenameTrackingCodeFixProvider

 protected AbstractRenameTrackingCodeFixProvider(
     IWaitIndicator waitIndicator,
     ITextUndoHistoryRegistry undoHistoryRegistry,
     IEnumerable<IRefactorNotifyService> refactorNotifyServices)
 {
     _waitIndicator = waitIndicator;
     _undoHistoryRegistry = undoHistoryRegistry;
     _refactorNotifyServices = refactorNotifyServices;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:9,代码来源:AbstractRenameTrackingCodeFixProvider.cs

示例10: StandardTextDocument

            public StandardTextDocument(
                DocumentProvider documentProvider,
                IVisualStudioHostProject project,
                DocumentKey documentKey,
                IReadOnlyList<string> folderNames,
                SourceCodeKind sourceCodeKind,
                ITextUndoHistoryRegistry textUndoHistoryRegistry,
                IVsFileChangeEx fileChangeService,
                ITextBuffer openTextBuffer,
                DocumentId id,
                EventHandler updatedOnDiskHandler,
                EventHandler<bool> openedHandler,
                EventHandler<bool> closingHandler)
            {
                Contract.ThrowIfNull(documentProvider);

                this.Project = project;
                this.Id = id ?? DocumentId.CreateNewId(project.Id, documentKey.Moniker);
                this.Folders = folderNames;

                _documentProvider = documentProvider;

                this.Key = documentKey;
                this.SourceCodeKind = sourceCodeKind;
                _itemMoniker = documentKey.Moniker;
                _textUndoHistoryRegistry = textUndoHistoryRegistry;
                _fileChangeTracker = new FileChangeTracker(fileChangeService, this.FilePath);
                _fileChangeTracker.UpdatedOnDisk += OnUpdatedOnDisk;

                _openTextBuffer = openTextBuffer;
                _snapshotTracker = new ReiteratedVersionSnapshotTracker(openTextBuffer);

                // The project system does not tell us the CodePage specified in the proj file, so
                // we use null to auto-detect.
                _doNotAccessDirectlyLoader = new FileTextLoader(documentKey.Moniker, defaultEncoding: null);

                // If we aren't already open in the editor, then we should create a file change notification
                if (openTextBuffer == null)
                {
                    _fileChangeTracker.StartFileChangeListeningAsync();
                }

                if (updatedOnDiskHandler != null)
                {
                    UpdatedOnDisk += updatedOnDiskHandler;
                }

                if (openedHandler != null)
                {
                    Opened += openedHandler;
                }

                if (closingHandler != null)
                {
                    Closing += closingHandler;
                }
            }
开发者ID:natidea,项目名称:roslyn,代码行数:57,代码来源:DocumentProvider.StandardTextDocument.cs

示例11: CommandHandlerDispatcher

		public CommandHandlerDispatcher(IVsTextView textViewAdapter, ITextView textView, ITextUndoHistoryRegistry textUndoHistoryRegistry, params ICommandHandler[] commandHandlers)
		{
			_textViewAdapter = textViewAdapter;
			_textView = textView;
			_textUndoHistoryRegistry = textUndoHistoryRegistry;
			_commandHandlers = commandHandlers.ToDictionary(h => h.CommandId);

			_textViewAdapter.AddCommandFilter(this, out _nextTarget);
		}
开发者ID:modulexcite,项目名称:YamlDotNet.Editor,代码行数:9,代码来源:CommandHandlerDispatcher.cs

示例12: RenameTrackingTestState

        public RenameTrackingTestState(
            string markup,
            string languageName,
            bool onBeforeGlobalSymbolRenamedReturnValue = true,
            bool onAfterGlobalSymbolRenamedReturnValue = true)
        {
            this.Workspace = CreateTestWorkspace(markup, languageName, TestExportProvider.CreateExportProviderWithCSharpAndVisualBasic());

            _hostDocument = Workspace.Documents.First();
            _view = _hostDocument.GetTextView();
            _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, _hostDocument.CursorPosition.Value));
            _editorOperations = Workspace.GetService<IEditorOperationsFactoryService>().GetEditorOperations(_view);
            _historyRegistry = Workspace.ExportProvider.GetExport<ITextUndoHistoryRegistry>().Value;
            _mockRefactorNotifyService = new MockRefactorNotifyService
            {
                OnBeforeSymbolRenamedReturnValue = onBeforeGlobalSymbolRenamedReturnValue,
                OnAfterSymbolRenamedReturnValue = onAfterGlobalSymbolRenamedReturnValue
            };

            var optionService = this.Workspace.Services.GetService<IOptionService>();

            // Mock the action taken by the workspace INotificationService
            var notificationService = Workspace.Services.GetService<INotificationService>() as INotificationServiceCallback;
            var callback = new Action<string, string, NotificationSeverity>((message, title, severity) => _notificationMessage = message);
            notificationService.NotificationCallback = callback;

            var tracker = new RenameTrackingTaggerProvider(
                _historyRegistry,
                Workspace.ExportProvider.GetExport<Host.IWaitIndicator>().Value,
                Workspace.ExportProvider.GetExport<IInlineRenameService>().Value,
                Workspace.ExportProvider.GetExport<IDiagnosticAnalyzerService>().Value,
                SpecializedCollections.SingletonEnumerable(_mockRefactorNotifyService),
                Workspace.ExportProvider.GetExports<IAsynchronousOperationListener, FeatureMetadata>());

            _tagger = tracker.CreateTagger<RenameTrackingTag>(_hostDocument.GetTextBuffer());

            if (languageName == LanguageNames.CSharp)
            {
                _codeFixProvider = new CSharpRenameTrackingCodeFixProvider(
                    Workspace.ExportProvider.GetExport<Host.IWaitIndicator>().Value,
                    _historyRegistry,
                    SpecializedCollections.SingletonEnumerable(_mockRefactorNotifyService));
            }
            else if (languageName == LanguageNames.VisualBasic)
            {
                _codeFixProvider = new VisualBasicRenameTrackingCodeFixProvider(
                    Workspace.ExportProvider.GetExport<Host.IWaitIndicator>().Value,
                    _historyRegistry,
                    SpecializedCollections.SingletonEnumerable(_mockRefactorNotifyService));
            }
            else
            {
                throw new ArgumentException("Invalid langauge name: " + languageName, "languageName");
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:55,代码来源:RenameTrackingTestState.cs

示例13: AutoCommentService

 public AutoCommentService(
     [Import] IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
     [Import] IEditorOperationsFactoryService editorOperationsFactoryService,
     [Import] ITextUndoHistoryRegistry textUndoHistoryRegistry,
     [ImportMany] IEnumerable<Lazy<ICommenterProvider, IContentTypeMetadata>> commenterProviders)
 {
     _editorAdaptersFactoryService = editorAdaptersFactoryService;
     _editorOperationsFactoryService = editorOperationsFactoryService;
     _textUndoHistoryRegistry = textUndoHistoryRegistry;
     _commenterProviders = commenterProviders.ToList();
 }
开发者ID:modulexcite,项目名称:vsbase,代码行数:11,代码来源:AutoCommentService.cs

示例14: TextBufferUndoManager

		public TextBufferUndoManager(ITextBuffer textBuffer, ITextUndoHistoryRegistry textUndoHistoryRegistry) {
			if (textBuffer == null)
				throw new ArgumentNullException(nameof(textBuffer));
			if (textUndoHistoryRegistry == null)
				throw new ArgumentNullException(nameof(textUndoHistoryRegistry));
			changes = new List<ChangeInfo>();
			TextBuffer = textBuffer;
			this.textUndoHistoryRegistry = textUndoHistoryRegistry;
			textBufferUndoHistory = textUndoHistoryRegistry.RegisterHistory(TextBuffer);
			TextBuffer.Changed += TextBuffer_Changed;
			TextBuffer.PostChanged += TextBuffer_PostChanged;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:12,代码来源:TextBufferUndoManager.cs

示例15: TryCreate

        public static CaretPreservingEditTransaction TryCreate(string description, 
            ITextView textView,
            ITextUndoHistoryRegistry undoHistoryRegistry,
            IEditorOperationsFactoryService editorOperationsFactoryService)
        {
            if (undoHistoryRegistry.TryGetHistory(textView.TextBuffer, out var unused))
            {
                return new CaretPreservingEditTransaction(description, textView, undoHistoryRegistry, editorOperationsFactoryService);
            }

            return null;
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:12,代码来源:CaretPreservingEditTransaction.cs


注:本文中的ITextUndoHistoryRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。