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


C# IVimBuffer类代码示例

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


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

示例1: CommandMarginController

        internal CommandMarginController(IVimBuffer buffer, FrameworkElement parentVisualElement, CommandMarginControl control, IEditorFormatMap editorFormatMap, IEnumerable<Lazy<IOptionsProviderFactory>> optionsProviderFactory)
        {
            _vimBuffer = buffer;
            _margin = control;
            _parentVisualElement = parentVisualElement;
            _editorFormatMap = editorFormatMap;
            _optionsProviderFactory = optionsProviderFactory.ToList().AsReadOnly();

            _vimBuffer.SwitchedMode += OnSwitchMode;
            _vimBuffer.KeyInputStart += OnKeyInputStart;
            _vimBuffer.KeyInputEnd += OnKeyInputEnd;
            _vimBuffer.StatusMessage += OnStatusMessage;
            _vimBuffer.ErrorMessage += OnErrorMessage;
            _vimBuffer.WarningMessage += OnWarningMessage;
            _vimBuffer.CommandMode.CommandChanged += OnCommandChanged;
            _vimBuffer.Vim.MacroRecorder.RecordingStarted += OnRecordingStarted;
            _vimBuffer.Vim.MacroRecorder.RecordingStopped += OnRecordingStopped;
            _margin.OptionsClicked += OnOptionsClicked;
            _margin.CancelCommandEdition += OnCancelCommandEdition;
            _margin.RunCommandEdition += OnRunCommandEdition;
            _margin.HistoryGoPrevious += OnHistoryGoPrevious;
            _margin.HistoryGoNext += OnHistoryGoNext;
            _editorFormatMap.FormatMappingChanged += OnFormatMappingChanged;
            UpdateForRecordingChanged();
            UpdateTextColor();
        }
开发者ID:wmchristie,项目名称:VsVim,代码行数:26,代码来源:CommandMarginController.cs

示例2: VimBufferCreated

        public void VimBufferCreated(IVimBuffer vimBuffer)
        {
            var taggerList = new List<ITagger<ITag>>();
            var bufferAdapterList = new List<IExternalEditAdapter>();
            var textView = vimBuffer.TextView;

            foreach (var adapter in _adapterList)
            {
                ITagger<ITag> tagger;
                if (adapter.IsInterested(textView, out tagger))
                {
                    bufferAdapterList.Add(adapter);
                    if (tagger != null)
                    {
                        taggerList.Add(tagger);
                    }
                }
            }

            if (bufferAdapterList.Count > 0)
            {
                _monitorMap[vimBuffer] = new ExternalEditMonitor(
                    vimBuffer,
                    _protectedOperations,
                    _vsAdapter.GetTextLines(vimBuffer.TextBuffer),
                    taggerList.ToReadOnlyCollectionShallow(),
                    bufferAdapterList.ToReadOnlyCollectionShallow());
                vimBuffer.Closed += delegate { _monitorMap.Remove(vimBuffer); };
            }
        }
开发者ID:ketiko,项目名称:VsVim,代码行数:30,代码来源:ExternalEditorManager.cs

示例3: LinkBanner

        void IVimBufferCreationListener.VimBufferCreated(IVimBuffer vimBuffer)
        {
            if (!_vim.VimRcState.IsLoadSucceeded)
            {
                return;
            }

            var wpfTextView = vimBuffer.TextView as IWpfTextView;
            if (wpfTextView == null)
            {
                return;
            }

            var state = ((VimRcState.LoadSucceeded)_vim.VimRcState);

            // If the notification has occured then there is nothing else to do.  We are done
            if (!_vimApplicationSettings.HaveNotifiedVimRcLoad && state.Item1.VimRcKind == VimRcKind.VimRc)
            {
                var linkBanner = new LinkBanner();
                linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#vimrc";
                linkBanner.LinkText = "FAQ";
                linkBanner.BannerText = "VsVim automatically loaded an existing _vimrc file";
                _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_notifyToastKey, linkBanner, OnNotifyClosed);
            }

            if (!_vimApplicationSettings.HaveNotifiedVimRcErrors && state.Item2.Length != 0)
            {
                var errorBanner = new ErrorBanner();
                errorBanner.ViewClick += (sender, e) => OnViewClick(state.Item2);
                _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_errorToastKey, errorBanner, OnErrorClosed);
            }
        }
