Пример #1
0
            public MockHostWorkspaceServices(HostServices hostServices, Workspace workspace)
            {
                _hostServices = hostServices;
                _workspace    = workspace;

                var globalOptionService = new GlobalOptionService(workspaceThreadingService: null, ImmutableArray <Lazy <IOptionProvider, LanguageMetadata> > .Empty, ImmutableArray <Lazy <IOptionPersisterProvider> > .Empty);

                _optionService = new OptionServiceFactory.OptionService(globalOptionService, this);
            }
        public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
        {
            // give out new option service per workspace
            var service = new OptionServiceFactory.OptionService(
                new GlobalOptionService(_providers, SpecializedCollections.EmptyEnumerable <Lazy <IOptionPersister> >()),
                workspaceServices);

            foreach (var factory in _documentOptionsProviderFactories)
            {
                service.RegisterDocumentOptionsProvider(factory.Create(workspaceServices.Workspace));
            }

            return(service);
        }