internal TestDiagnosticAnalyzerService(
     AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource,
     PrimaryWorkspace primaryWorkspace)
     : base(new Lazy <ImmutableArray <HostDiagnosticAnalyzerPackage> >(() => ImmutableArray <HostDiagnosticAnalyzerPackage> .Empty),
            hostAnalyzerAssemblyLoader : null, hostDiagnosticUpdateSource, primaryWorkspace, new MockDiagnosticUpdateSourceRegistrationService())
 {
 }
Esempio n. 2
0
 public VisualStudioWorkspaceImpl(ExportProvider exportProvider)
     : base(
         MefV1HostServices.Create(exportProvider),
         backgroundWork: WorkspaceBackgroundWork.ParseAndCompile)
 {
     PrimaryWorkspace.Register(this);
 }
Esempio n. 3
0
        public RemoteWorkspace()
            : base(RoslynServices.HostServices, workspaceKind: RemoteWorkspace.WorkspaceKind_RemoteWorkspace)
        {
            PrimaryWorkspace.Register(this);

            Options = Options.WithChangedOption(CacheOptions.RecoverableTreeLengthThreshold, 0);
        }
Esempio n. 4
0
        public VisualStudioWorkspace(
            SVsServiceProvider serviceProvider,
            ITextDocumentFactoryService textDocumentFactoryService)
            : base(MefV1HostServices.Create(GetExportProvider(serviceProvider)))
        {
            PrimaryWorkspace.Register(this);

            _serviceProvider            = serviceProvider;
            _textDocumentFactoryService = textDocumentFactoryService;

            _backgroundParser = new BackgroundParser(this);
            _backgroundParser.Start();

            _textBufferToTextDocumentMap = new ConditionalWeakTable <ITextBuffer, ITextDocument>();
            _documentIdToTextBufferMap   = new ConditionalWeakTable <DocumentId, ITextBuffer>();
            _textBufferToDocumentIdMap   = new ConditionalWeakTable <ITextBuffer, DocumentId>();
            _textBufferToViewsMap        = new ConditionalWeakTable <ITextBuffer, List <ITextView> >();
            _textViewToBuffersMap        = new ConditionalWeakTable <ITextView, List <ITextBuffer> >();

            Services.GetService <IDocumentTrackingService>();

            if (Services.GetService <IOptionService>() is OptionServiceFactory.OptionService optionService)
            {
                optionService.RegisterDocumentOptionsProvider(new Implementation.Options.EditorconfigDocumentOptionsProvider());
            }
        }
 internal TestDiagnosticAnalyzerService(
     AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource,
     PrimaryWorkspace primaryWorkspace,
     Action <Exception, DiagnosticAnalyzer, Diagnostic> onAnalyzerException = null)
     : base(SpecializedCollections.EmptyEnumerable <HostDiagnosticAnalyzerPackage>(), null, hostDiagnosticUpdateSource, primaryWorkspace, new MockDiagnosticUpdateSourceRegistrationService())
 {
     _onAnalyzerException = onAnalyzerException;
 }
        public NavigateToItemProviderFactory(IAsynchronousOperationListenerProvider listenerProvider, PrimaryWorkspace primaryWorkspace)
        {
            if (listenerProvider == null)
            {
                throw new ArgumentNullException(nameof(listenerProvider));
            }

            _asyncListener    = listenerProvider.GetListener(FeatureAttribute.NavigateTo);
            _primaryWorkspace = primaryWorkspace;
        }
Esempio n. 7
0
        public RemoteWorkspace()
            : base(RoslynServices.HostServices, workspaceKind: WorkspaceKind.RemoteWorkspace)
        {
            PrimaryWorkspace.Register(this);

            Options = Options.WithChangedOption(CacheOptions.RecoverableTreeLengthThreshold, 0);

            _registrationService = Services.GetService <ISolutionCrawlerRegistrationService>();
            _registrationService?.Register(this);
        }
Esempio n. 8
0
 // protected for testing purposes.
 protected DiagnosticAnalyzerService(
     Lazy <ImmutableArray <HostDiagnosticAnalyzerPackage> > workspaceAnalyzerPackages,
     IAnalyzerAssemblyLoader hostAnalyzerAssemblyLoader,
     AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource,
     PrimaryWorkspace primaryWorkspace,
     IDiagnosticUpdateSourceRegistrationService registrationService,
     IAsynchronousOperationListener listener = null)
     : this(new HostAnalyzerManager(workspaceAnalyzerPackages, hostAnalyzerAssemblyLoader, hostDiagnosticUpdateSource, primaryWorkspace), hostDiagnosticUpdateSource, registrationService, listener)
 {
 }
Esempio n. 9
0
 public DiagnosticAnalyzerService(
     IDiagnosticUpdateSourceRegistrationService registrationService,
     IAsynchronousOperationListenerProvider listenerProvider,
     PrimaryWorkspace primaryWorkspace,
     [Import(AllowDefault = true)] IHostDiagnosticAnalyzerPackageProvider?diagnosticAnalyzerProviderService = null,
     [Import(AllowDefault = true)] AbstractHostDiagnosticUpdateSource?hostDiagnosticUpdateSource            = null)
     : this(new Lazy <ImmutableArray <HostDiagnosticAnalyzerPackage> >(() => GetHostDiagnosticAnalyzerPackage(diagnosticAnalyzerProviderService), isThreadSafe : true),
            diagnosticAnalyzerProviderService?.GetAnalyzerAssemblyLoader(),
            hostDiagnosticUpdateSource,
            primaryWorkspace,
            registrationService, listenerProvider.GetListener(FeatureAttribute.DiagnosticService))
 {
     // diagnosticAnalyzerProviderService and hostDiagnosticUpdateSource can only be null in test harness. Otherwise, it should never be null.
 }
