In my extension that I am writing for Visual Studio 2015 I want to change the tab size and indent size as at work we have a different setting as when I am developing for opensource project (company history dating our C period). I have written the following code in my command class:
private const string CollectionPath = @"Text Editor\CSharp";
private void MenuItemCallback(object sender, EventArgs e)
{
var settingsManager = new ShellSettingsManager(ServiceProvider);
var settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
var tabSize = settingsStore.GetInt32(CollectionPath, "Tab Size", -1);
var indentSize = settingsStore.GetInt32(CollectionPath, "Indent Size", -1);
if (tabSize != -1 && indentSize != -1)
{
settingsStore.SetInt32(CollectionPath, "Tab Size", 2);
settingsStore.SetInt32(CollectionPath, "Indent Size", 2);
}
}
When testing in an experimental hive it changes it when you step through the method but when you open the Options dialog it stays the original values. When you debug again the values stay the original.
What did I forget or did wrong?