开发者ID:Deleriumdoll,项目名称:VsVim,代码行数:32,代码来源:VimRcLoadNotificationMarginProvider.cs

示例4:

 void IVimBufferCreationListener.VimBufferCreated(IVimBuffer vimBuffer)
 {
     // Let the command margin get into a known state before we disable it.  
     _vimProtectedOperations.BeginInvoke(
         () => _commandMarginUtil.SetMarginVisibility(vimBuffer, _vimApplicationSettings.UseEditorCommandMargin),
         DispatcherPriority.ApplicationIdle);
 }
开发者ID:Yzzl,项目名称:VsVim,代码行数:7,代码来源:StatusBarAdapter.cs

示例5: OnSettingChanged

 private void OnSettingChanged(IVimBuffer buffer, Setting args)
 {
     if (args.Name == WindowSettingNames.CursorLineName && buffer.TextView.Options != null)
     {
         buffer.TextView.Options.SetOptionValue(DefaultWpfViewOptions.EnableHighlightCurrentLineId, buffer.WindowSettings.CursorLine);
     }
 }
开发者ID:GunioRobot,项目名称:VsVim,代码行数:7,代码来源:VimBufferCreationListener.cs

示例6: CreateCommandKeyBindingSnapshot

        /// <summary>
        /// Compute the set of keys that conflict with and have been already been removed.
        /// </summary>
        internal CommandKeyBindingSnapshot CreateCommandKeyBindingSnapshot(IVimBuffer buffer)
        {
            // Get the list of all KeyInputs that are the first key of a VsVim command
            var hashSet = new HashSet<KeyInput>(
                buffer.AllModes
                .Select(x => x.CommandNames)
                .SelectMany(x => x)
                .Where(x => x.KeyInputs.Length > 0)
                .Select(x => x.KeyInputs.First()));

            // Need to get the custom key bindings in the list.  It's very common for users
            // to use for example function keys (<F2>, <F3>, etc ...) in their mappings which
            // are often bound to other Visual Studio commands.
            var keyMap = buffer.Vim.KeyMap;
            foreach (var keyRemapMode in KeyRemapMode.All)
            {
                foreach (var keyMapping in keyMap.GetKeyMappingsForMode(keyRemapMode))
                {
                    keyMapping.Left.KeyInputs.ForEach(keyInput => hashSet.Add(keyInput));
                }
            }

            // Include the key used to disable VsVim
            hashSet.Add(buffer.LocalSettings.GlobalSettings.DisableAllCommand);

            return CreateCommandKeyBindingSnapshot(hashSet);
        }
开发者ID:rschatz,项目名称:VsVim,代码行数:30,代码来源:KeyBindingUtil.cs

示例7: MouseProcessor

 public MouseProcessor(IVimBuffer buffer, IMouseDevice mouseDevice)
 {
     _buffer = buffer;
     _selection = buffer.TextView.Selection;
     _mouseDevice = mouseDevice;
     _selection.SelectionChanged += OnSelectionChanged;
 }
开发者ID:ameent,项目名称:VsVim,代码行数:7,代码来源:MouseProcessor.cs

示例8: 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

