private DiagnosticTaggerWrapper(TestWorkspace workspace, DiagnosticAnalyzerService analyzerService, IDiagnosticUpdateSource updateSource) { if (updateSource == null) { updateSource = analyzerService; } this.workspace = workspace; this.registrationService = workspace.Services.GetService<ISolutionCrawlerRegistrationService>(); registrationService.Register(workspace); this.asyncListener = new AsynchronousOperationListener(); var listeners = AsynchronousOperationListener.CreateListeners( ValueTuple.Create(FeatureAttribute.DiagnosticService, asyncListener), ValueTuple.Create(FeatureAttribute.ErrorSquiggles, asyncListener)); this.analyzerService = analyzerService; var diagnosticService = new DiagnosticService(SpecializedCollections.SingletonEnumerable(updateSource), listeners); this.TaggerProvider = new DiagnosticsSquiggleTaggerProvider( workspace.Services.GetService<IOptionService>(), diagnosticService, workspace.GetService<IForegroundNotificationService>(), listeners); if (analyzerService != null) { this.incrementalAnalyzers = ImmutableArray.Create(analyzerService.CreateIncrementalAnalyzer(workspace)); this.solutionCrawlerService = workspace.Services.GetService<ISolutionCrawlerRegistrationService>() as SolutionCrawlerRegistrationService; } }
internal InteractiveWorkspace(HostServices hostServices) : base(hostServices, WorkspaceKind.Interactive) { // register work coordinator for this workspace _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>(); _registrationService.Register(this); }
public void EnableDiagnostic() { _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>(); if (_registrationService != null) { _registrationService.Register(this); } }
internal InteractiveWorkspace(HostServices hostServices) : base(hostServices, WorkspaceKind.Interactive) { // register work coordinator for this workspace _registrationService = Services.GetRequiredService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(this); }
public void EnableDiagnostic() { _registrationService = this.Services.GetService <ISolutionCrawlerRegistrationService>(); if (_registrationService != null) { _registrationService.Register(this); } }
internal InteractiveWorkspace(InteractiveEvaluator engine, HostServices hostServices) : base(hostServices, "Interactive") { this.Engine = engine; // register work coordinator for this workspace _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>(); _registrationService.Register(this); }
internal InteractiveWorkspace(InteractiveEvaluator engine, HostServices hostServices) : base(hostServices, "Interactive") { this.Engine = engine; // register work coordinator for this workspace _registrationService = this.Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(this); }
public RemoteWorkspace() : base(RoslynServices.HostServices, workspaceKind: WorkspaceKind.RemoteWorkspace) { PrimaryWorkspace.Register(this); Options = Options.WithChangedOption(CacheOptions.RecoverableTreeLengthThreshold, 0); _registrationService = Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService?.Register(this); }
// internal for testing purposes. internal RemoteWorkspace(HostServices hostServices, string?workspaceKind) : base(hostServices, workspaceKind) { var exportProvider = (IMefHostExportProvider)Services.HostServices; RegisterDocumentOptionProviders(exportProvider.GetExports <IDocumentOptionsProviderFactory, OrderableMetadata>()); SetOptions(Options.WithChangedOption(CacheOptions.RecoverableTreeLengthThreshold, 0)); _registrationService = Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService?.Register(this); }
internal InteractiveWorkspace(InteractiveEvaluator engine, HostServices hostServices) : base(hostServices, "Interactive") { this.Engine = engine; // register work coordinator for this workspace _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>(); _registrationService.Register(this); // TODO (https://github.com/dotnet/roslyn/issues/5107): Enable in Interactive. this.Options = this.Options.WithChangedOption(InternalFeatureOnOffOptions.Snippets, false); }
internal InteractiveWorkspace(InteractiveEvaluator engine, HostServices hostServices) : base(hostServices, "Interactive") { this.Engine = engine; // register work coordinator for this workspace _registrationService = this.Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(this); // TODO (https://github.com/dotnet/roslyn/issues/5107): Enable in Interactive. this.Options = this.Options.WithChangedOption(InternalFeatureOnOffOptions.Snippets, false); }
public RemoteWorkspace() : base(RoslynServices.HostServices, workspaceKind: WorkspaceKind.RemoteWorkspace) { var exportProvider = (IMefHostExportProvider)Services.HostServices; var primaryWorkspace = exportProvider.GetExports <PrimaryWorkspace>().Single().Value; primaryWorkspace.Register(this); Options = Options.WithChangedOption(CacheOptions.RecoverableTreeLengthThreshold, 0); _registrationService = Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService?.Register(this); }
internal void StartSolutionCrawler() { if (_registrationService == null) { lock (this) { if (_registrationService == null) { _registrationService = this.Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(this); } } } }
internal void StartSolutionCrawler() { if (_registrationService == null) { lock (this) { if (_registrationService == null) { _registrationService = this.Services.GetService<ISolutionCrawlerRegistrationService>(); _registrationService.Register(this); } } } }
// internal for testing purposes. internal RemoteWorkspace(bool applyStartupOptions) : base(RoslynServices.HostServices, workspaceKind : WorkspaceKind.RemoteWorkspace) { var exportProvider = (IMefHostExportProvider)Services.HostServices; var primaryWorkspace = exportProvider.GetExports <PrimaryWorkspace>().Single().Value; primaryWorkspace.Register(this); RegisterDocumentOptionProviders(exportProvider.GetExports <IDocumentOptionsProviderFactory, OrderableMetadata>()); if (applyStartupOptions) { SetOptions(Options.WithChangedOption(CacheOptions.RecoverableTreeLengthThreshold, 0)); } _registrationService = Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService?.Register(this); }
public RemoteWorkspace() : base(RoslynServices.HostServices, workspaceKind: WorkspaceKind.RemoteWorkspace) { var exportProvider = (IMefHostExportProvider)Services.HostServices; var primaryWorkspace = exportProvider.GetExports <PrimaryWorkspace>().Single().Value; primaryWorkspace.Register(this); foreach (var providerFactory in exportProvider.GetExports <IDocumentOptionsProviderFactory>()) { Services.GetRequiredService <IOptionService>().RegisterDocumentOptionsProvider(providerFactory.Value.Create(this)); } Options = Options.WithChangedOption(CacheOptions.RecoverableTreeLengthThreshold, 0); _registrationService = Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService?.Register(this); }
private DiagnosticTaggerWrapper( TestWorkspace workspace, Dictionary <string, DiagnosticAnalyzer[]> analyzerMap, IDiagnosticUpdateSource updateSource, bool createTaggerProvider) { _asyncListener = new AsynchronousOperationListener(); _listeners = AsynchronousOperationListener.CreateListeners( ValueTuple.Create(FeatureAttribute.DiagnosticService, _asyncListener), ValueTuple.Create(FeatureAttribute.ErrorSquiggles, _asyncListener)); if (analyzerMap != null || updateSource == null) { AnalyzerService = CreateDiagnosticAnalyzerService(analyzerMap, _asyncListener); } if (updateSource == null) { updateSource = AnalyzerService; } _workspace = workspace; _registrationService = workspace.Services.GetService <ISolutionCrawlerRegistrationService>(); _registrationService.Register(workspace); DiagnosticService = new DiagnosticService(_listeners); 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; } }
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, Array.Empty <Lazy <IEventListener, EventListenerMetadata> >()); 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 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; } }
private DiagnosticTaggerWrapper( TestWorkspace workspace, DiagnosticAnalyzerService analyzerService, IDiagnosticUpdateSource updateSource, bool createTaggerProvider) { if (updateSource == null) { updateSource = analyzerService; } _workspace = workspace; _registrationService = workspace.Services.GetService<ISolutionCrawlerRegistrationService>(); _registrationService.Register(workspace); _asyncListener = new AsynchronousOperationListener(); _listeners = AsynchronousOperationListener.CreateListeners( ValueTuple.Create(FeatureAttribute.DiagnosticService, _asyncListener), ValueTuple.Create(FeatureAttribute.ErrorSquiggles, _asyncListener)); _analyzerService = analyzerService; _diagnosticService = new DiagnosticService(_listeners); _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; } }
private DiagnosticTaggerWrapper( TestWorkspace workspace, DiagnosticAnalyzerService analyzerService, IDiagnosticUpdateSource updateSource, bool createTaggerProvider) { if (updateSource == null) { updateSource = analyzerService; } this.workspace = workspace; this.registrationService = workspace.Services.GetService <ISolutionCrawlerRegistrationService>(); registrationService.Register(workspace); this.asyncListener = new AsynchronousOperationListener(); this.listeners = AsynchronousOperationListener.CreateListeners( ValueTuple.Create(FeatureAttribute.DiagnosticService, asyncListener), ValueTuple.Create(FeatureAttribute.ErrorSquiggles, asyncListener)); this.analyzerService = analyzerService; this.diagnosticService = new DiagnosticService(listeners); diagnosticService.Register(updateSource); if (createTaggerProvider) { var taggerProvider = this.TaggerProvider; } if (analyzerService != null) { this.incrementalAnalyzers = ImmutableArray.Create(analyzerService.CreateIncrementalAnalyzer(workspace)); this.solutionCrawlerService = workspace.Services.GetService <ISolutionCrawlerRegistrationService>() as SolutionCrawlerRegistrationService; } }
public void Register(Workspace workspace) => _registrationService.Register(workspace);