internal OptionSet ApplyChangedOptions(OptionSet optionSet) { foreach (var optionKey in this.Options.GetChangedOptions(_originalOptions)) { optionSet = optionSet.WithChangedOption(optionKey, this.Options.GetOption(optionKey)); } return(optionSet); }
public void SetOptionAndUpdatePreview <T>(T value, IOption option, string preview) { if (option is Option <T> ) { Options = Options.WithChangedOption((Option <T>)option, value); } else if (option is PerLanguageOption <T> ) { Options = Options.WithChangedOption((PerLanguageOption <T>)option, Language, value); } else { throw new InvalidOperationException("Unexpected option type"); } UpdateDocument(preview); }
protected AbstractOptionPreviewViewModel(OptionSet options, IServiceProvider serviceProvider, string language) { this.Options = options; _originalOptions = options; this.Items = new List <object>(); _componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); _contentTypeRegistryService = _componentModel.GetService <IContentTypeRegistryService>(); _textBufferFactoryService = _componentModel.GetService <ITextBufferFactoryService>(); _textEditorFactoryService = _componentModel.GetService <ITextEditorFactoryService>(); _projectionBufferFactory = _componentModel.GetService <IProjectionBufferFactoryService>(); _editorOptions = _componentModel.GetService <IEditorOptionsFactoryService>(); this.Language = language; _contentType = _contentTypeRegistryService.GetContentType(ContentTypeNames.HlslContentType); }
public NewLinesViewModel(OptionSet options, IServiceProvider serviceProvider) : base(options, serviceProvider, LanguageNames.Hlsl) { AddOpenBraceGroup("openbracestypes", "Position of open braces for types", TypePreview, HlslFormattingOptions.OpenBracePositionForTypes); AddOpenBraceGroup("openbracestechniques", "Position of open braces for techniques and passes", TechniquePreview, HlslFormattingOptions.OpenBracePositionForTechniques); AddOpenBraceGroup("openbracesfunctions", "Position of open braces for functions", FunctionPreview, HlslFormattingOptions.OpenBracePositionForFunctions); AddOpenBraceGroup("openbracescontrolblocks", "Position of open braces for control blocks", ControlBlockPreview, HlslFormattingOptions.OpenBracePositionForControlBlocks); AddOpenBraceGroup("openbracesstateblocks", "Position of open braces for state blocks", StateBlockPreview, HlslFormattingOptions.OpenBracePositionForStateBlocks); AddOpenBraceGroup("openbracesarrayinitializers", "Position of open braces for array initializers", ArrayInitializerPreview, HlslFormattingOptions.OpenBracePositionForArrayInitializers); Items.Add(new HeaderItemViewModel { Header = "New line options for keywords" }); Items.Add(new CheckBoxOptionViewModel(HlslFormattingOptions.PlaceElseOnNewLine, "Place \"else\" on new line", ElsePreview, this, Options)); }
public CheckBoxOptionViewModel(IOption option, string description, string truePreview, string falsePreview, AbstractOptionPreviewViewModel info, OptionSet options) : base(option, description, truePreview, falsePreview, info) { SetProperty(ref _isChecked, (bool)options.GetOption(new OptionKey(option, option.IsPerLanguage ? info.Language : null))); }
public CheckBoxOptionViewModel(IOption option, string description, string preview, AbstractOptionPreviewViewModel info, OptionSet options) : this(option, description, preview, preview, info, options) { }
public RadioButtonViewModel(string description, string preview, string group, TOption value, Option <TOption> option, AbstractOptionPreviewViewModel info, OptionSet options) : base(description, preview, info, options, isChecked: options.GetOption(option).Equals(value), group: group) { _value = value; _option = option; }