Closed tmat closed 1 week ago
@jmarolf @jasonmalinowski FYI
@tmat Is there something you are trying to accomplish here? I'm unable to prioritize any action here based on your description above.
Yes, I am trying to use GlobalOptionService, but as it currently is implemented I can't. Instead I need to get OptionService from a Workspace, even though the code doesn't really depend on Workspace otherwise it needs to import it just to get OptionService.
Also, as pointed out above, the design and implementation looks suspicious and could use some cleanup.
Closing out. We redid all this. If there's still more work to do we should call it out specifically.
See check here: http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/Options/GlobalOptionService.cs,101
Roslyn provides convenient infrastructure for managing options with various persistence models. GlobalOpionService seems to be the right type for managing options that are not specific to a particular workspace. Currently it's limited to WorkspaceOptionSet. I think it should provide abstraction independent of a workspace.
Also the implementation of GetAccessedOptions is suspicious: http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/Options/WorkspaceOptionSet.cs,58
Although
_service
is typed toIOptionsService
it seems that it is always gonna beOptionServiceFactory.OptionsService
.GetOptions()
returnsnew WorkspaceOptionSet(this)
, whcih returns an empty option set tied to the workspace service. So basically the call toGetChangedOptions(optionSet)
starts with empty cached options, populates them using the backing service and then throws them away. Not sure what the intent is exactly, but perhaps it could be implemented in more straightforward way.