public RemoteHostClientServiceFactory(
     [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners,
     IDiagnosticAnalyzerService analyzerService)
 {
     _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.RemoteHostClient);
     _analyzerService = analyzerService;
 }
            public TagComputer(
                ITextBuffer subjectBuffer,
                IForegroundNotificationService notificationService,
                IAsynchronousOperationListener asyncListener,
                ClassificationTypeMap typeMap,
                SyntacticClassificationTaggerProvider taggerProvider,
                IViewSupportsClassificationService viewSupportsClassificationServiceOpt,
                ITextBufferAssociatedViewService associatedViewService,
                IEditorClassificationService editorClassificationService,
                string languageName)
            {
                _subjectBuffer = subjectBuffer;
                _notificationService = notificationService;
                _listener = asyncListener;
                _typeMap = typeMap;
                _taggerProvider = taggerProvider;
                _viewSupportsClassificationServiceOpt = viewSupportsClassificationServiceOpt;
                _associatedViewService = associatedViewService;
                _editorClassificationService = editorClassificationService;
                _languageName = languageName;

                _workQueue = new AsynchronousSerialWorkQueue(asyncListener);
                _reportChangeCancellationSource = new CancellationTokenSource();

                _lastLineCache = new LastLineCache();

                _workspaceRegistration = Workspace.GetWorkspaceRegistration(subjectBuffer.AsTextContainer());
                _workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;

                ConnectToWorkspace(_workspaceRegistration.Workspace);
            }
 private static DiagnosticAnalyzerService CreateDiagnosticAnalyzerService(
     Dictionary<string, DiagnosticAnalyzer[]> analyzerMap, IAsynchronousOperationListener listener)
 {
     return analyzerMap == null || analyzerMap.Count == 0
         ? new MyDiagnosticAnalyzerService(DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap(), listener: listener)
         : new MyDiagnosticAnalyzerService(analyzerMap.ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value.ToImmutableArray()), listener: listener);
 }
Exemplo n.º 4
0
 public CallHierarchyProvider(
     [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners,
     IGlyphService glyphService)
 {
     _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.CallHierarchy);
     this.GlyphService = glyphService;
 }
 public VisualStudioRuleSetManager(
     IVsFileChangeEx fileChangeService, IForegroundNotificationService foregroundNotificationService, IAsynchronousOperationListener listener)
 {
     _fileChangeService = fileChangeService;
     _foregroundNotificationService = foregroundNotificationService;
     _listener = listener;
 }
 public VisualStudioErrorReportingService(
     VisualStudioWorkspaceImpl workspace, IForegroundNotificationService foregroundNotificationService, IAsynchronousOperationListener listener)
 {
     _workspace = workspace;
     _foregroundNotificationService = foregroundNotificationService;
     _listener = listener;
 }
            public Searcher(
                Solution solution,
                IAsynchronousOperationListener asyncListener,
                INavigateToItemDisplayFactory displayFactory,
                INavigateToCallback callback,
                string searchPattern,
                bool searchCurrentDocument,
                CancellationToken cancellationToken)
            {
                _solution = solution;
                _displayFactory = displayFactory;
                _callback = callback;
                _searchPattern = searchPattern;
                _searchCurrentDocument = searchCurrentDocument;
                _cancellationToken = cancellationToken;
                _progress = new ProgressTracker(callback.ReportProgress);
                _asyncListener = asyncListener;

                if (_searchCurrentDocument)
                {
                    var documentService = _solution.Workspace.Services.GetService<IDocumentTrackingService>();
                    var activeId = documentService.GetActiveDocument();
                    _currentDocument = activeId != null ? _solution.GetDocument(activeId) : null;
                }
            }
 public CodeModelIncrementalAnalyzerProvider(
     IForegroundNotificationService notificationService,
     [ImportMany]IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> listeners)
 {
     _listener = new AggregateAsynchronousOperationListener(listeners, FeatureAttribute.CodeModel);
     _notificationService = notificationService;
 }
            public TagComputer(
                ITextBuffer subjectBuffer,
                IForegroundNotificationService notificationService,
                IAsynchronousOperationListener asyncListener,
                ClassificationTypeMap typeMap,
                SyntacticClassificationTaggerProvider taggerProvider)
            {
                _subjectBuffer = subjectBuffer;
                _notificationService = notificationService;
                _listener = asyncListener;
                _typeMap = typeMap;
                _taggerProvider = taggerProvider;

                _workQueue = new AsynchronousSerialWorkQueue(asyncListener);
                _reportChangeCancellationSource = new CancellationTokenSource();

                _lastLineCache = new LastLineCache();

                _workspaceRegistration = Workspace.GetWorkspaceRegistration(subjectBuffer.AsTextContainer());
                _workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;

                if (_workspaceRegistration.Workspace != null)
                {
                    ConnectToWorkspace(_workspaceRegistration.Workspace);
                }
            }