Esempio n. 10
0
 public DiagnosticAnalyzerService(
     IDiagnosticUpdateSourceRegistrationService registrationService,
     IAsynchronousOperationListenerProvider listenerProvider,
     PrimaryWorkspace primaryWorkspace,
     [Import(AllowDefault = true)] IWorkspaceDiagnosticAnalyzerProviderService diagnosticAnalyzerProviderService = null,
     [Import(AllowDefault = true)] AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource = null)
     : this(diagnosticAnalyzerProviderService != null ? diagnosticAnalyzerProviderService.GetHostDiagnosticAnalyzerPackages() : SpecializedCollections.EmptyEnumerable <HostDiagnosticAnalyzerPackage>(),
            diagnosticAnalyzerProviderService?.GetAnalyzerAssemblyLoader(),
            hostDiagnosticUpdateSource,
            primaryWorkspace,
            registrationService, listenerProvider.GetListener(FeatureAttribute.DiagnosticService))
 {
     // diagnosticAnalyzerProviderService and hostDiagnosticUpdateSource can only be null in test hardness otherwise, it should
     // never be null
 }
Esempio n. 11
0
        private RoslynVisualStudioWorkspace(
            SVsServiceProvider serviceProvider,
            SaveEventsService saveEventsService,
            [ImportMany] IEnumerable <Lazy <INavigableItemsPresenter> > navigableItemsPresenters,
            [ImportMany] IEnumerable <Lazy <IReferencedSymbolsPresenter> > referencedSymbolsPresenters)
            : base(
                serviceProvider,
                backgroundWork: WorkspaceBackgroundWork.ParseAndCompile)
        {
            PrimaryWorkspace.Register(this);

            InitializeStandardVisualStudioWorkspace(serviceProvider, saveEventsService);

            _navigableItemsPresenters    = navigableItemsPresenters;
            _referencedSymbolsPresenters = referencedSymbolsPresenters;
        }
Esempio n. 12
0
        public VisualStudioWorkspace(
            SVsServiceProvider serviceProvider,
            ITextDocumentFactoryService textDocumentFactoryService)
            : base(MefV1HostServices.Create(GetExportProvider(serviceProvider)))
        {
            PrimaryWorkspace.Register(this);

            _serviceProvider            = serviceProvider;
            _textDocumentFactoryService = textDocumentFactoryService;

            _backgroundParser = new BackgroundParser(this);
            _backgroundParser.Start();

            _textBufferToTextDocumentMap = new ConditionalWeakTable <ITextBuffer, ITextDocument>();
            _textBufferToDocumentIdMap   = new ConditionalWeakTable <ITextBuffer, DocumentId>();
            _textBufferToViewsMap        = new ConditionalWeakTable <ITextBuffer, List <ITextView> >();
            _textViewToBuffersMap        = new ConditionalWeakTable <ITextView, List <ITextBuffer> >();

            Services.GetService <IDocumentTrackingService>();
        }
        private RoslynVisualStudioWorkspace(
            SVsServiceProvider serviceProvider,
            SaveEventsService saveEventsService,
            [ImportMany] IEnumerable <Lazy <IStreamingFindUsagesPresenter> > streamingPresenters,
            [ImportMany] IEnumerable <Lazy <IDefinitionsAndReferencesPresenter> > referencedSymbolsPresenters,
            [ImportMany] IEnumerable <IDocumentOptionsProviderFactory> documentOptionsProviderFactories)
            : base(
                serviceProvider,
                backgroundWork: WorkspaceBackgroundWork.ParseAndCompile)
        {
            PrimaryWorkspace.Register(this);

            InitializeStandardVisualStudioWorkspace(serviceProvider, saveEventsService);

            _streamingPresenters         = streamingPresenters;
            _referencedSymbolsPresenters = referencedSymbolsPresenters;

            foreach (var providerFactory in documentOptionsProviderFactories)
            {
                Services.GetRequiredService <IOptionService>().RegisterDocumentOptionsProvider(providerFactory.Create(this));
            }
        }
Esempio n. 14
0
 public HostAnalyzerManager(Lazy <ImmutableArray <HostDiagnosticAnalyzerPackage> > hostAnalyzerPackages, IAnalyzerAssemblyLoader hostAnalyzerAssemblyLoader, AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource, PrimaryWorkspace primaryWorkspace)
     : this(new Lazy <ImmutableArray <AnalyzerReference> >(() => CreateAnalyzerReferencesFromPackages(hostAnalyzerPackages.Value, new HostAnalyzerReferenceDiagnosticReporter(hostDiagnosticUpdateSource, primaryWorkspace), hostAnalyzerAssemblyLoader), isThreadSafe : true),
            hostAnalyzerPackages, hostDiagnosticUpdateSource)
 {
 }
Esempio n. 15
0
 public HostAnalyzerReferenceDiagnosticReporter(AbstractHostDiagnosticUpdateSource hostUpdateSource, PrimaryWorkspace primaryWorkspace)
 {
     _hostUpdateSource = hostUpdateSource;
     _primaryWorkspace = primaryWorkspace;
 }
Esempio n. 16
0
 public HostAnalyzerManager(IEnumerable <HostDiagnosticAnalyzerPackage> hostAnalyzerPackages, IAnalyzerAssemblyLoader hostAnalyzerAssemblyLoader, AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateSource, PrimaryWorkspace primaryWorkspace) :
     this(CreateAnalyzerReferencesFromPackages(hostAnalyzerPackages, new HostAnalyzerReferenceDiagnosticReporter(hostDiagnosticUpdateSource, primaryWorkspace), hostAnalyzerAssemblyLoader),
          hostAnalyzerPackages.ToImmutableArrayOrEmpty(), hostDiagnosticUpdateSource)
 {
 }