示例9: LinkBanner

        void IVimBufferCreationListener.VimBufferCreated(IVimBuffer vimBuffer)
        {
            // If the notification has occured then there is nothing else to do.  We are done
            if (_vimApplicationSettings.HaveNotifiedVimRcLoad)
            {
                return;
            }

            if (!_vim.VimRcState.IsLoadSucceeded)
            {
                return;
            }

            var vimRcPath = ((VimRcState.LoadSucceeded)_vim.VimRcState).Item;
            if (vimRcPath.VimRcKind != VimRcKind.VimRc)
            {
                return;
            }

            var wpfTextView = vimBuffer.TextView as IWpfTextView;
            if (wpfTextView == null)
            {
                return;
            }

            var linkBanner = new LinkBanner();
            linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#vimrc";
            linkBanner.LinkText = "FAQ";
            linkBanner.BannerText = "VsVim automatically loaded an existing _vimrc file";
            _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_toastKey, linkBanner, OnToastNotificationClosed);
        }
开发者ID:aesire,项目名称:VsVim,代码行数:31,代码来源:VimRcLoadNotificationMarginProvider.cs

示例10: CommandMarginController

        internal CommandMarginController(IVimBuffer buffer, FrameworkElement parentVisualElement, CommandMarginControl control, IEditorFormatMap editorFormatMap, IFontProperties fontProperties, IEnumerable<Lazy<IOptionsProviderFactory>> optionsProviderFactory)
        {
            _vimBuffer = buffer;
            _margin = control;
            _parentVisualElement = parentVisualElement;
            _editorFormatMap = editorFormatMap;
            _fontProperties = fontProperties;
            _optionsProviderFactory = optionsProviderFactory.ToList().AsReadOnly();

            _vimBuffer.SwitchedMode += OnSwitchMode;
            _vimBuffer.KeyInputStart += OnKeyInputStart;
            _vimBuffer.KeyInputEnd += OnKeyInputEnd;
            _vimBuffer.StatusMessage += OnStatusMessage;
            _vimBuffer.ErrorMessage += OnErrorMessage;
            _vimBuffer.WarningMessage += OnWarningMessage;
            _vimBuffer.CommandMode.CommandChanged += OnCommandChanged;
            _vimBuffer.Vim.MacroRecorder.RecordingStarted += OnRecordingStarted;
            _vimBuffer.Vim.MacroRecorder.RecordingStopped += OnRecordingStopped;
            _margin.Loaded += OnCommandMarginLoaded;
            _margin.Unloaded += OnCommandMarginUnloaded;
            _margin.OptionsButton.Click += OnOptionsClicked;
            _margin.CommandLineTextBox.PreviewKeyDown += OnCommandLineTextBoxPreviewKeyDown;
            _margin.CommandLineTextBox.TextChanged += OnCommandLineTextBoxTextChanged;
            _margin.CommandLineTextBox.SelectionChanged += OnCommandLineTextBoxSelectionChanged;
            _margin.CommandLineTextBox.LostKeyboardFocus += OnCommandLineTextBoxLostKeyboardFocus;
            _margin.CommandLineTextBox.PreviewMouseDown += OnCommandLineTextBoxPreviewMouseDown;
            _editorFormatMap.FormatMappingChanged += OnFormatMappingChanged;
            UpdateForRecordingChanged();
            UpdateTextColor();
        }
开发者ID:louisfeng,项目名称:VsVim,代码行数:30,代码来源:CommandMarginController.cs

示例11: OnSettingChanged

 private void OnSettingChanged(IVimBuffer vimBuffer, SettingEventArgs args)
 {
     var setting = args.Setting;
     if (setting.Name == WindowSettingNames.CursorLineName)
     {
         SyncVimToEditor(vimBuffer);
     }
 }
开发者ID:rhanekom,项目名称:VsVim,代码行数:8,代码来源:SettingSynchronizer.cs

示例12: OnSettingChanged

 private void OnSettingChanged(IVimBuffer buffer, Setting args)
 {
     if (args.Name == LocalSettingNames.CursorLineName)
     {
         var options = _editorOptionsFatoryService.GetOptions(buffer.TextView);
         options.SetOptionValue(DefaultWpfViewOptions.EnableHighlightCurrentLineId, buffer.Settings.CursorLine);
     }
 }
开发者ID:rride,项目名称:VsVim,代码行数:8,代码来源:VimBufferCreationListener.cs

