本文整理汇总了C#中IVsTextView.AddCommandFilter方法的典型用法代码示例。如果您正苦于以下问题:C# IVsTextView.AddCommandFilter方法的具体用法?C# IVsTextView.AddCommandFilter怎么用?C# IVsTextView.AddCommandFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsTextView
的用法示例。
在下文中一共展示了IVsTextView.AddCommandFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
view.TextBuffer.Properties.GetOrCreateSingletonProperty(() => view);
_errorList = view.TextBuffer.Properties.GetOrCreateSingletonProperty(() => new ErrorListProvider(ServiceProvider));
if (_errorList == null)
return;
if (ExtensibilityToolsPackage.Options.PkgdefShowIntellisense)
{
PkgdefCompletionController completion = new PkgdefCompletionController(view, CompletionBroker);
IOleCommandTarget completionNext;
textViewAdapter.AddCommandFilter(completion, out completionNext);
completion.Next = completionNext;
}
PkgdefFormatter formatter = new PkgdefFormatter(view);
IOleCommandTarget formatterNext;
textViewAdapter.AddCommandFilter(formatter, out formatterNext);
formatter.Next = formatterNext;
view.Closed += OnViewClosed;
}
示例2: VsInteractiveWindowCommandFilter
public VsInteractiveWindowCommandFilter(IVsEditorAdaptersFactoryService adapterFactory, IInteractiveWindow window, IVsTextView textViewAdapter, IVsTextBuffer bufferAdapter, IEnumerable<Lazy<IVsInteractiveWindowOleCommandTargetProvider, ContentTypeMetadata>> oleCommandTargetProviders, IContentTypeRegistryService contentTypeRegistry)
{
_window = window;
_oleCommandTargetProviders = oleCommandTargetProviders;
_contentTypeRegistry = contentTypeRegistry;
this.textViewAdapter = textViewAdapter;
// make us a code window so we'll have the same colors as a normal code window.
IVsTextEditorPropertyContainer propContainer;
ErrorHandler.ThrowOnFailure(((IVsTextEditorPropertyCategoryContainer)textViewAdapter).GetPropertyCategory(Microsoft.VisualStudio.Editor.DefGuidList.guidEditPropCategoryViewMasterSettings, out propContainer));
propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewComposite_AllCodeWindowDefaults, true);
propContainer.SetProperty(VSEDITPROPID.VSEDITPROPID_ViewGlobalOpt_AutoScrollCaretOnTextEntry, true);
// editor services are initialized in textViewAdapter.Initialize - hook underneath them:
_preEditorCommandFilter = new CommandFilter(this, CommandFilterLayer.PreEditor);
ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preEditorCommandFilter, out _editorCommandFilter));
textViewAdapter.Initialize(
(IVsTextLines)bufferAdapter,
IntPtr.Zero,
(uint)TextViewInitFlags.VIF_HSCROLL | (uint)TextViewInitFlags.VIF_VSCROLL | (uint)TextViewInitFlags3.VIF_NO_HWND_SUPPORT,
new[] { new INITVIEW { fSelectionMargin = 0, fWidgetMargin = 0, fVirtualSpace = 0, fDragDropMove = 1 } });
// disable change tracking because everything will be changed
var textViewHost = adapterFactory.GetWpfTextViewHost(textViewAdapter);
_preLanguageCommandFilter = new CommandFilter(this, CommandFilterLayer.PreLanguage);
ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(_preLanguageCommandFilter, out _editorServicesCommandFilter));
_textViewHost = textViewHost;
}
示例3: OleCommandFilter
protected OleCommandFilter(IVsTextView vsTextView)
{
IOleCommandTarget oldChain;
ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out oldChain));
OldChain = oldChain;
}
示例4: AttachKeyboardFilter
internal void AttachKeyboardFilter(IVsTextView vsTextView)
{
if (_next == null)
{
ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out _next));
}
}
示例5: CompletionCommandHandler
internal CompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, CompletionHandlerProvider provider)
{
this.txtView = textView;
this.handlerProvider = provider;
textViewAdapter.AddCommandFilter(this, out nextCommandHandler);
}
示例6: ShaderlabCompletionCommandHandlder
public ShaderlabCompletionCommandHandlder(IVsTextView textViewAdapter, ITextView textView, ShaderlabCompletionHandlerPrvider handlerProvider)
{
this.textView = textView;
this.completionHandlerProvider = handlerProvider;
textViewAdapter.AddCommandFilter(this, out nextCommandHandler);
}
示例7: VsCommandFilter
internal VsCommandFilter(IVimBuffer buffer, IVsTextView view, IServiceProvider provider)
{
_buffer = buffer;
_textView = view;
_serviceProvider = provider;
var hr = view.AddCommandFilter(this, out _nextTarget);
}
示例8: PasteCommandHandler
public PasteCommandHandler(IVsTextView adapter, ITextView textView, DTE2 dte)
{
_textView = textView;
_dte = dte;
adapter.AddCommandFilter(this, out _nextCommandTarget);
this.package = package;
}
示例9: Register
public static void Register(IVsTextView interopTextView, IWpfTextView textView, Services services)
{
var dispatcher = new StandardCommandDispatcher();
dispatcher._textView = textView;
dispatcher._services = services;
interopTextView.AddCommandFilter(dispatcher, out dispatcher._commandChain);
}
示例10: RemoveWhitespaceOnSave
public RemoveWhitespaceOnSave(IVsTextView textViewAdapter, IWpfTextView view, DTE2 dte, ITextDocument document)
{
textViewAdapter.AddCommandFilter(this, out _nextCommandTarget);
_view = view;
_dte = dte;
_document = document;
}
示例11: VsTextViewCreated
public async void VsTextViewCreated(IVsTextView textViewAdapter)
{
IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
Debug.Assert(view != null);
int tries = 0;
// Ugly ugly hack
// Keep trying to register our filter until after the JSLS CommandFilter
// is added so we can catch completion before JSLS swallows all of them.
// To confirm this, click Debug, New Breakpoint, Break at Function, type
// Microsoft.VisualStudio.JSLS.TextView.TextView.CreateCommandFilter,
// then make sure that our last filter is added after that runs.
JsCommandFilter filter = new JsCommandFilter(view, CompletionBroker, _standardClassifications);
while (true)
{
IOleCommandTarget next;
textViewAdapter.AddCommandFilter(filter, out next);
filter.Next = next;
if (IsJSLSInstalled(next) || ++tries > 10)
return;
await Task.Delay(500);
textViewAdapter.RemoveCommandFilter(filter); // Remove the too-early filter and try again.
}
}
示例12: TypeCharFilter
internal TypeCharFilter(IVsTextView adapter, ITextView textView, TypingSpeedMeter adornment)
{
this.textView = textView;
this.adornment = adornment;
adapter.AddCommandFilter(this, out nextCommandHandler);
}
示例13: CommandFilter
internal CommandFilter(IVsTextView textViewAdapter, IWpfTextView textView)
{
recorder = new Recorder();
listening = false;
this.textView = textView;
textViewAdapter.AddCommandFilter(this, out nextFilter);
// trying to get document path from TextBuffer
ITextBuffer buffer = this.textView.TextBuffer;
ITextDocument document;
var result = buffer.Properties.TryGetProperty<ITextDocument>(
typeof(ITextDocument), out document);
if (result)
{
string documentFullPath = document.FilePath;
recordFullPath = documentFullPath + ".rec";
}
else
{
// TODO: save to some folder
recordFullPath = "document.rec";
}
// subscribe to RecorderControl event
RecorderControl.RecordStateChanged += new EventHandler<RecordStateChangedArgs>(OnRecordStateChanged);
}
示例14: VsTextViewCreated
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
var commandFilter = new EditorCommandFilter(serviceProvider: this.serviceProvider);
IOleCommandTarget nextTarget;
ErrorHandler.ThrowOnFailure(textViewAdapter.AddCommandFilter(commandFilter, out nextTarget));
commandFilter.NextCommandTarget = nextTarget;
}
示例15: VsKeyProcessorAdditional
internal VsKeyProcessorAdditional(VsHost host, IVsTextView view, System.IServiceProvider provider)
{
_host = host;
_textView = view;
_serviceProvider = provider;
var hr = view.AddCommandFilter(this, out _nextTarget);
}