当前位置: 首页>>代码示例>>C#>>正文


C# IOptionService.GetOption方法代码示例

本文整理汇总了C#中IOptionService.GetOption方法的典型用法代码示例。如果您正苦于以下问题:C# IOptionService.GetOption方法的具体用法?C# IOptionService.GetOption怎么用?C# IOptionService.GetOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOptionService的用法示例。


在下文中一共展示了IOptionService.GetOption方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetInitialCacheValues

        protected void GetInitialCacheValues(IOptionService service, Option<int> minimumCountKey, Option<long> sizeKey, out int minimumCount, out long size)
        {
            if (service == null)
            {
                minimumCount = InitialMinimumCount;
                size = InitialCacheSize;
            }

            minimumCount = service.GetOption(minimumCountKey);
            size = service.GetOption(sizeKey);
        }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:11,代码来源:AbstractCacheServiceFactory.cs

示例2: GetLoggingChecker

        /// <summary>
        /// let ones such as Perf setup to share loggingChecker func
        /// </summary>
        internal static Func<FunctionId, bool> GetLoggingChecker(IOptionService optionsService)
        {
            var functionIds = Enum.GetValues(typeof(FunctionId)).Cast<FunctionId>();
            var functionIdOptions = functionIds.ToDictionary(
                id => id, id => optionsService.GetOption(FunctionIdOptions.GetOption(id)));

            Func<FunctionId, bool> loggingChecker = (functionId) => functionIdOptions[functionId];

            return loggingChecker;
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:13,代码来源:DiagnosticOnly_Logger.cs

示例3: IsClosedFileDiagnosticsEnabled

        public static bool IsClosedFileDiagnosticsEnabled(IOptionService optionService, string language)
        {
            var option = optionService.GetOption(ClosedFileDiagnostic, language);
            if (!option.HasValue)
            {
                return language == LanguageNames.CSharp ?
                    CSharpClosedFileDiagnosticsEnabledByDefault :
                    DefaultClosedFileDiagnosticsEnabledByDefault;
            }

            return option.Value;
        }
开发者ID:rgani,项目名称:roslyn,代码行数:12,代码来源:ServiceFeatureOnOffOptions.cs

示例4: WorkCoordinator

            public WorkCoordinator(
                 IAsynchronousOperationListener listener,
                 IEnumerable<Lazy<IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>> analyzerProviders,
                 Registration registration)
            {
                _logAggregator = new LogAggregator();

                _registration = registration;

                _listener = listener;
                _optionService = _registration.GetService<IOptionService>();

                // event and worker queues
                _shutdownNotificationSource = new CancellationTokenSource();
                _shutdownToken = _shutdownNotificationSource.Token;

                _eventProcessingQueue = new SimpleTaskQueue(TaskScheduler.Default);

                var activeFileBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS);
                var allFilesWorkerBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS);
                var entireProjectWorkerBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS);

                _documentAndProjectWorkerProcessor = new IncrementalAnalyzerProcessor(
                    listener, analyzerProviders, _registration,
                    activeFileBackOffTimeSpanInMS, allFilesWorkerBackOffTimeSpanInMS, entireProjectWorkerBackOffTimeSpanInMS, _shutdownToken);

                var semanticBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS);
                var projectBackOffTimeSpanInMS = _optionService.GetOption(InternalSolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS);

                _semanticChangeProcessor = new SemanticChangeProcessor(listener, _registration, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpanInMS, projectBackOffTimeSpanInMS, _shutdownToken);

                // if option is on
                if (_optionService.GetOption(InternalSolutionCrawlerOptions.SolutionCrawler))
                {
                    _registration.Workspace.WorkspaceChanged += OnWorkspaceChanged;
                    _registration.Workspace.DocumentOpened += OnDocumentOpened;
                    _registration.Workspace.DocumentClosed += OnDocumentClosed;
                }

                // subscribe to option changed event after all required fields are set
                // otherwise, we can get null exception when running OnOptionChanged handler
                _optionService.OptionChanged += OnOptionChanged;
            }
开发者ID:TyOverby,项目名称:roslyn,代码行数:43,代码来源:WorkCoordinator.cs

示例5: WorkCoordinator

            public WorkCoordinator(
                 IAsynchronousOperationListener listener,
                 IEnumerable<Lazy<IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>> analyzerProviders,
                 int correlationId, Workspace workspace)
            {
                _logAggregator = new LogAggregator();

                _listener = listener;
                _optionService = workspace.Services.GetService<IOptionService>();
                _optionService.OptionChanged += OnOptionChanged;

                // set up workspace 
                _correlationId = correlationId;
                _workspace = workspace;

                // event and worker queues
                _shutdownNotificationSource = new CancellationTokenSource();
                _shutdownToken = _shutdownNotificationSource.Token;

                _eventProcessingQueue = new SimpleTaskQueue(TaskScheduler.Default);

                var activeFileBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS);
                var allFilesWorkerBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS);
                var entireProjectWorkerBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS);
                _documentAndProjectWorkerProcessor = new IncrementalAnalyzerProcessor(
                    listener, correlationId, workspace, analyzerProviders, activeFileBackOffTimeSpanInMS, allFilesWorkerBackOffTimeSpanInMS, entireProjectWorkerBackOffTimeSpanInMS, _shutdownToken);

                var semanticBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS);
                var projectBackOffTimeSpanInMS = _optionService.GetOption(SolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS);

                _semanticChangeProcessor = new SemanticChangeProcessor(listener, correlationId, workspace, _documentAndProjectWorkerProcessor, semanticBackOffTimeSpanInMS, projectBackOffTimeSpanInMS, _shutdownToken);

                // if option is on
                if (_optionService.GetOption(SolutionCrawlerOptions.SolutionCrawler))
                {
                    _workspace.WorkspaceChanged += OnWorkspaceChanged;
                    _workspace.DocumentOpened += OnDocumentOpened;
                    _workspace.DocumentClosed += OnDocumentClosed;
                }
            }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:40,代码来源:WorkCoordinator.cs

示例6: GetRefactorings

            private IEnumerable<SuggestedActionSet> GetRefactorings(
                ISuggestedActionCategorySet requestedActionCategories,
                Document document,
                ITextSnapshot snapshot,
                Workspace workspace,
                IOptionService optionService,
                CancellationToken cancellationToken)
            {
                // For Dev14 Preview, we also want to show refactorings in the CodeFix list when users press Ctrl+.
                if (requestedActionCategories.Contains(PredefinedSuggestedActionCategoryNames.Refactoring) ||
                    requestedActionCategories.Contains(PredefinedSuggestedActionCategoryNames.CodeFix))
                {
                    var refactoringsOn = optionService.GetOption(EditorComponentOnOffOptions.CodeRefactorings);
                    if (!refactoringsOn)
                    {
                        return null;
                    }

                    // Get the selection while on the UI thread.
                    var selection = GetCodeRefactoringSelection(snapshot);
                    if (!selection.HasValue)
                    {
                        // this is here to fail test and see why it is failed.
                        System.Diagnostics.Trace.WriteLine("given range is not current");
                        return null;
                    }

                    var refactorings = Task.Run(
                        async () => await _owner._codeRefactoringService.GetRefactoringsAsync(document, selection.Value, cancellationToken).ConfigureAwait(false), cancellationToken).WaitAndGetResult(cancellationToken);

                    return refactorings.Select(r => OrganizeRefactorings(workspace, r));
                }

                return null;
            }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:35,代码来源:SuggestedActionsSourceProvider.cs


注:本文中的IOptionService.GetOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。