示例13: VimMouseProcessorTest

 protected VimMouseProcessorTest()
 {
     _vimBuffer = CreateVimBuffer("");
     _keyboardDevice = new Mock<IKeyboardDevice>(MockBehavior.Loose);
     _keyboardDevice.SetupGet(x => x.KeyModifiers).Returns(VimKeyModifiers.None);
     _vimMouseProcessor = new VimMouseProcessor(_vimBuffer, _keyboardDevice.Object);
 }
开发者ID:Yzzl,项目名称:VsVim,代码行数:7,代码来源:VimMouseProcessorTest.cs

示例14: CreateCore

        /// <summary>
        /// Create a Visual Studio simulation with the specified set of lines
        /// </summary>
        private void CreateCore(bool simulateResharper, bool usePeekRole, params string[] lines)
        {
            if (usePeekRole)
            {
                _textBuffer = CreateTextBuffer(lines);
                _textView = TextEditorFactoryService.CreateTextView(
                    _textBuffer,
                    TextEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Document, PredefinedTextViewRoles.Editable, Constants.TextViewRoleEmbeddedPeekTextView));
            }
            else
            {
                _textView = CreateTextView(lines);
                _textBuffer = _textView.TextBuffer;
            }
            _vimBuffer = Vim.CreateVimBuffer(_textView);
            _bufferCoordinator = new VimBufferCoordinator(_vimBuffer);
            _vsSimulation = new VsSimulation(
                _bufferCoordinator,
                simulateResharper: simulateResharper,
                simulateStandardKeyMappings: false,
                editorOperationsFactoryService: EditorOperationsFactoryService,
                keyUtil: KeyUtil);

            VimHost.TryCustomProcessFunc = (textView, insertCommand) =>
                {
                    if (textView == _textView)
                    {
                        return _vsSimulation.VsCommandTarget.TryCustomProcess(insertCommand);
                    }

                    return false;
                };
        }
开发者ID:Kazark,项目名称:VsVim,代码行数:36,代码来源:VsIntegrationTest.cs

示例15: VsCommandTargetTest

        public VsCommandTargetTest()
        {
            _textView = CreateTextView("");
            _buffer = Vim.CreateVimBuffer(_textView);
            _bufferCoordinator = new VimBufferCoordinator(_buffer);
            _vim = _buffer.Vim;
            _factory = new MockRepository(MockBehavior.Strict);

            // By default Resharper isn't loaded
            _resharperUtil = _factory.Create<IResharperUtil>();
            _resharperUtil.SetupGet(x => x.IsInstalled).Returns(false);

            _nextTarget = _factory.Create<IOleCommandTarget>(MockBehavior.Strict);
            _vsAdapter = _factory.Create<IVsAdapter>();
            _vsAdapter.SetupGet(x => x.KeyboardDevice).Returns(InputManager.Current.PrimaryKeyboardDevice);
            _vsAdapter.Setup(x => x.InAutomationFunction).Returns(false);
            _vsAdapter.Setup(x => x.InDebugMode).Returns(false);
            _vsAdapter.Setup(x => x.IsIncrementalSearchActive(It.IsAny<ITextView>())).Returns(false);

            _broker = _factory.Create<IDisplayWindowBroker>(MockBehavior.Loose);

            var oldCommandFilter = _nextTarget.Object;
            var vsTextView = _factory.Create<IVsTextView>(MockBehavior.Loose);
            vsTextView.Setup(x => x.AddCommandFilter(It.IsAny<IOleCommandTarget>(), out oldCommandFilter)).Returns(0);
            var result = VsCommandTarget.Create(
                _bufferCoordinator,
                vsTextView.Object,
                _vsAdapter.Object,
                _broker.Object,
                _resharperUtil.Object,
                KeyUtil);
            Assert.True(result.IsSuccess);
            _targetRaw = result.Value;
            _target = _targetRaw;
        }
开发者ID:kcprogrammer,项目名称:VsVim,代码行数:35,代码来源:VsCommandTargetTest.cs


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