Exemplo n.º 10
0
        public NavigationBarController(
            INavigationBarPresenter presenter,
            ITextBuffer subjectBuffer,
            IWaitIndicator waitIndicator,
            IAsynchronousOperationListener asyncListener)
        {
            _presenter = presenter;
            _subjectBuffer = subjectBuffer;
            _waitIndicator = waitIndicator;
            _asyncListener = asyncListener;
            _workspaceRegistration = Workspace.GetWorkspaceRegistration(subjectBuffer.AsTextContainer());
            _workspaceRegistration.WorkspaceChanged += OnWorkspaceRegistrationChanged;

            presenter.CaretMoved += OnCaretMoved;
            presenter.ViewFocused += OnViewFocused;

            presenter.DropDownFocused += OnDropDownFocused;
            presenter.ItemSelected += OnItemSelected;

            subjectBuffer.PostChanged += OnSubjectBufferPostChanged;

            // Initialize the tasks to be an empty model so we never have to deal with a null case.
            _modelTask = Task.FromResult(
                new NavigationBarModel(
                    SpecializedCollections.EmptyList<NavigationBarItem>(),
                    default(VersionStamp),
                    null));

            _selectedItemInfoTask = Task.FromResult(new NavigationBarSelectedTypeAndMember(null, null));

            if (_workspaceRegistration.Workspace != null)
            {
                ConnectToWorkspace(_workspaceRegistration.Workspace);
            }
        }
            public TrackingSession(StateMachine stateMachine, SnapshotSpan snapshotSpan, IAsynchronousOperationListener asyncListener)
            {
                AssertIsForeground();

                _asyncListener = asyncListener;
                _trackingSpan = snapshotSpan.Snapshot.CreateTrackingSpan(snapshotSpan.Span, SpanTrackingMode.EdgeInclusive);
                _cancellationTokenSource = new CancellationTokenSource();
                _cancellationToken = _cancellationTokenSource.Token;

                if (snapshotSpan.Length > 0)
                {
                    // If the snapshotSpan is nonempty, then the session began with a change that
                    // was touching a word. Asynchronously determine whether that word was a
                    // renamable identifier. If it is, alert the state machine so it can trigger
                    // tagging.

                    _originalName = snapshotSpan.GetText();
                    _isRenamableIdentifierTask = Task.Factory.SafeStartNewFromAsync(
                        () => DetermineIfRenamableIdentifierAsync(snapshotSpan, initialCheck: true),
                        _cancellationToken,
                        TaskScheduler.Default);

                    QueueUpdateToStateMachine(stateMachine, _isRenamableIdentifierTask);
                }
                else
                {
                    // If the snapshotSpan is empty, that means text was added in a location that is
                    // not touching an existing word, which happens a fair amount when writing new
                    // code. In this case we already know that the user is not renaming an
                    // identifier.

                    _isRenamableIdentifierTask = s_notRenamableTask;
                }
            }
 public StateMachine(ITextBuffer buffer, IInlineRenameService inlineRenameService, IAsynchronousOperationListener asyncListener)
 {
     _buffer = buffer;
     _buffer.Changed += Buffer_Changed;
     _inlineRenameService = inlineRenameService;
     _asyncListener = asyncListener;
 }
        public StreamingFindReferencesPresenter(
            Shell.SVsServiceProvider serviceProvider,
            ITextBufferFactoryService textBufferFactoryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            ClassificationTypeMap typeMap,
            IEditorFormatMapService formatMapService,
            [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
        {
            _serviceProvider = serviceProvider;
            _textBufferFactoryService = textBufferFactoryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService = editorOptionsFactoryService;
            _contentTypeRegistryService = contentTypeRegistryService;

            _textEditorFactoryService = textEditorFactoryService;
            _typeMap = typeMap;
            _formatMapService = formatMapService;

            _asyncListener = new AggregateAsynchronousOperationListener(
                asyncListeners, FeatureAttribute.ReferenceHighlighting);

            _vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences));
        }
            public SolutionCrawlerProgressReporter(IAsynchronousOperationListener listener)
            {
                _listener = listener;
                _eventQueue = new SimpleTaskQueue(TaskScheduler.Default);
                _eventMap = new EventMap();

                _count = 0;
            }
