private WorkspaceProjectContextHostInstance CreateInstance(ConfiguredProject project = null, IProjectThreadingService threadingService = null, IUnconfiguredProjectTasksService tasksService = null, IProjectSubscriptionService projectSubscriptionService = null, IActiveEditorContextTracker activeWorkspaceProjectContextTracker = null, IWorkspaceProjectContextProvider workspaceProjectContextProvider = null, IApplyChangesToWorkspaceContext applyChangesToWorkspaceContext = null) { project = project ?? ConfiguredProjectFactory.Create(); threadingService = threadingService ?? IProjectThreadingServiceFactory.Create(); tasksService = tasksService ?? IUnconfiguredProjectTasksServiceFactory.Create(); projectSubscriptionService = projectSubscriptionService ?? IProjectSubscriptionServiceFactory.Create(); activeWorkspaceProjectContextTracker = activeWorkspaceProjectContextTracker ?? IActiveEditorContextTrackerFactory.Create(); workspaceProjectContextProvider = workspaceProjectContextProvider ?? IWorkspaceProjectContextProviderFactory.ImplementCreateProjectContextAsync(IWorkspaceProjectContextAccessorFactory.Create()); applyChangesToWorkspaceContext = applyChangesToWorkspaceContext ?? IApplyChangesToWorkspaceContextFactory.Create(); return(new WorkspaceProjectContextHostInstance(project, threadingService, tasksService, projectSubscriptionService, workspaceProjectContextProvider, activeWorkspaceProjectContextTracker, ExportFactoryFactory.ImplementCreateValueWithAutoDispose(() => applyChangesToWorkspaceContext))); }
private static StartupProjectRegistrar CreateInstance( IVsStartupProjectsListService?vsStartupProjectsListService = null, IProjectThreadingService?threadingService = null, ISafeProjectGuidService?projectGuidService = null, IActiveConfiguredProjectSubscriptionService?projectSubscriptionService = null, IActiveConfiguredValues <IDebugLaunchProvider>?launchProviders = null) { var project = UnconfiguredProjectFactory.Create(); var instance = new StartupProjectRegistrar( project, IUnconfiguredProjectTasksServiceFactory.Create(), IVsServiceFactory.Create <SVsStartupProjectsListService, IVsStartupProjectsListService?>(vsStartupProjectsListService !), threadingService ?? IProjectThreadingServiceFactory.Create(), projectGuidService ?? ISafeProjectGuidServiceFactory.ImplementGetProjectGuidAsync(Guid.NewGuid()), projectSubscriptionService ?? IActiveConfiguredProjectSubscriptionServiceFactory.Create(), launchProviders !); return(instance); }
private static WorkspaceProjectContextHostInstance CreateInstance(ConfiguredProject?project = null, IProjectThreadingService?threadingService = null, IUnconfiguredProjectTasksService?tasksService = null, IProjectSubscriptionService?projectSubscriptionService = null, IActiveEditorContextTracker?activeWorkspaceProjectContextTracker = null, IWorkspaceProjectContextProvider?workspaceProjectContextProvider = null, IApplyChangesToWorkspaceContext?applyChangesToWorkspaceContext = null) { project ??= ConfiguredProjectFactory.Create(); threadingService ??= IProjectThreadingServiceFactory.Create(); tasksService ??= IUnconfiguredProjectTasksServiceFactory.Create(); projectSubscriptionService ??= IProjectSubscriptionServiceFactory.Create(); activeWorkspaceProjectContextTracker ??= IActiveEditorContextTrackerFactory.Create(); workspaceProjectContextProvider ??= IWorkspaceProjectContextProviderFactory.ImplementCreateProjectContextAsync(IWorkspaceProjectContextAccessorFactory.Create()); applyChangesToWorkspaceContext ??= IApplyChangesToWorkspaceContextFactory.Create(); IDataProgressTrackerService dataProgressTrackerService = IDataProgressTrackerServiceFactory.Create(); return(new WorkspaceProjectContextHostInstance(project, threadingService, tasksService, projectSubscriptionService, workspaceProjectContextProvider, activeWorkspaceProjectContextTracker, ExportFactoryFactory.ImplementCreateValueWithAutoDispose(() => applyChangesToWorkspaceContext), dataProgressTrackerService)); }
internal async Task RenameAsync(string sourceCode, string oldFilePath, string newFilePath, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, IVsOnlineServices vsOnlineServices, string language) { using var ws = new AdhocWorkspace(); ws.AddSolution(InitializeWorkspace(ProjectId.CreateNewId(), newFilePath, sourceCode, language)); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: $@"C:\project1.{ProjectFileExtension}"); var projectServices = IUnconfiguredProjectVsServicesFactory.Implement( threadingServiceCreator: () => IProjectThreadingServiceFactory.Create(), unconfiguredProjectCreator: () => unconfiguredProject); var unconfiguredProjectTasksService = IUnconfiguredProjectTasksServiceFactory.Create(); var environmentOptionsFactory = IEnvironmentOptionsFactory.Implement((string category, string page, string property, bool defaultValue) => { return(true); }); var waitIndicator = (new Mock <IWaitIndicator>()).Object; var refactorNotifyService = (new Mock <IRefactorNotifyService>()).Object; var dte = IVsUIServiceFactory.Create <Shell.Interop.SDTE, EnvDTE.DTE>(null !); var renamer = new Renamer(projectServices, unconfiguredProjectTasksService, ws, dte, environmentOptionsFactory, userNotificationServices, roslynServices, waitIndicator, refactorNotifyService, vsOnlineServices); await renamer.HandleRenameAsync(oldFilePath, newFilePath) .TimeoutAfter(TimeSpan.FromSeconds(1)); }