public DebuggerIntelliSenseFilter(
     IWpfTextView wpfTextView,
     IComponentModel componentModel,
     IFeatureServiceFactory featureServiceFactory)
     : base(wpfTextView, componentModel)
 {
     _featureServiceFactory = featureServiceFactory;
 }
Exemplo n.º 2
0
        public InlineRenameSession(
            IThreadingContext threadingContext,
            InlineRenameService renameService,
            Workspace workspace,
            SnapshotSpan triggerSpan,
            IInlineRenameInfo renameInfo,
            IWaitIndicator waitIndicator,
            ITextBufferAssociatedViewService textBufferAssociatedViewService,
            ITextBufferFactoryService textBufferFactoryService,
            IFeatureServiceFactory featureServiceFactory,
            IEnumerable <IRefactorNotifyService> refactorNotifyServices,
            IAsynchronousOperationListener asyncListener)
            : base(threadingContext, assertIsForeground: true)
        {
            // This should always be touching a symbol since we verified that upon invocation
            _renameInfo = renameInfo;

            _triggerDocument = triggerSpan.Snapshot.GetOpenDocumentInCurrentContextWithChanges();
            if (_triggerDocument == null)
            {
                throw new InvalidOperationException(EditorFeaturesResources.The_triggerSpan_is_not_included_in_the_given_workspace);
            }

            _inlineRenameSessionDurationLogBlock = Logger.LogBlock(FunctionId.Rename_InlineSession, CancellationToken.None);

            _workspace = workspace;
            _workspace.WorkspaceChanged += OnWorkspaceChanged;

            _textBufferFactoryService        = textBufferFactoryService;
            _textBufferAssociatedViewService = textBufferAssociatedViewService;
            _textBufferAssociatedViewService.SubjectBuffersConnected += OnSubjectBuffersConnected;

            // Disable completion when an inline rename session starts
            _featureService          = featureServiceFactory.GlobalFeatureService;
            _completionDisabledToken = _featureService.Disable(PredefinedEditorFeatureNames.Completion, this);

            _renameService          = renameService;
            _waitIndicator          = waitIndicator;
            _refactorNotifyServices = refactorNotifyServices;
            _asyncListener          = asyncListener;
            _triggerView            = textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).FirstOrDefault(v => v.HasAggregateFocus) ??
                                      textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).First();

            _optionSet = renameInfo.ForceRenameOverloads
                ? workspace.Options.WithChangedOption(RenameOptions.RenameOverloads, true)
                : workspace.Options;

            this.ReplacementText = triggerSpan.GetText();

            _baseSolution    = _triggerDocument.Project.Solution;
            this.UndoManager = workspace.Services.GetService <IInlineRenameUndoManager>();

            _debuggingWorkspaceService = workspace.Services.GetService <IDebuggingWorkspaceService>();
            _debuggingWorkspaceService.BeforeDebuggingStateChanged += OnBeforeDebuggingStateChanged;

            InitializeOpenBuffers(triggerSpan);
        }
Exemplo n.º 3
0
 public DebuggerIntelliSenseFilter(
     AbstractLanguageService <TPackage, TLanguageService> languageService,
     IWpfTextView wpfTextView,
     IVsEditorAdaptersFactoryService adapterFactory,
     IFeatureServiceFactory featureServiceFactory)
     : base(languageService, wpfTextView, adapterFactory)
 {
     _featureServiceFactory = featureServiceFactory;
 }
Exemplo n.º 4
0
 public InlineRenameService(
     IThreadingContext threadingContext,
     IWaitIndicator waitIndicator,
     ITextBufferAssociatedViewService textBufferAssociatedViewService,
     ITextBufferFactoryService textBufferFactoryService,
     IFeatureServiceFactory featureServiceFactory,
     [ImportMany] IEnumerable <IRefactorNotifyService> refactorNotifyServices,
     IAsynchronousOperationListenerProvider listenerProvider)
 {
     _threadingContext = threadingContext;
     _waitIndicator    = waitIndicator;
     _textBufferAssociatedViewService = textBufferAssociatedViewService;
     _textBufferFactoryService        = textBufferFactoryService;
     _featureServiceFactory           = featureServiceFactory;
     _refactorNotifyServices          = refactorNotifyServices;
     _asyncListener = listenerProvider.GetListener(FeatureAttribute.Rename);
 }