Exemplo n.º 15
0
 public SuggestedActionWithPreview(
     Workspace workspace, ITextBuffer subjectBuffer, ICodeActionEditHandlerService editHandler, 
     IWaitIndicator waitIndicator, CodeAction codeAction, object provider, 
     IAsynchronousOperationListener operationListener) 
     : base(workspace, subjectBuffer, editHandler, waitIndicator, codeAction,
           provider, operationListener, actionSets: null)
 {
 }
 public AggregateAsynchronousOperationListener(
     IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> listeners,
     string featureName)
 {
     _listener = (from lazy in listeners
                  where lazy.Metadata.FeatureName == featureName
                  select lazy.Value).SingleOrDefault();
 }
Exemplo n.º 17
0
 protected AbstractCallFinder(ISymbol symbol, Project project, IAsynchronousOperationListener asyncListener, CallHierarchyProvider provider)
 {
     _asyncListener = asyncListener;
     _symbol = symbol.GetSymbolKey();
     this.SymbolName = symbol.Name;
     _project = project;
     this.Provider = provider;
 }
        public VisualStudioErrorReportingService(
            VisualStudioWorkspaceImpl workspace, IForegroundNotificationService foregroundNotificationService, IAsynchronousOperationListener listener)
        {
            _workspace = workspace;
            _foregroundNotificationService = foregroundNotificationService;
            _listener = listener;

            _documentTrackingService = workspace.Services.GetService<IDocumentTrackingService>();
        }
 public VisualStudioRuleSetManagerFactory(
     SVsServiceProvider serviceProvider,
     IForegroundNotificationService foregroundNotificationService,
     [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
 {
     _serviceProvider = serviceProvider;
     _foregroundNotificationService = foregroundNotificationService;
     _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.RuleSetEditor);
 }
Exemplo n.º 20
0
 public FixMultipleOccurrencesService(
     ICodeActionEditHandlerService editHandler,
     IWaitIndicator waitIndicator,
     [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
 {
     _editHandler = editHandler;
     _waitIndicator = waitIndicator;
     _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.LightBulb);
 }
 public LineSeparatorAdornmentManagerProvider(
     IViewTagAggregatorFactoryService tagAggregatorFactoryService,
     [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
 {
     _tagAggregatorFactoryService = tagAggregatorFactoryService;
     _asyncListener = new AggregateAsynchronousOperationListener(
         asyncListeners,
         FeatureAttribute.LineSeparators);
 }
        public WorkCoordinatorRegistrationService(
            [ImportMany] IEnumerable<Lazy<IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>> analyzerProviders,
            [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
        {
            _gate = new object();

            _analyzerProviders = analyzerProviders.ToImmutableArray();
            _documentWorkCoordinatorMap = new Dictionary<Workspace, WorkCoordinator>(ReferenceEqualityComparer.Instance);
            _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.SolutionCrawler);
        }
Exemplo n.º 23
0
        public AsynchronousSerialWorkQueue(IAsynchronousOperationListener asyncListener)
            : base(assertIsForeground: false)
        {
            Contract.ThrowIfNull(asyncListener);
            _asyncListener = asyncListener;

            // Initialize so we don't have to check for null below. Force the background task to run
            // on the threadpool. 
            _currentBackgroundTask = SpecializedTasks.EmptyTask;
        }
Exemplo n.º 24
0
 protected SuggestedActionWithFlavors(
     Workspace workspace,
     ITextBuffer subjectBuffer,
     ICodeActionEditHandlerService editHandler,
     IWaitIndicator waitIndicator,
     CodeAction codeAction,
     object provider,
     IAsynchronousOperationListener operationListener) : base(workspace, subjectBuffer, editHandler, waitIndicator, codeAction, provider, operationListener)
 {
 }
Exemplo n.º 25
0
        public IdleProcessor(
            IAsynchronousOperationListener listener,
            int backOffTimeSpanInMS,
            CancellationToken cancellationToken)
        {
            this.Listener = listener;
            this.CancellationToken = cancellationToken;

            _backOffTimeSpanInMS = backOffTimeSpanInMS;
            _lastAccessTimeInMS = Environment.TickCount;
        }
Exemplo n.º 26
0
 public CodeRefactoringSuggestedAction(
     Workspace workspace,
     ITextBuffer subjectBuffer,
     ICodeActionEditHandlerService editHandler,
     IWaitIndicator waitIndicator,
     CodeAction codeAction,
     CodeRefactoringProvider provider,
     IAsynchronousOperationListener operationListener)
     : base(workspace, subjectBuffer, editHandler, waitIndicator, codeAction, provider, operationListener)
 {
 }
 internal PreviewChangesSuggestedAction(
     Workspace workspace,
     ITextBuffer subjectBuffer,
     ICodeActionEditHandlerService editHandler,
     IWaitIndicator waitIndicator,
     PreviewChangesCodeAction codeAction,
     object provider,
     IAsynchronousOperationListener operationListener)
     : base(workspace, subjectBuffer, editHandler, waitIndicator, codeAction, provider, operationListener)
 {
 }
 public StateMachine(
     ITextBuffer buffer,
     IInlineRenameService inlineRenameService,
     IAsynchronousOperationListener asyncListener,
     IDiagnosticAnalyzerService diagnosticAnalyzerService)
 {
     _buffer = buffer;
     _buffer.Changed += Buffer_Changed;
     _inlineRenameService = inlineRenameService;
     _asyncListener = asyncListener;
     _diagnosticAnalyzerService = diagnosticAnalyzerService;
 }
            public RemoteHostClientService(
                IAsynchronousOperationListener listener,
                Workspace workspace,
                IDiagnosticAnalyzerService analyzerService) :
                base()
            {
                _gate = new object();

                _listener = listener;
                _workspace = workspace;
                _analyzerService = analyzerService;
            }
 public SuggestedActionsSourceProvider(
     ICodeRefactoringService codeRefactoringService,
     IDiagnosticAnalyzerService diagnosticService,
     ICodeFixService codeFixService,
     ICodeActionEditHandlerService editHandler,
     [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners)
 {
     _codeRefactoringService = codeRefactoringService;
     _diagnosticService = diagnosticService;
     _codeFixService = codeFixService;
     _editHandler = editHandler;
     _listener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.LightBulb);
 }
 protected AsynchronousViewTaggerProvider(IThreadingContext threadingContext, IAsynchronousOperationListener asyncListener, IForegroundNotificationService _)
     : base(threadingContext, asyncListener)
 {
 }
 protected AsynchronousViewTaggerProvider(
     IAsynchronousOperationListener asyncListener,
     IForegroundNotificationService notificationService)
     : this(((Implementation.ForegroundNotification.ForegroundNotificationService)notificationService).ThreadingContext, asyncListener, notificationService)
 {
 }
Exemplo n.º 33
0
 public GlobalOperationNotificationServiceFactory(IAsynchronousOperationListenerProvider listenerProvider)
 {
     _listener  = listenerProvider.GetListener(FeatureAttribute.GlobalOperation);
     _singleton = new GlobalOperationNotificationService(_listener);
 }
Exemplo n.º 34
0
        protected AbstractController(IThreadingContext threadingContext, ITextView textView, ITextBuffer subjectBuffer, IIntelliSensePresenter <TPresenterSession, TEditorSession> presenter, IAsynchronousOperationListener asyncListener, IDocumentProvider documentProvider, string asyncOperationId)
            : base(threadingContext)
        {
            this.TextView         = textView;
            this.SubjectBuffer    = subjectBuffer;
            this.Presenter        = presenter;
            _asyncListener        = asyncListener;
            this.DocumentProvider = documentProvider;
            _asyncOperationId     = asyncOperationId;

            this.TextView.Closed += OnTextViewClosed;

            // Caret position changed only fires if the caret is explicitly moved.  It doesn't fire
            // when the caret is moved because of text change events.
            this.TextView.Caret.PositionChanged  += this.OnCaretPositionChanged;
            this.TextView.TextBuffer.PostChanged += this.OnTextViewBufferPostChanged;
        }
Exemplo n.º 35
0
        internal static List <IGraphQuery> GetGraphQueries(
            IGraphContext context,
            IThreadingContext threadingContext,
            IAsynchronousOperationListener asyncListener)
        {
            var graphQueries = new List <IGraphQuery>();

            if (context.Direction == GraphContextDirection.Self && context.RequestedProperties.Contains(DgmlNodeProperties.ContainsChildren))
            {
                graphQueries.Add(new ContainsChildrenGraphQuery());
            }

            if (context.Direction == GraphContextDirection.Contains ||
                (context.Direction == GraphContextDirection.Target && context.LinkCategories.Contains(CodeLinkCategories.Contains)))
            {
                graphQueries.Add(new ContainsGraphQuery());
            }

            if (context.LinkCategories.Contains(CodeLinkCategories.InheritsFrom))
            {
                if (context.Direction == GraphContextDirection.Target)
                {
                    graphQueries.Add(new InheritsGraphQuery());
                }
                else if (context.Direction == GraphContextDirection.Source)
                {
                    graphQueries.Add(new InheritedByGraphQuery());
                }
            }

            if (context.LinkCategories.Contains(CodeLinkCategories.SourceReferences))
            {
                graphQueries.Add(new IsUsedByGraphQuery());
            }

            if (context.LinkCategories.Contains(CodeLinkCategories.Calls))
            {
                if (context.Direction == GraphContextDirection.Target)
                {
                    graphQueries.Add(new CallsGraphQuery());
                }
                else if (context.Direction == GraphContextDirection.Source)
                {
                    graphQueries.Add(new IsCalledByGraphQuery());
                }
            }

            if (context.LinkCategories.Contains(CodeLinkCategories.Implements))
            {
                if (context.Direction == GraphContextDirection.Target)
                {
                    graphQueries.Add(new ImplementsGraphQuery());
                }
                else if (context.Direction == GraphContextDirection.Source)
                {
                    graphQueries.Add(new ImplementedByGraphQuery());
                }
            }

            if (context.LinkCategories.Contains(RoslynGraphCategories.Overrides))
            {
                if (context.Direction == GraphContextDirection.Source)
                {
                    graphQueries.Add(new OverridesGraphQuery());
                }
                else if (context.Direction == GraphContextDirection.Target)
                {
                    graphQueries.Add(new OverriddenByGraphQuery());
                }
            }

            if (context.Direction == GraphContextDirection.Custom)
            {
                var searchParameters = context.GetValue <ISolutionSearchParameters>(typeof(ISolutionSearchParameters).GUID.ToString());

                if (searchParameters != null)
                {
                    // WARNING: searchParameters.SearchQuery returns an IVsSearchQuery object, which
                    // is a COM type. Therefore, it's probably best to grab the values we want now
                    // rather than get surprised by COM marshalling later.
                    graphQueries.Add(new SearchGraphQuery(
                                         searchParameters.SearchQuery.SearchString, threadingContext, asyncListener));
                }
            }

            return(graphQueries);
        }
Exemplo n.º 36
0
            public TagSource(
                ITextView textViewOpt,
                ITextBuffer subjectBuffer,
                AbstractAsynchronousTaggerProvider <TTag> dataSource,
                IAsynchronousOperationListener asyncListener)
                : base(dataSource.ThreadingContext)
            {
                this.AssertIsForeground();
                if (dataSource.SpanTrackingMode == SpanTrackingMode.Custom)
                {
                    throw new ArgumentException("SpanTrackingMode.Custom not allowed.", "spanTrackingMode");
                }

                _subjectBuffer = subjectBuffer;
                _textViewOpt   = textViewOpt;
                _dataSource    = dataSource;
                _asyncListener = asyncListener;

                _highPriTagsChangedQueue = new AsyncBatchingWorkQueue <NormalizedSnapshotSpanCollection>(
                    TaggerDelay.NearImmediate.ComputeTimeDelay(),
                    ProcessTagsChangedAsync,
                    equalityComparer: null,
                    asyncListener,
                    _tagSourceState.Target.DisposalToken);

                if (_dataSource.AddedTagNotificationDelay == TaggerDelay.NearImmediate)
                {
                    // if the tagger wants "added tags" to be reported "NearImmediate"ly, then just reuse
                    // the "high pri" queue as that already reports things at that cadence.
                    _normalPriTagsChangedQueue = _highPriTagsChangedQueue;
                }
                else
                {
                    _normalPriTagsChangedQueue = new AsyncBatchingWorkQueue <NormalizedSnapshotSpanCollection>(
                        _dataSource.AddedTagNotificationDelay.ComputeTimeDelay(),
                        ProcessTagsChangedAsync,
                        equalityComparer: null,
                        asyncListener,
                        _tagSourceState.Target.DisposalToken);
                }

                DebugRecordInitialStackTrace();

                _eventSource = CreateEventSource();
                Connect();

                // Start computing the initial set of tags immediately.  We want to get the UI
                // to a complete state as soon as possible.
                EnqueueWork(initialTags: true);

                return;

                void Connect()
                {
                    this.AssertIsForeground();

                    _eventSource.Changed += OnEventSourceChanged;

                    if (_dataSource.TextChangeBehavior.HasFlag(TaggerTextChangeBehavior.TrackTextChanges))
                    {
                        _subjectBuffer.Changed += OnSubjectBufferChanged;
                    }

                    if (_dataSource.CaretChangeBehavior.HasFlag(TaggerCaretChangeBehavior.RemoveAllTagsOnCaretMoveOutsideOfTag))
                    {
                        if (_textViewOpt == null)
                        {
                            throw new ArgumentException(
                                      nameof(_dataSource.CaretChangeBehavior) + " can only be specified for an " + nameof(IViewTaggerProvider));
                        }

                        _textViewOpt.Caret.PositionChanged += OnCaretPositionChanged;
                    }

                    // Tell the interaction object to start issuing events.
                    _eventSource.Connect();
                }
            }
 public WorkspaceAsynchronousOperationListenerProvider(IAsynchronousOperationListenerProvider listenerProvider)
 {
     _listener = listenerProvider.GetListener(FeatureAttribute.Workspace);
 }
 public InProcOrRemoteHostAnalyzerRunner(IAsynchronousOperationListener operationListener, DiagnosticAnalyzerInfoCache analyzerInfoCache)
 {
     _asyncOperationListener = operationListener;
     _analyzerInfoCache      = analyzerInfoCache;
 }
Exemplo n.º 39
0
 public GlobalOperationNotificationService(IAsynchronousOperationListener listener)
 {
     _listener = listener;
 }
 public AbstractAsynchronousBufferTaggerProvider(
     IAsynchronousOperationListener asyncListener,
     IForegroundNotificationService notificationService)
     : base(asyncListener, notificationService)
 {
 }
Exemplo n.º 41
0
            public Service(IAsyncServiceProvider2 serviceProvider, IThreadingContext threadingContext, IAsynchronousOperationListener listener)
            {
                _serviceProvider  = serviceProvider;
                _threadingContext = threadingContext;

                _loadHubClientPackage = _threadingContext.JoinableTaskFactory.RunAsync(async() =>
                {
                    // Use the disposal token, since the caller's cancellation token will apply instead to the
                    // JoinAsync operation in GetProgressStageStatusAsync.
                    await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(alwaysYield: true, _threadingContext.DisposalToken);

                    // Make sure the HubClient package is loaded, since we rely on it for proffered OOP services
                    var shell = await _serviceProvider.GetServiceAsync <SVsShell, IVsShell7>().ConfigureAwait(true);
                    Assumes.Present(shell);

                    await shell.LoadPackageAsync(Guids.GlobalHubClientPackageGuid);
                });

                _progressStageStatus = _threadingContext.JoinableTaskFactory.RunAsync(async() =>
                {
                    // pre-emptively make sure event is subscribed. if APIs are called before it is done, calls will be blocked
                    // until event subscription is done
                    using var asyncToken = listener.BeginAsyncOperation("StatusChanged_EventSubscription");

                    await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(alwaysYield: true, _threadingContext.DisposalToken);
                    var service = await serviceProvider.GetServiceAsync <SVsOperationProgress, IVsOperationProgressStatusService>(throwOnFailure: false).ConfigureAwait(true);
                    if (service is null)
                    {
                        return(null);
                    }

                    var status              = service.GetStageStatusForSolutionLoad(CommonOperationProgressStageIds.Intellisense);
                    status.PropertyChanged += (_, _) => StatusChanged?.Invoke(this, EventArgs.Empty);

                    return(status);
                });
            }
Exemplo n.º 42
0
 protected AsynchronousTaggerProvider(
     IAsynchronousOperationListener asyncListener,
     IForegroundNotificationService notificationService)
         : base(asyncListener, notificationService)
 {
 }
Exemplo n.º 43
0
 public VisualStudioErrorReportingService(
     VisualStudioWorkspaceImpl workspace, IForegroundNotificationService foregroundNotificationService, IAsynchronousOperationListener listener)
 {
     _workspace = workspace;
     _foregroundNotificationService = foregroundNotificationService;
     _listener = listener;
 }
 protected AsynchronousViewTaggerProvider(IThreadingContext threadingContext, IAsynchronousOperationListener asyncListener)
     : base(threadingContext, asyncListener)
 {
 }
Exemplo n.º 45
0
 public BaseMemberFinder(ISymbol symbol, Project project, IAsynchronousOperationListener asyncListener, CallHierarchyProvider provider)
     : base(symbol, project, asyncListener, provider)
 {
     _text = string.Format(EditorFeaturesResources.Calls_To_Base_Member_0, symbol.ToDisplayString());
 }
Exemplo n.º 46
0
 internal GraphQueryManager(Workspace workspace, IAsynchronousOperationListener asyncListener)
 {
     _workspace     = workspace;
     _asyncListener = asyncListener;
 }
Exemplo n.º 47
0
 internal static IEnumerable <Lazy <IAsynchronousOperationListener, FeatureMetadata> > CreateListeners(
     string featureName, IAsynchronousOperationListener listener)
 {
     return(CreateListeners(ValueTuple.Create(featureName, listener)));
 }
 public Analyzer(IForegroundNotificationService notificationService, IAsynchronousOperationListener listener, VisualStudioWorkspaceImpl workspace)
 {
     _notificationService = notificationService;
     _listener            = listener;
     _workspace           = workspace;
 }
Exemplo n.º 49
0
            public WorkCoordinator(
                IAsynchronousOperationListener listener,
                IEnumerable <
                    Lazy <IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>
                    > analyzerProviders,
                bool initializeLazily,
                Registration registration
                )
            {
                _logAggregator = new LogAggregator();

                _registration = registration;
                _gate         = new object();

                _listener      = listener;
                _optionService =
                    _registration.Workspace.Services.GetRequiredService <IOptionService>();
                _documentTrackingService =
                    _registration.Workspace.Services.GetService <IDocumentTrackingService>();

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

                _eventProcessingQueue = new TaskQueue(listener, 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,
                    initializeLazily,
                    _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;

                // subscribe to active document changed event for active file background analysis scope.
                if (_documentTrackingService != null)
                {
                    _lastActiveDocument = _documentTrackingService.GetActiveDocument(
                        _registration.Workspace.CurrentSolution
                        );
                    _documentTrackingService.ActiveDocumentChanged += OnActiveDocumentChanged;
                }
            }
Exemplo n.º 50
0
 public FieldReferenceFinder(ISymbol symbol, ProjectId projectId, IAsynchronousOperationListener asyncListener, CallHierarchyProvider provider)
     : base(symbol, projectId, asyncListener, provider)
 {
 }
Exemplo n.º 51
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;

            var experimentationService = workspace.Services.GetRequiredService <IExperimentationService>();

            if (experimentationService.IsExperimentEnabled(WellKnownExperimentNames.RoslynInlineRenameFile) &&
                _renameInfo is IInlineRenameInfoWithFileRename renameInfoWithFileRename)
            {
                FileRenameInfo = renameInfoWithFileRename.GetFileRenameInfo();
            }
            else
            {
                FileRenameInfo = InlineRenameFileRenameInfo.NotAllowed;
            }

            InitializeOpenBuffers(triggerSpan);
        }