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


C# IVsTextView.AddCommandFilter方法代码示例

本文整理汇总了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;
        }
开发者ID:NotYours180,项目名称:ExtensibilityTools,代码行数:26,代码来源:PkgdefTextViewCreationListener.cs

示例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;
        }
开发者ID:ralfkang,项目名称:roslyn,代码行数:32,代码来源:VsInteractiveWindowCommandFilter.cs

示例3: OleCommandFilter

        protected OleCommandFilter(IVsTextView vsTextView)
        {
            IOleCommandTarget oldChain;
              ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out oldChain));

              OldChain = oldChain;
        }
开发者ID:plkumar,项目名称:jish,代码行数:7,代码来源:OleCommandFilter.cs

示例4: AttachKeyboardFilter

 internal void AttachKeyboardFilter(IVsTextView vsTextView)
 {
     if (_next == null)
     {
         ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out _next));
     }
 }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:7,代码来源:ViewFilter.cs

示例5: CompletionCommandHandler

        internal CompletionCommandHandler(IVsTextView textViewAdapter, ITextView textView, CompletionHandlerProvider provider)
        {
            this.txtView = textView;
            this.handlerProvider = provider;

            textViewAdapter.AddCommandFilter(this, out nextCommandHandler);
        }
开发者ID:solondon,项目名称:VisualStudio2013andNETCookbookCode,代码行数:7,代码来源:CompletionCommandHandler.cs

示例6: ShaderlabCompletionCommandHandlder

        public ShaderlabCompletionCommandHandlder(IVsTextView textViewAdapter, ITextView textView, ShaderlabCompletionHandlerPrvider handlerProvider)
        {
            this.textView = textView;
            this.completionHandlerProvider = handlerProvider;

            textViewAdapter.AddCommandFilter(this, out nextCommandHandler);
        }
开发者ID:zzbin6210,项目名称:ShaderlabVS,代码行数:7,代码来源:ShaderlabCodeCompletion.cs

示例7: VsCommandFilter

 internal VsCommandFilter(IVimBuffer buffer, IVsTextView view, IServiceProvider provider)
 {
     _buffer = buffer;
     _textView = view;
     _serviceProvider = provider;
     var hr = view.AddCommandFilter(this, out _nextTarget);
 }
开发者ID:ChrisMarinos,项目名称:VsVim,代码行数:7,代码来源:VsCommandFilter.cs

示例8: PasteCommandHandler

 public PasteCommandHandler(IVsTextView adapter, ITextView textView, DTE2 dte)
 {
     _textView = textView;
     _dte = dte;
     adapter.AddCommandFilter(this, out _nextCommandTarget);
     this.package = package;
 }
开发者ID:asthomas,项目名称:TypescriptSyntaxPaste,代码行数:7,代码来源:PasteCommandHandler.cs

示例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);
 }
开发者ID:jaredpar,项目名称:fantomas,代码行数:7,代码来源:StandardCommandDispatcher.cs

示例10: RemoveWhitespaceOnSave

 public RemoveWhitespaceOnSave(IVsTextView textViewAdapter, IWpfTextView view, DTE2 dte, ITextDocument document)
 {
     textViewAdapter.AddCommandFilter(this, out _nextCommandTarget);
     _view = view;
     _dte = dte;
     _document = document;
 }
开发者ID:laurentkempe,项目名称:TrailingWhitespace,代码行数:7,代码来源:RemoveWhitespaceOnSave.cs

示例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.
            }
        }
开发者ID:Russe11,项目名称:WebEssentials2013,代码行数:26,代码来源:JavaScriptCompletionController.cs

示例12: TypeCharFilter

        internal TypeCharFilter(IVsTextView adapter, ITextView textView, TypingSpeedMeter adornment)
        {
            this.textView = textView;
            this.adornment = adornment;

            adapter.AddCommandFilter(this, out nextCommandHandler);
        }
开发者ID:Konctantin,项目名称:VS_SDK_samples,代码行数:7,代码来源:CommandFilter.cs

示例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);
        }
开发者ID:dmitry-zakablukov,项目名称:WorkRecorderVSIX,代码行数:29,代码来源:CommandFilter.cs

示例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;
 }
开发者ID:jango2015,项目名称:VS-Macros,代码行数:7,代码来源:TextViewCreationListener.cs

示例15: VsKeyProcessorAdditional

 internal VsKeyProcessorAdditional(VsHost host, IVsTextView view,  System.IServiceProvider provider)
 {
     _host = host;
     _textView = view;
     _serviceProvider = provider;
     var hr = view.AddCommandFilter(this, out _nextTarget);
 }
开发者ID:joycode,项目名称:LibNVim,代码行数:7,代码来源:VsKeyProcessorAdditional.cs


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