本文整理汇总了C#中ITextUndoHistoryRegistry类的典型用法代码示例。如果您正苦于以下问题:C# ITextUndoHistoryRegistry类的具体用法?C# ITextUndoHistoryRegistry怎么用?C# ITextUndoHistoryRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITextUndoHistoryRegistry类属于命名空间,在下文中一共展示了ITextUndoHistoryRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SmartTokenFormatterCommandHandler
public SmartTokenFormatterCommandHandler(
ITextUndoHistoryRegistry undoHistoryRegistry,
IEditorOperationsFactoryService editorOperationsFactoryService) :
base(undoHistoryRegistry,
editorOperationsFactoryService)
{
}
示例2: CSharpRenameTrackingCodeFixProvider
public CSharpRenameTrackingCodeFixProvider(
IWaitIndicator waitIndicator,
ITextUndoHistoryRegistry undoHistoryRegistry,
[ImportMany] IEnumerable<IRefactorNotifyService> refactorNotifyServices)
: base(waitIndicator, undoHistoryRegistry, refactorNotifyServices)
{
}
示例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));
}
示例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));
}
示例5: RenameTrackingCodeAction
public RenameTrackingCodeAction(Document document, string title, IEnumerable<IRefactorNotifyService> refactorNotifyServices, ITextUndoHistoryRegistry undoHistoryRegistry)
{
_document = document;
_title = title;
_refactorNotifyServices = refactorNotifyServices;
_undoHistoryRegistry = undoHistoryRegistry;
}
示例6: AutomaticLineEnderCommandHandler
public AutomaticLineEnderCommandHandler(
IWaitIndicator waitIndicator,
ITextUndoHistoryRegistry undoRegistry,
IEditorOperationsFactoryService editorOperations)
: base(waitIndicator, undoRegistry, editorOperations)
{
}
示例7: GlobalUndoServiceFactory
public GlobalUndoServiceFactory(
ITextUndoHistoryRegistry undoHistoryRegistry,
SVsServiceProvider serviceProvider,
Lazy<VisualStudioWorkspace> workspace)
{
_singleton = new GlobalUndoService(undoHistoryRegistry, serviceProvider, workspace);
}
示例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
};
}
示例9: AbstractRenameTrackingCodeFixProvider
protected AbstractRenameTrackingCodeFixProvider(
IWaitIndicator waitIndicator,
ITextUndoHistoryRegistry undoHistoryRegistry,
IEnumerable<IRefactorNotifyService> refactorNotifyServices)
{
_waitIndicator = waitIndicator;
_undoHistoryRegistry = undoHistoryRegistry;
_refactorNotifyServices = refactorNotifyServices;
}
示例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;
}
}
示例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);
}
示例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");
}
}
示例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();
}
示例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;
}
示例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;
}