Skip to content

Monitor a VS Setting for Changes? #347

Answered by CalvinAllen
CalvinAllen asked this question in Q&A
Discussion options

You must be logged in to vote

Well, answered my own question. For the next unfortunate soul -

[Guid("9B164E40-C3A2-4363-9BC5-EB4039DEF653")]
private class SVsSettingsPersistenceManager { }

public VisualStudioSettingsManager([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider){
  _settingsManager = serviceProvider.GetService(typeof(SVsSettingsPersistenceManager)) as ISettingsManager;
  
  var setting = _roamingSettingsManager.GetSubset("TextEditorGlobalOptions.IsCodeLensEnabled");
  
  setting.SettingChangedAsync += (sender, args) => {
       // Do something
       return Task.CompletedTask;
  };
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CalvinAllen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant