Exemple #1
0
 public void SetFileScopedNamespaces(bool value)
 => InvokeOnUIThread(cancellationToken =>
 {
     _visualStudioWorkspace.SetOptions(_visualStudioWorkspace.Options.WithChangedOption(
                                           new OptionKey(GetOption("NamespaceDeclarations", "CSharpCodeStyleOptions")),
                                           new CodeStyleOption2 <NamespaceDeclarationPreference>(value
                 ? NamespaceDeclarationPreference.FileScoped
                 : NamespaceDeclarationPreference.BlockScoped,
                                                                                                 NotificationOption2.Suggestion)));
 });
Exemple #2
0
 public void SetPrettyListing(string languageName, bool value) =>
 InvokeOnUIThread(
     cancellationToken =>
 {
     _visualStudioWorkspace.SetOptions(
         _visualStudioWorkspace.Options.WithChangedOption(
             FeatureOnOffOptions.PrettyListing,
             languageName,
             value
             )
         );
 }
     );
            public void ApplyColorScheme(SchemeName schemeName, ImmutableArray <RegistryItem> registryItems)
            {
                using var registryRoot = VSRegistry.RegistryRoot(_serviceProvider, __VsLocalRegistryType.RegType_Configuration, writable: true);

                foreach (var item in registryItems)
                {
                    using var itemKey = registryRoot.CreateSubKey(item.SectionName);
                    itemKey.SetValue(item.ValueName, item.ValueData);
                }

                _workspace.SetOptions(_workspace.Options.WithChangedOption(ColorSchemeOptions.AppliedColorScheme, schemeName));

                // Broadcast that system color settings have changed to force the ColorThemeService to reload colors.
                NativeMethods.PostMessage(NativeMethods.HWND_BROADCAST, NativeMethods.WM_SYSCOLORCHANGE, wparam: IntPtr.Zero, lparam: IntPtr.Zero);
            }
Exemple #4
0
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName != nameof(ITaskList.CommentTokens))
            {
                return;
            }

            var commentString = GetTaskTokenList(_taskList);

            var optionSet   = _workspace.Options;
            var optionValue = optionSet.GetOption(TodoCommentOptions.TokenList);

            if (optionValue == commentString)
            {
                return;
            }

            // cache last result
            _lastCommentTokenCache = commentString;

            // let people to know that comment string has changed
            _workspace.SetOptions(optionSet.WithChangedOption(TodoCommentOptions.TokenList, _lastCommentTokenCache));
        }