internal void DisableCompletion() { var featureService = _featureServiceFactory.GetOrCreate(WpfTextView); if (_completionDisabledToken == null) { _completionDisabledToken = featureService.Disable(PredefinedEditorFeatureNames.Completion, this); } }
/// <summary> /// Returns whether completion feature is available in the given <see cref="ITextView" />. /// Note: the second parameter <see cref="IContentType"/> is to be removed in dev16 when the experiment ends. /// </summary> /// <returns>true if experiment is enabled and feature is enabled in <see cref="ITextView"/>'s scope</returns> internal bool IsCurrentlyAvailable(ITextView textView, IContentType contentTypeToCheckBlacklist) { var featureService = FeatureServiceFactory.GetOrCreate(textView); if (!featureService.IsEnabled(PredefinedEditorFeatureNames.AsyncCompletion)) { return(false); } // Roslyn and Razor providers exist in the MEF cache, but Roslyn is not ready for public rollout yet. // However, We do want other languages (e.g. AXML, EditorConfig) to work with Async Completion API // We will remove this check once Roslyn fully embraces Async Completion API. if (!IsExperimentEnabled() && !contentTypeToCheckBlacklist.IsOfType(LanguageServerContentType) && (contentTypeToCheckBlacklist.IsOfType(RoslynLanguagesContentType) || contentTypeToCheckBlacklist.IsOfType(RazorContentType))) { return(false); } return(true); }
private bool UseLegacyCompletion(IFeatureServiceFactory featureServiceFactory, ITextView textView, ITextBuffer subjectBuffer) { var newCompletionEnabled = featureServiceFactory.GetOrCreate(textView).IsEnabled(PredefinedEditorFeatureNames.AsyncCompletion); // Check whether the feature flag (async completion API) is set or this feature is off. if (newCompletionEnabled || !subjectBuffer.GetFeatureOnOffOption(InternalFeatureOnOffOptions.CompletionSet)) { return(false); } // If we don't have a presenter, then there's no point in us even being involved. Just // defer to the next handler in the chain. // Also, if there's an inline rename session then we do not want completion. if (_completionPresenter == null || _inlineRenameService.ActiveSession != null) { return(false); } return(true); }
/// <summary> /// Returns whether completion feature is available in the given <see cref="ITextView" />. /// </summary> /// <returns>true if feature is enabled in <see cref="ITextView"/>'s scope</returns> internal bool IsCurrentlyAvailable(ITextView textView) { var featureService = FeatureServiceFactory.GetOrCreate(textView); return(featureService.IsEnabled(PredefinedEditorFeatureNames.AsyncCompletion)); }