Exemple #1
0
 public CSharpVsContainedLanguageComponentsFactory(
     IUnconfiguredProjectCommonServices commonServices,
     SVsServiceProvider serviceProvider,
     IUnconfiguredProjectVsServices projectServices,
     IProjectHostProvider projectHostProvider,
     ILanguageServiceHost languageServiceHost)
     : base(commonServices, serviceProvider, projectServices, projectHostProvider, languageServiceHost, CSharpLanguageServiceGuid)
 {
 }
 public VsContainedLanguageComponentsFactoryBase(SVsServiceProvider serviceProvider,
                                                 IUnconfiguredProjectVsServices projectServices,
                                                 IProjectHostProvider projectHostProvider,
                                                 Guid languageServiceGuid)
 {
     ServiceProvider     = serviceProvider;
     ProjectServices     = projectServices;
     LanguageServiceGuid = languageServiceGuid;
     ProjectHostProvider = projectHostProvider;
 }
Exemple #3
0
        public VsContainedLanguageComponentsFactory(IVsService <SAsyncServiceProvider, IOleAsyncServiceProvider> serviceProvider,
                                                    IUnconfiguredProjectVsServices projectVsServices,
                                                    IProjectHostProvider projectHostProvider,
                                                    ILanguageServiceHost languageServiceHost)
        {
            _serviceProvider     = serviceProvider;
            _projectVsServices   = projectVsServices;
            _projectHostProvider = projectHostProvider;
            _languageServiceHost = languageServiceHost;

            _containedLanguageFactory = new AsyncLazy <IVsContainedLanguageFactory>(GetContainedLanguageFactoryAsync, projectVsServices.ThreadingService.JoinableTaskFactory);
        }
        protected void UpdateProjectUnsafe(HostProject project)
        {
            var projectManager = GetProjectManager();

            if (_current == null && project == null)
            {
                // This is a no-op. This project isn't using Razor.
            }
            else if (_current == null && project != null)
            {
                // This is temporary code for initializing the companion project. We expect
                // this to be provided by the Managed Project System in the near future.
                var projectContextFactory = GetProjectContextFactory();
                if (projectContextFactory != null)
                {
                    var assembly = Assembly.Load("Microsoft.VisualStudio.ProjectSystem.Managed, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
                    var type     = assembly.GetType("Microsoft.VisualStudio.ProjectSystem.LanguageServices.IProjectHostProvider");

                    var exportProviderType = CommonServices.UnconfiguredProject.Services.ExportProvider.GetType();
                    var method             = exportProviderType.GetMethod(nameof(ExportProvider.GetExportedValue), Array.Empty <Type>()).MakeGenericMethod(type);
                    var export             = method.Invoke(CommonServices.UnconfiguredProject.Services.ExportProvider, Array.Empty <object>());
                    var host = new IProjectHostProvider(export);

                    var displayName = Path.GetFileNameWithoutExtension(CommonServices.UnconfiguredProject.FullPath) + " (Razor)";
                    _projectContext = projectContextFactory.CreateProjectContext(
                        LanguageNames.CSharp,
                        displayName,
                        CommonServices.UnconfiguredProject.FullPath,
                        Guid.NewGuid(),
                        host.UnconfiguredProjectHostObject.ActiveIntellisenseProjectHostObject,
                        null,
                        null);
                }

                // END temporary code

                projectManager.HostProjectAdded(project);
            }
            else if (_current != null && project == null)
            {
                Debug.Assert(_currentDocuments.Count == 0);
                projectManager.HostProjectRemoved(_current);
                _projectContext?.Dispose();
                _projectContext = null;
            }
            else
            {
                projectManager.HostProjectChanged(project);
            }

            _current = project;
        }
Exemple #5
0
 public VsContainedLanguageComponentsFactory(
     IUnconfiguredProjectCommonServices commonServices,
     SVsServiceProvider serviceProvider,
     IUnconfiguredProjectVsServices projectServices,
     IProjectHostProvider projectHostProvider,
     ILanguageServiceHost languageServiceHost)
     : base(commonServices.ThreadingService.JoinableTaskContext)
 {
     _serviceProvider     = serviceProvider;
     _projectVsServices   = projectServices;
     _projectHostProvider = projectHostProvider;
     _languageServiceHost = languageServiceHost;
 }
Exemple #6
0
 public UnconfiguredProjectContextProvider(IUnconfiguredProjectCommonServices commonServices,
                                           Lazy <IWorkspaceProjectContextFactory> contextFactory,
                                           IProjectHostProvider projectHostProvider,
                                           IActiveConfiguredProjectsProvider activeConfiguredProjectsProvider,
                                           ISafeProjectGuidService projectGuidService)
 {
     _commonServices      = commonServices;
     _contextFactory      = contextFactory;
     _projectHostProvider = projectHostProvider;
     _activeConfiguredProjectsProvider = activeConfiguredProjectsProvider;
     _projectGuidService            = projectGuidService;
     _unconfiguredProjectHostObject = _projectHostProvider.UnconfiguredProjectHostObject;
 }
        public UnconfiguredProjectContextProvider(IUnconfiguredProjectCommonServices commonServices,
                                                  Lazy <IWorkspaceProjectContextFactory> contextFactory,
                                                  IProjectAsyncLoadDashboard asyncLoadDashboard,
                                                  ITaskScheduler taskScheduler,
                                                  IProjectHostProvider projectHostProvider,
                                                  IActiveConfiguredProjectsProvider activeConfiguredProjectsProvider)
        {
            _commonServices      = commonServices;
            _contextFactory      = contextFactory;
            _asyncLoadDashboard  = asyncLoadDashboard;
            _taskScheduler       = taskScheduler;
            _projectHostProvider = projectHostProvider;
            _activeConfiguredProjectsProvider = activeConfiguredProjectsProvider;

            _unconfiguredProjectHostObject = _projectHostProvider.UnconfiguredProjectHostObject;
        }
Exemple #8
0
        public UnconfiguredProjectContextProvider(IUnconfiguredProjectCommonServices commonServices,
                                                  Lazy <IWorkspaceProjectContextFactory> contextFactory,
                                                  IProjectAsyncLoadDashboard asyncLoadDashboard,
                                                  ITaskScheduler taskScheduler,
                                                  IProjectHostProvider projectHostProvider,
                                                  IActiveConfiguredProjectsProvider activeConfiguredProjectsProvider)
        {
            _commonServices      = commonServices;
            _contextFactory      = contextFactory;
            _asyncLoadDashboard  = asyncLoadDashboard;
            _taskScheduler       = taskScheduler;
            _projectHostProvider = projectHostProvider;
            _activeConfiguredProjectsProvider = activeConfiguredProjectsProvider;
            _unconfiguredProjectHostObject    = _projectHostProvider.UnconfiguredProjectHostObject;

            ProjectGuidServices = new OrderPrecedenceImportCollection <IProjectGuidService>(projectCapabilityCheckProvider: commonServices.Project);
        }
Exemple #9
0
        public UnconfiguredProjectContextProvider(IUnconfiguredProjectCommonServices commonServices,
                                                  Lazy <IWorkspaceProjectContextFactory> contextFactory,
                                                  IProjectAsyncLoadDashboard asyncLoadDashboard,
                                                  ITaskScheduler taskScheduler,
                                                  IProjectHostProvider projectHostProvider,
                                                  ActiveConfiguredProjectsProvider activeConfiguredProjectsProvider)
        {
            Requires.NotNull(commonServices, nameof(commonServices));
            Requires.NotNull(contextFactory, nameof(contextFactory));
            Requires.NotNull(asyncLoadDashboard, nameof(asyncLoadDashboard));
            Requires.NotNull(taskScheduler, nameof(taskScheduler));
            Requires.NotNull(projectHostProvider, nameof(projectHostProvider));
            Requires.NotNull(activeConfiguredProjectsProvider, nameof(activeConfiguredProjectsProvider));

            _commonServices      = commonServices;
            _contextFactory      = contextFactory;
            _asyncLoadDashboard  = asyncLoadDashboard;
            _taskScheduler       = taskScheduler;
            _projectHostProvider = projectHostProvider;
            _activeConfiguredProjectsProvider = activeConfiguredProjectsProvider;

            _unconfiguredProjectHostObject = _projectHostProvider.UnconfiguredProjectHostObject;
        }
 public CSharpVsContainedLanguageComponentsFactory(SVsServiceProvider serviceProvider,
                                                   IUnconfiguredProjectVsServices projectServices,
                                                   IProjectHostProvider projectHostProvider)
     : base(serviceProvider, projectServices, projectHostProvider, CSharpLanguageServiceGuid)
 {
 }
        private static VsContainedLanguageComponentsFactory CreateInstance(IOleAsyncServiceProvider serviceProvider = null, IUnconfiguredProjectVsServices projectVsServices = null, IProjectHostProvider projectHostProvider = null, ILanguageServiceHost languageServiceHost = null)
        {
            projectVsServices   = projectVsServices ?? IUnconfiguredProjectVsServicesFactory.Create();
            projectHostProvider = projectHostProvider ?? IProjectHostProviderFactory.Create();
            languageServiceHost = languageServiceHost ?? ILanguageServiceHostFactory.Create();

            return(new VsContainedLanguageComponentsFactory(IVsServiceFactory.Create <SAsyncServiceProvider, IOleAsyncServiceProvider>(serviceProvider),
                                                            projectVsServices,
                                                            projectHostProvider,
                                                            languageServiceHost));
        }