Exemplo n.º 5
0
 public InlineRenameService(
     IThreadingContext threadingContext,
     IUIThreadOperationExecutor uiThreadOperationExecutor,
     ITextBufferAssociatedViewService textBufferAssociatedViewService,
     ITextBufferFactoryService textBufferFactoryService,
     IFeatureServiceFactory featureServiceFactory,
     IGlobalOptionService globalOptions,
     [ImportMany] IEnumerable <IRefactorNotifyService> refactorNotifyServices,
     IAsynchronousOperationListenerProvider listenerProvider)
 {
     _threadingContext                = threadingContext;
     _uiThreadOperationExecutor       = uiThreadOperationExecutor;
     _textBufferAssociatedViewService = textBufferAssociatedViewService;
     _textBufferFactoryService        = textBufferFactoryService;
     _featureServiceFactory           = featureServiceFactory;
     _refactorNotifyServices          = refactorNotifyServices;
     _asyncListener = listenerProvider.GetListener(FeatureAttribute.Rename);
     GlobalOptions  = globalOptions;
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public AsyncCompletionService(
            IThreadingContext threadingContext,
            IEditorOperationsFactoryService editorOperationsFactoryService,
            IFeatureServiceFactory featureServiceFactory,
            ITextUndoHistoryRegistry undoHistoryRegistry,
            IInlineRenameService inlineRenameService,
            IAsynchronousOperationListenerProvider listenerProvider,
            [ImportMany] IEnumerable <Lazy <IIntelliSensePresenter <ICompletionPresenterSession, ICompletionSession>, OrderableMetadata> > completionPresenters,
            [ImportMany] IEnumerable <Lazy <IBraceCompletionSessionProvider, BraceCompletionMetadata> > autoBraceCompletionChars)
            : base(threadingContext)
        {
            _editorOperationsFactoryService = editorOperationsFactoryService;
            _featureServiceFactory          = featureServiceFactory;
            _undoHistoryRegistry            = undoHistoryRegistry;
            _inlineRenameService            = inlineRenameService;
            _completionPresenter            = ExtensionOrderer.Order(completionPresenters).Select(lazy => lazy.Value).FirstOrDefault();
            _listener = listenerProvider.GetListener(FeatureAttribute.CompletionSet);

            _autoBraceCompletionChars   = autoBraceCompletionChars;
            _autoBraceCompletionCharSet = new Dictionary <IContentType, ImmutableHashSet <char> >();
        }
Exemplo n.º 8
0
 internal bool UseLegacyCompletion(IFeatureServiceFactory featureServiceFactory, ITextView textView, ITextBuffer subjectBuffer)
 => _asyncCompletionService.UseLegacyCompletion(featureServiceFactory, textView, subjectBuffer);
Exemplo n.º 9
0
        public InlineRenameSession(
            IThreadingContext threadingContext,
            InlineRenameService renameService,
            Workspace workspace,
            SnapshotSpan triggerSpan,
            IInlineRenameInfo renameInfo,
            SymbolRenameOptions options,
            bool previewChanges,
            IUIThreadOperationExecutor uiThreadOperationExecutor,
            ITextBufferAssociatedViewService textBufferAssociatedViewService,
            ITextBufferFactoryService textBufferFactoryService,
            IFeatureServiceFactory featureServiceFactory,
            IEnumerable <IRefactorNotifyService> refactorNotifyServices,
            IAsynchronousOperationListener asyncListener)
        {
            // This should always be touching a symbol since we verified that upon invocation
            _threadingContext = threadingContext;
            _renameInfo       = renameInfo;

            _triggerSpan     = triggerSpan;
            _triggerDocument = triggerSpan.Snapshot.GetOpenDocumentInCurrentContextWithChanges();
            if (_triggerDocument == null)
            {
                throw new InvalidOperationException(EditorFeaturesResources.The_triggerSpan_is_not_included_in_the_given_workspace);
            }

            _inlineRenameSessionDurationLogBlock = Logger.LogBlock(FunctionId.Rename_InlineSession, CancellationToken.None);

            _workspace = workspace;
            _workspace.WorkspaceChanged += OnWorkspaceChanged;

            _textBufferFactoryService        = textBufferFactoryService;
            _textBufferAssociatedViewService = textBufferAssociatedViewService;
            _textBufferAssociatedViewService.SubjectBuffersConnected += OnSubjectBuffersConnected;

            // Disable completion when an inline rename session starts
            _featureService            = featureServiceFactory.GlobalFeatureService;
            _completionDisabledToken   = _featureService.Disable(PredefinedEditorFeatureNames.Completion, this);
            RenameService              = renameService;
            _uiThreadOperationExecutor = uiThreadOperationExecutor;
            _refactorNotifyServices    = refactorNotifyServices;
            _asyncListener             = asyncListener;
            _triggerView = textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).FirstOrDefault(v => v.HasAggregateFocus) ??
                           textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).First();

            _options        = options;
            _previewChanges = previewChanges;

            _initialRenameText   = triggerSpan.GetText();
            this.ReplacementText = _initialRenameText;

            _baseSolution    = _triggerDocument.Project.Solution;
            this.UndoManager = workspace.Services.GetService <IInlineRenameUndoManager>();

            if (_renameInfo is IInlineRenameInfoWithFileRename renameInfoWithFileRename)
            {
                FileRenameInfo = renameInfoWithFileRename.GetFileRenameInfo();
            }
            else
            {
                FileRenameInfo = InlineRenameFileRenameInfo.NotAllowed;
            }

            InitializeOpenBuffers(triggerSpan);
        }