Example #1
0
            SettingValue IVimCustomSettingSource.GetSettingValue(string name)
            {
                switch (name)
                {
                case UseEditorIndentName:
                    return(SettingValue.NewToggle(_vimApplicationSettings.UseEditorIndent));

                case UseEditorDefaultsName:
                    return(SettingValue.NewToggle(_vimApplicationSettings.UseEditorDefaults));

                case UseEditorTabAndBackspaceName:
                    return(SettingValue.NewToggle(_vimApplicationSettings.UseEditorTabAndBackspace));

                case UseEditorCommandMarginName:
                    return(SettingValue.NewToggle(_vimApplicationSettings.UseEditorCommandMargin));

                case CleanMacrosName:
                    return(SettingValue.NewToggle(_vimApplicationSettings.CleanMacros));

                case HideMarksName:
                    return(SettingValue.NewString(_vimApplicationSettings.HideMarks));

                default:
                    Debug.Assert(false);
                    return(SettingValue.NewToggle(false));
                }
            }
Example #2
0
            SettingValue IVimCustomSettingSource.GetSettingValue(string name)
            {
                bool value;

                switch (name)
                {
                case UseEditorIndentName:
                    value = _vimApplicationSettings.UseEditorIndent;
                    break;

                case UseEditorDefaultsName:
                    value = _vimApplicationSettings.UseEditorDefaults;
                    break;

                case UseEditorTabAndBackspaceName:
                    value = _vimApplicationSettings.UseEditorTabAndBackspace;
                    break;

                case UseEditorCommandMarginName:
                    value = _vimApplicationSettings.UseEditorCommandMargin;
                    break;

                case CleanMacros:
                    value = _vimApplicationSettings.CleanMacros;
                    break;

                default:
                    value = false;
                    break;
                }

                return(SettingValue.NewToggle(value));
            }
Example #3
0
        public void TrySetValue3()
        {
            foreach (var cur in _settings.Settings)
            {
                SettingValue value = null;
                if (cur.Kind.IsToggle)
                {
                    value = SettingValue.NewToggle(true);
                }
                else if (cur.Kind.IsString)
                {
                    value = SettingValue.NewString("foo");
                }
                else if (cur.Kind.IsNumber)
                {
                    value = SettingValue.NewNumber(42);
                }
                else
                {
                    throw new Exception("failed");
                }

                Assert.True(_settings.TrySetValue(cur.Abbreviation, value));
            }
        }
Example #4
0
        public void TrySetValue1()
        {
            Assert.True(_settings.TrySetValue(GlobalSettingNames.IgnoreCaseName, SettingValue.NewToggle(true)));
            var value = _settings.GetSetting(GlobalSettingNames.IgnoreCaseName);

            Assert.True(value.IsSome());
            Assert.True(value.Value.Value.AsToggle().Item);
        }
Example #5
0
        public void SettingChanged1()
        {
            var didRun = false;

            _settings.SettingChanged += (unused, args) =>
            {
                var setting = args.Setting;
                Assert.Equal(ToggleSettingName, setting.Name);
                Assert.True(setting.Value.AsToggle().Item);
                didRun = true;
            };
            _settings.TrySetValue(ToggleSettingName, SettingValue.NewToggle(true));
            Assert.True(didRun);
        }
Example #6
0
        public HostFactory(
            IVim vim,
            IVsEditorAdaptersFactoryService adaptersFactory,
            IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService,
            ITextManager textManager,
            IVsAdapter adapter,
            IProtectedOperations protectedOperations,
            IVimBufferCoordinatorFactory bufferCoordinatorFactory,
            IKeyUtil keyUtil,
            IEditorToSettingsSynchronizer editorToSettingSynchronizer,
            IVimApplicationSettings vimApplicationSettings,
            [ImportMany] IEnumerable <Lazy <ICommandTargetFactory, IOrderable> > commandTargetFactoryList)
        {
            _vim = vim;
            _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService;
            _adaptersFactory             = adaptersFactory;
            _textManager                 = textManager;
            _adapter                     = adapter;
            _protectedOperations         = protectedOperations;
            _bufferCoordinatorFactory    = bufferCoordinatorFactory;
            _keyUtil                     = keyUtil;
            _editorToSettingSynchronizer = editorToSettingSynchronizer;
            _vimApplicationSettings      = vimApplicationSettings;
            _commandTargetFactoryList    = Orderer.Order(commandTargetFactoryList).Select(x => x.Value).ToReadOnlyCollection();

#if DEBUG
            VimTrace.TraceSwitch.Level = TraceLevel.Verbose;
#endif

            // Make sure that for this
            _editorToSettingSynchronizer.SyncSetting(SettingSyncData.Create(
                                                         DefaultWpfViewOptions.EnableHighlightCurrentLineId,
                                                         WindowSettingNames.CursorLineName,
                                                         false,
                                                         x => SettingValue.NewToggle(x),
                                                         s => s.GetToggle()));
        }
Example #7
0
 SettingValue IVimCustomSettingSource.GetDefaultSettingValue(string name)
 {
     return(SettingValue.NewToggle(true));
 }