public DiagnosticService( IAsynchronousOperationListenerProvider listenerProvider, [ImportMany] IEnumerable <Lazy <IEventListener, EventListenerMetadata> > eventListeners) { // we use registry service rather than doing MEF import since MEF import method can have race issue where // update source gets created before aggregator - diagnostic service - is created and we will lose events fired before // the aggregator is created. _updateSources = ImmutableHashSet <IDiagnosticUpdateSource> .Empty; // queue to serialize events. _eventMap = new EventMap(); _eventQueue = new TaskQueue(listenerProvider.GetListener(FeatureAttribute.DiagnosticService), TaskScheduler.Default); _gate = new object(); _map = new Dictionary <IDiagnosticUpdateSource, Dictionary <Workspace, Dictionary <object, Data> > >(); _eventListenerTracker = new EventListenerTracker <IDiagnosticService>(eventListeners, WellKnownEventListeners.DiagnosticService); }
public CSharpVsInteractiveWindowProvider( IThreadingContext threadingContext, SVsServiceProvider serviceProvider, IAsynchronousOperationListenerProvider listenerProvider, IVsInteractiveWindowFactory interactiveWindowFactory, IViewClassifierAggregatorService classifierAggregator, IContentTypeRegistryService contentTypeRegistry, IInteractiveWindowCommandsFactory commandsFactory, [ImportMany] IInteractiveWindowCommand[] commands, IGlobalOptionService globalOptions, ITextDocumentFactoryService textDocumentFactoryService, VisualStudioWorkspace workspace) : base(serviceProvider, interactiveWindowFactory, classifierAggregator, contentTypeRegistry, commandsFactory, commands, workspace) { _threadingContext = threadingContext; _listener = listenerProvider.GetListener(FeatureAttribute.InteractiveEvaluator); _globalOptions = globalOptions; _textDocumentFactoryService = textDocumentFactoryService; }
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; }
public SolutionChecksumUpdater(Workspace workspace, IAsynchronousOperationListenerProvider listenerProvider, CancellationToken shutdownToken) : base(listenerProvider.GetListener(FeatureAttribute.SolutionChecksumUpdater), workspace.Services.GetService <IGlobalOperationNotificationService>(), workspace.Options.GetOption(RemoteHostOptions.SolutionChecksumMonitorBackOffTimeSpanInMS), shutdownToken) { _workspace = workspace; _textChangeQueue = new TaskQueue(Listener, TaskScheduler.Default); _event = new SemaphoreSlim(initialCount: 0); _gate = new object(); // start listening workspace change event _workspace.WorkspaceChanged += OnWorkspaceChanged; // create its own cancellation token source _globalOperationCancellationSource = CancellationTokenSource.CreateLinkedTokenSource(shutdownToken); Start(); }
public AsyncCompletionService( IThreadingContext threadingContext, IEditorOperationsFactoryService editorOperationsFactoryService, ITextUndoHistoryRegistry undoHistoryRegistry, IInlineRenameService inlineRenameService, IAsynchronousOperationListenerProvider listenerProvider, [ImportMany] IEnumerable <Lazy <IIntelliSensePresenter <ICompletionPresenterSession, ICompletionSession>, OrderableMetadata> > completionPresenters, [ImportMany] IEnumerable <Lazy <IBraceCompletionSessionProvider, BraceCompletionMetadata> > autoBraceCompletionChars) : base(threadingContext) { _editorOperationsFactoryService = editorOperationsFactoryService; _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> >(); }
public VisualStudioDiagnosticListTableCommandHandler( IThreadingContext threadingContext, SVsServiceProvider serviceProvider, VisualStudioWorkspace workspace, IVisualStudioSuppressionFixService suppressionFixService, VisualStudioDiagnosticListSuppressionStateService suppressionStateService, IUIThreadOperationExecutor uiThreadOperationExecutor, IDiagnosticAnalyzerService diagnosticService, ICodeActionEditHandlerService editHandlerService, IAsynchronousOperationListenerProvider listenerProvider) { _threadingContext = threadingContext; _workspace = workspace; _suppressionFixService = (VisualStudioSuppressionFixService)suppressionFixService; _suppressionStateService = suppressionStateService; _uiThreadOperationExecutor = uiThreadOperationExecutor; _diagnosticService = diagnosticService; _editHandlerService = editHandlerService; _listener = listenerProvider.GetListener(FeatureAttribute.ErrorList); }
public AbstractInProcLanguageClient( AbstractRequestDispatcherFactory requestDispatcherFactory, VisualStudioWorkspace workspace, IDiagnosticService?diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, VSShell.IAsyncServiceProvider asyncServiceProvider, IThreadingContext threadingContext, string?diagnosticsClientName ) { _requestDispatcherFactory = requestDispatcherFactory; Workspace = workspace; _diagnosticService = diagnosticService; _listenerProvider = listenerProvider; _lspWorkspaceRegistrationService = lspWorkspaceRegistrationService; _diagnosticsClientName = diagnosticsClientName; _asyncServiceProvider = asyncServiceProvider; _threadingContext = threadingContext; }
internal LanguageServerTarget( AbstractRequestDispatcherFactory requestDispatcherFactory, JsonRpc jsonRpc, ICapabilitiesProvider capabilitiesProvider, LspWorkspaceRegistrationService workspaceRegistrationService, LspMiscellaneousFilesWorkspace?lspMiscellaneousFilesWorkspace, IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, ImmutableArray <string> supportedLanguages, string?clientName, string userVisibleServerName, string telemetryServerTypeName) { GlobalOptions = globalOptions; RequestDispatcher = requestDispatcherFactory.CreateRequestDispatcher(supportedLanguages); _capabilitiesProvider = capabilitiesProvider; WorkspaceRegistrationService = workspaceRegistrationService; Logger = logger; JsonRpc = jsonRpc; JsonRpc.AddLocalRpcTarget(this); JsonRpc.Disconnected += JsonRpc_Disconnected; Listener = listenerProvider.GetListener(FeatureAttribute.LanguageServer); ClientName = clientName; _userVisibleServerName = userVisibleServerName; TelemetryServerName = telemetryServerTypeName; Queue = new RequestExecutionQueue( logger, workspaceRegistrationService, lspMiscellaneousFilesWorkspace, globalOptions, supportedLanguages, userVisibleServerName, TelemetryServerName); Queue.RequestServerShutdown += RequestExecutionQueue_Errored; }
private InProcLanguageServer( AbstractInProcLanguageClient languageClient, RequestDispatcher requestDispatcher, Workspace workspace, IDiagnosticService?diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, string serverTypeName, string?clientName, JsonRpc jsonRpc, LogHubLspLogger?logger) { _languageClient = languageClient; _requestDispatcher = requestDispatcher; _workspace = workspace; _logger = logger; _jsonRpc = jsonRpc; _jsonRpc.AddLocalRpcTarget(this); _jsonRpc.StartListening(); _diagnosticService = diagnosticService; _listener = listenerProvider.GetListener(FeatureAttribute.LanguageServer); _clientName = clientName; _queue = new RequestExecutionQueue(logger ?? NoOpLspLogger.Instance, lspWorkspaceRegistrationService, languageClient.Name, serverTypeName); _queue.RequestServerShutdown += RequestExecutionQueue_Errored; // Dedupe on DocumentId. If we hear about the same document multiple times, we only need to process that id once. _diagnosticsWorkQueue = new AsyncBatchingWorkQueue <DocumentId>( TimeSpan.FromMilliseconds(250), ProcessDiagnosticUpdatedBatchAsync, EqualityComparer <DocumentId> .Default, _listener, _queue.CancellationToken); if (_diagnosticService != null) { _diagnosticService.DiagnosticsUpdated += DiagnosticService_DiagnosticsUpdated; } }
public DiagnosticTaggerWrapper( TestWorkspace workspace, IReadOnlyDictionary <string, ImmutableArray <DiagnosticAnalyzer> >?analyzerMap = null, IDiagnosticUpdateSource?updateSource = null, bool createTaggerProvider = true) { _threadingContext = workspace.GetService <IThreadingContext>(); _listenerProvider = workspace.GetService <IAsynchronousOperationListenerProvider>(); var analyzerReference = new TestAnalyzerReferenceByLanguage(analyzerMap ?? DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap()); workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences(new[] { analyzerReference })); // Change the background analysis scope to OpenFiles instead of ActiveFile (default), // so that every diagnostic tagger test does not need to mark test files as "active" file. workspace.GlobalOptions.SetGlobalOption(new OptionKey(SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, LanguageNames.CSharp), BackgroundAnalysisScope.OpenFiles); workspace.GlobalOptions.SetGlobalOption(new OptionKey(SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, LanguageNames.VisualBasic), BackgroundAnalysisScope.OpenFiles); _workspace = workspace; _registrationService = (SolutionCrawlerRegistrationService)workspace.Services.GetRequiredService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(workspace); if (!_registrationService.GetTestAccessor().TryGetWorkCoordinator(workspace, out var coordinator)) { throw new InvalidOperationException(); } AnalyzerService = (DiagnosticAnalyzerService?)_registrationService.GetTestAccessor().AnalyzerProviders.SelectMany(pair => pair.Value).SingleOrDefault(lazyProvider => lazyProvider.Metadata.Name == WellKnownSolutionCrawlerAnalyzers.Diagnostic && lazyProvider.Metadata.HighPriorityForActiveFile)?.Value; DiagnosticService = (DiagnosticService)workspace.ExportProvider.GetExportedValue <IDiagnosticService>(); if (updateSource is object) { DiagnosticService.Register(updateSource); } if (createTaggerProvider) { _ = TaggerProvider; } }
public InheritanceMarginViewMarginProvider( IThreadingContext threadingContext, IStreamingFindUsagesPresenter streamingFindUsagesPresenter, ClassificationTypeMap classificationTypeMap, IClassificationFormatMapService classificationFormatMapService, IUIThreadOperationExecutor operationExecutor, IViewTagAggregatorFactoryService tagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider) { _threadingContext = threadingContext; _streamingFindUsagesPresenter = streamingFindUsagesPresenter; _classificationTypeMap = classificationTypeMap; _classificationFormatMapService = classificationFormatMapService; _operationExecutor = operationExecutor; _tagAggregatorFactoryService = tagAggregatorFactoryService; _editorFormatMapService = editorFormatMapService; _globalOptions = globalOptions; _listenerProvider = listenerProvider; }
public AbstractSnippetInfoService( IThreadingContext threadingContext, Shell.SVsServiceProvider serviceProvider, Guid languageGuidForSnippets, IAsynchronousOperationListenerProvider listenerProvider) : base(threadingContext) { AssertIsForeground(); if (serviceProvider != null) { var textManager = (IVsTextManager2)serviceProvider.GetService(typeof(SVsTextManager)); if (textManager.GetExpansionManager(out _expansionManager) == VSConstants.S_OK) { ComEventSink.Advise <IVsExpansionEvents>(_expansionManager, this); _waiter = listenerProvider.GetListener(FeatureAttribute.Snippets); _languageGuidForSnippets = languageGuidForSnippets; PopulateSnippetCaches(); } } }
public ValueTrackingCommandHandler( SVsServiceProvider serviceProvider, IThreadingContext threadingContext, ClassificationTypeMap typeMap, IClassificationFormatMapService classificationFormatMapService, IGlyphService glyphService, IEditorFormatMapService formatMapService, IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider listenerProvider, IUIThreadOperationExecutor threadOperationExecutor) { _serviceProvider = (IAsyncServiceProvider)serviceProvider; _threadingContext = threadingContext; _typeMap = typeMap; _classificationFormatMapService = classificationFormatMapService; _glyphService = glyphService; _formatMapService = formatMapService; _globalOptions = globalOptions; _threadOperationExecutor = threadOperationExecutor; _listener = listenerProvider.GetListener(FeatureAttribute.ValueTracking); }
public DiagnosticsClassificationTaggerProvider( IThreadingContext threadingContext, IDiagnosticService diagnosticService, ClassificationTypeMap typeMap, IForegroundNotificationService notificationService, IEditorOptionsFactoryService editorOptionsFactoryService, IAsynchronousOperationListenerProvider listenerProvider ) : base( threadingContext, diagnosticService, notificationService, listenerProvider.GetListener(FeatureAttribute.Classification) ) { _typeMap = typeMap; _classificationTag = new ClassificationTag( _typeMap.GetClassificationType(ClassificationTypeDefinitions.UnnecessaryCode) ); _editorOptionsFactoryService = editorOptionsFactoryService; }
public InlineHintsTaggerProvider( IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IClassificationFormatMapService classificationFormatMapService, IClassificationTypeRegistryService classificationTypeRegistryService, IThreadingContext threadingContext, IUIThreadOperationExecutor operationExecutor, IAsynchronousOperationListenerProvider listenerProvider, IToolTipService toolTipService, ClassificationTypeMap typeMap, Lazy <IStreamingFindUsagesPresenter> streamingFindUsagesPresenter) { _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService; this.ClassificationFormatMapService = classificationFormatMapService; this.ClassificationTypeRegistryService = classificationTypeRegistryService; this.ThreadingContext = threadingContext; this.OperationExecutor = operationExecutor; this.ToolTipService = toolTipService; this.StreamingFindUsagesPresenter = streamingFindUsagesPresenter; this.TypeMap = typeMap; this.AsynchronousOperationListener = listenerProvider.GetListener(FeatureAttribute.InlineHints); }
public InProcLanguageServer(Stream inputStream, Stream outputStream, AbstractRequestHandlerProvider requestHandlerProvider, Workspace workspace, IDiagnosticService diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspSolutionProvider solutionProvider, string?clientName) { _requestHandlerProvider = requestHandlerProvider; _workspace = workspace; var jsonMessageFormatter = new JsonMessageFormatter(); jsonMessageFormatter.JsonSerializer.Converters.Add(new VSExtensionConverter <TextDocumentIdentifier, VSTextDocumentIdentifier>()); jsonMessageFormatter.JsonSerializer.Converters.Add(new VSExtensionConverter <ClientCapabilities, VSClientCapabilities>()); _jsonRpc = new JsonRpc(new HeaderDelimitedMessageHandler(outputStream, inputStream, jsonMessageFormatter)); _jsonRpc.AddLocalRpcTarget(this); _jsonRpc.StartListening(); _diagnosticService = diagnosticService; _listener = listenerProvider.GetListener(FeatureAttribute.LanguageServer); _clientName = clientName; _clientCapabilities = new VSClientCapabilities(); _queue = new RequestExecutionQueue(solutionProvider); _queue.RequestServerShutdown += RequestExecutionQueue_Errored; // Dedupe on DocumentId. If we hear about the same document multiple times, we only need to process that id once. _diagnosticsWorkQueue = new AsyncBatchingWorkQueue <DocumentId>( TimeSpan.FromMilliseconds(250), ProcessDiagnosticUpdatedBatchAsync, EqualityComparer <DocumentId> .Default, _listener, _queue.CancellationToken); _diagnosticService.DiagnosticsUpdated += DiagnosticService_DiagnosticsUpdated; }
public SuggestedActionsSourceProvider( IThreadingContext threadingContext, ICodeRefactoringService codeRefactoringService, ICodeFixService codeFixService, ICodeActionEditHandlerService editHandler, IUIThreadOperationExecutor uiThreadOperationExecutor, ISuggestedActionCategoryRegistryService suggestedActionCategoryRegistry, IAsynchronousOperationListenerProvider listenerProvider, IGlobalOptionService globalOptions, [ImportMany] IEnumerable <Lazy <IImageIdService, OrderableMetadata> > imageIdServices) { _threadingContext = threadingContext; _codeRefactoringService = codeRefactoringService; _codeFixService = codeFixService; _suggestedActionCategoryRegistry = suggestedActionCategoryRegistry; _globalOptions = globalOptions; EditHandler = editHandler; UIThreadOperationExecutor = uiThreadOperationExecutor; OperationListener = listenerProvider.GetListener(FeatureAttribute.LightBulb); ImageIdServices = ExtensionOrderer.Order(imageIdServices).ToImmutableArray(); }
public SuggestedActionsSourceProvider( ICodeRefactoringService codeRefactoringService, IDiagnosticAnalyzerService diagnosticService, ICodeFixService codeFixService, ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator, ISuggestedActionCategoryRegistryService suggestedActionCategoryRegistry, IAsynchronousOperationListenerProvider listenerProvider, [ImportMany] IEnumerable <Lazy <IImageMonikerService, OrderableMetadata> > imageMonikerServices, [ImportMany] IEnumerable <Lazy <ISuggestedActionCallback> > actionCallbacks) { _codeRefactoringService = codeRefactoringService; _diagnosticService = diagnosticService; _codeFixService = codeFixService; _suggestedActionCategoryRegistry = suggestedActionCategoryRegistry; ActionCallbacks = actionCallbacks.ToImmutableArray(); EditHandler = editHandler; WaitIndicator = waitIndicator; OperationListener = listenerProvider.GetListener(FeatureAttribute.LightBulb); ImageMonikerServices = ExtensionOrderer.Order(imageMonikerServices).ToImmutableArray(); }
public VisualStudioDiagnosticListTableCommandHandler( SVsServiceProvider serviceProvider, VisualStudioWorkspace workspace, IVisualStudioSuppressionFixService suppressionFixService, IVisualStudioDiagnosticListSuppressionStateService suppressionStateService, IUIThreadOperationExecutor uiThreadOperationExecutor, IDiagnosticAnalyzerService diagnosticService, ICodeActionEditHandlerService editHandlerService, IAsynchronousOperationListenerProvider listenerProvider) { _workspace = workspace; _suppressionFixService = (VisualStudioSuppressionFixService)suppressionFixService; _suppressionStateService = (VisualStudioDiagnosticListSuppressionStateService)suppressionStateService; _uiThreadOperationExecutor = uiThreadOperationExecutor; _diagnosticService = diagnosticService; _editHandlerService = editHandlerService; var errorList = serviceProvider.GetService(typeof(SVsErrorList)) as IErrorList; _tableControl = errorList?.TableControl; _listener = listenerProvider.GetListener(FeatureAttribute.ErrorList); }
public XamlInProcLanguageClient( XamlRequestDispatcherFactory xamlDispatcherFactory, VisualStudioWorkspace workspace, IDiagnosticService diagnosticService, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, [Import(typeof(SAsyncServiceProvider))] VSShell.IAsyncServiceProvider asyncServiceProvider, IThreadingContext threadingContext ) : base( xamlDispatcherFactory, workspace, diagnosticService, listenerProvider, lspWorkspaceRegistrationService, asyncServiceProvider, threadingContext, diagnosticsClientName: null ) { }
public SolutionCrawlerRegistrationService( [ImportMany] IEnumerable < Lazy <IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata> > analyzerProviders, IAsynchronousOperationListenerProvider listenerProvider ) { _gate = new object(); _analyzerProviders = analyzerProviders .GroupBy(kv => kv.Metadata.Name) .ToImmutableDictionary(g => g.Key, g => g.ToImmutableArray()); AssertAnalyzerProviders(_analyzerProviders); _documentWorkCoordinatorMap = new Dictionary <Workspace, WorkCoordinator>( ReferenceEqualityComparer.Instance ); _listener = listenerProvider.GetListener(FeatureAttribute.SolutionCrawler); _progressReporter = new SolutionCrawlerProgressReporter(); }
private DiagnosticTaggerWrapper( TestWorkspace workspace, Dictionary <string, DiagnosticAnalyzer[]> analyzerMap, IDiagnosticUpdateSource updateSource, bool createTaggerProvider) { _threadingContext = workspace.GetService <IThreadingContext>(); _listenerProvider = workspace.GetService <IAsynchronousOperationListenerProvider>(); if (analyzerMap != null || updateSource == null) { AnalyzerService = CreateDiagnosticAnalyzerService(analyzerMap, _listenerProvider.GetListener(FeatureAttribute.DiagnosticService)); } if (updateSource == null) { updateSource = AnalyzerService; } _workspace = workspace; _registrationService = workspace.Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(workspace); DiagnosticService = new DiagnosticService(_listenerProvider); DiagnosticService.Register(updateSource); if (createTaggerProvider) { var taggerProvider = this.TaggerProvider; } if (AnalyzerService != null) { _incrementalAnalyzers = ImmutableArray.Create(AnalyzerService.CreateIncrementalAnalyzer(workspace)); _solutionCrawlerService = workspace.Services.GetService <ISolutionCrawlerRegistrationService>() as SolutionCrawlerRegistrationService; } }
public AlwaysActivateInProcLanguageClient( CSharpVisualBasicRequestDispatcherFactory csharpVBRequestDispatcherFactory, VisualStudioWorkspace workspace, IAsynchronousOperationListenerProvider listenerProvider, ILspWorkspaceRegistrationService lspWorkspaceRegistrationService, DefaultCapabilitiesProvider defaultCapabilitiesProvider, [Import(typeof(SAsyncServiceProvider))] VSShell.IAsyncServiceProvider asyncServiceProvider, IThreadingContext threadingContext ) : base( csharpVBRequestDispatcherFactory, workspace, diagnosticService: null, listenerProvider, lspWorkspaceRegistrationService, asyncServiceProvider, threadingContext, diagnosticsClientName: null ) { _defaultCapabilitiesProvider = defaultCapabilitiesProvider; }
public FileChangeWatcherProvider( IThreadingContext threadingContext, IAsynchronousOperationListenerProvider listenerProvider, [Import(typeof(SVsServiceProvider))] Shell.IAsyncServiceProvider serviceProvider) { var fileChangeService = Task.Factory.StartNew( async() => { await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(threadingContext.DisposalToken); var fileChangeService = (IVsAsyncFileChangeEx?)await serviceProvider.GetServiceAsync(typeof(SVsFileChangeEx)).ConfigureAwait(true); Assumes.Present(fileChangeService); return(fileChangeService); }, threadingContext.DisposalToken, TaskCreationOptions.RunContinuationsAsynchronously, TaskScheduler.Default) .Unwrap(); // We do not want background work to implicitly block on the availability of the SVsFileChangeEx to avoid any deadlock risk, // since the first fetch for a file watcher might end up happening on the background. Watcher = new FileChangeWatcher(listenerProvider, fileChangeService); }
public DiagnosticTaggerWrapper( TestWorkspace workspace, IReadOnlyDictionary <string, ImmutableArray <DiagnosticAnalyzer> >?analyzerMap = null, IDiagnosticUpdateSource?updateSource = null, bool createTaggerProvider = true) { _threadingContext = workspace.GetService <IThreadingContext>(); _listenerProvider = workspace.GetService <IAsynchronousOperationListenerProvider>(); if (updateSource == null) { updateSource = AnalyzerService = new MyDiagnosticAnalyzerService(_listenerProvider.GetListener(FeatureAttribute.DiagnosticService)); } var analyzerReference = new TestAnalyzerReferenceByLanguage(analyzerMap ?? DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap()); workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences(new[] { analyzerReference })); _workspace = workspace; _registrationService = workspace.Services.GetRequiredService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(workspace); DiagnosticService = new DiagnosticService(_listenerProvider, Array.Empty <Lazy <IEventListener, EventListenerMetadata> >()); DiagnosticService.Register(updateSource); if (createTaggerProvider) { _ = TaggerProvider; } if (AnalyzerService != null) { _incrementalAnalyzers = ImmutableArray.Create(AnalyzerService.CreateIncrementalAnalyzer(workspace)); _solutionCrawlerService = workspace.Services.GetService <ISolutionCrawlerRegistrationService>() as SolutionCrawlerRegistrationService; } }
public VisualStudioTodoCommentsService( IThreadingContext threadingContext, VisualStudioWorkspaceImpl workspace, IGlobalOptionService globalOptions, IAsynchronousOperationListenerProvider asynchronousOperationListenerProvider, [ImportMany] IEnumerable <Lazy <IEventListener, EventListenerMetadata> > eventListeners) { _threadingContext = threadingContext; _workspace = workspace; _eventListenerTracker = new EventListenerTracker <ITodoListProvider>(eventListeners, WellKnownEventListeners.TodoListProvider); _listener = new TodoCommentsListener( globalOptions, workspace.Services, asynchronousOperationListenerProvider, onTodoCommentsUpdated: (documentId, oldComments, newComments) => { if (TodoListUpdated != null && !oldComments.SequenceEqual(newComments)) { TodoListUpdated?.Invoke(this, new TodoItemsUpdatedArgs(documentId, _workspace.CurrentSolution, documentId, newComments)); } }, threadingContext.DisposalToken); }
public DiagnosticTaggerWrapper( TestWorkspace workspace, IReadOnlyDictionary <string, ImmutableArray <DiagnosticAnalyzer> >?analyzerMap = null, IDiagnosticUpdateSource?updateSource = null, bool createTaggerProvider = true) { _threadingContext = workspace.GetService <IThreadingContext>(); _listenerProvider = workspace.GetService <IAsynchronousOperationListenerProvider>(); var analyzerReference = new TestAnalyzerReferenceByLanguage(analyzerMap ?? DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap()); workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences(new[] { analyzerReference })); _workspace = workspace; _registrationService = (SolutionCrawlerRegistrationService)workspace.Services.GetRequiredService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(workspace); if (!_registrationService.GetTestAccessor().TryGetWorkCoordinator(workspace, out var coordinator)) { throw new InvalidOperationException(); } AnalyzerService = (DiagnosticAnalyzerService?)_registrationService.GetTestAccessor().AnalyzerProviders.SelectMany(pair => pair.Value).SingleOrDefault(lazyProvider => lazyProvider.Metadata.Name == WellKnownSolutionCrawlerAnalyzers.Diagnostic && lazyProvider.Metadata.HighPriorityForActiveFile)?.Value; DiagnosticService = (DiagnosticService)workspace.ExportProvider.GetExportedValue <IDiagnosticService>(); if (updateSource is object) { DiagnosticService.Register(updateSource); } if (createTaggerProvider) { _ = TaggerProvider; } }
public MonoDevelopInfoBarService(IForegroundNotificationService foregroundNotificationService, IAsynchronousOperationListenerProvider listenerProvider) { _foregroundNotificationService = foregroundNotificationService; _listener = listenerProvider.GetListener(FeatureAttribute.InfoBar); }
public PreviewSolutionCrawlerRegistrationServiceFactory(IDiagnosticAnalyzerService analyzerService, IAsynchronousOperationListenerProvider listenerProvider) { // this service is directly tied to DiagnosticAnalyzerService and // depends on its implementation. _analyzerService = analyzerService as DiagnosticAnalyzerService; Contract.ThrowIfNull(_analyzerService); _listener = listenerProvider.GetListener(FeatureAttribute.DiagnosticService); }
public ReferenceHighlightingViewTaggerProvider( IThreadingContext threadingContext, IAsynchronousOperationListenerProvider listenerProvider) : base(threadingContext, listenerProvider.GetListener(FeatureAttribute.ReferenceHighlighting)) { }