Beispiel #1
0
            public OptionService(
                IGlobalOptionService globalOptionService,
                HostWorkspaceServices workspaceServices)
            {
                _globalOptionService = globalOptionService;

                var workspaceTaskSchedulerFactory = workspaceServices.GetRequiredService <IWorkspaceTaskSchedulerFactory>();

                _taskQueue = workspaceTaskSchedulerFactory.CreateEventingTaskQueue();

                _globalOptionService.OptionChanged += OnGlobalOptionServiceOptionChanged;
            }
Beispiel #2
0
        public BackgroundParser(Workspace workspace)
        {
            _workspace = workspace;

            var taskSchedulerFactory = workspace.Services.GetService <IWorkspaceTaskSchedulerFactory>();

            _taskScheduler = taskSchedulerFactory.CreateBackgroundTaskScheduler();
            _workspace.WorkspaceChanged += this.OnWorkspaceChanged;

            workspace.DocumentOpened += this.OnDocumentOpened;
            workspace.DocumentClosed += this.OnDocumentClosed;
        }
Beispiel #3
0
        protected Workspace(HostServices host)
        {
            _services = host.CreateWorkspaceServices(this);

            // queue used for sending events
            var workspaceTaskSchedulerFactory = _services.GetRequiredService <IWorkspaceTaskSchedulerFactory>();

            _taskQueue = workspaceTaskSchedulerFactory.CreateEventingTaskQueue();

            // initialize with empty document set
            _latestDocuments = new WorkspaceDocuments(ImmutableDictionary <DocumentId, Document> .Empty);
        }
Beispiel #4
0
        public BackgroundCompiler(Workspace workspace)
        {
            _workspace = workspace;

            // make a scheduler that runs on the thread pool
            var taskSchedulerFactory = workspace.Services.GetService <IWorkspaceTaskSchedulerFactory>();

            _compilationScheduler = taskSchedulerFactory.CreateBackgroundTaskScheduler();

            _cancellationSource          = new CancellationTokenSource();
            _workspace.WorkspaceChanged += OnWorkspaceChanged;
            _workspace.DocumentOpened   += OnDocumentOpened;
            _workspace.DocumentClosed   += OnDocumentClosed;
        }
Beispiel #5
0
        internal Workspace(IWorkspaceServiceProvider workspaceServicesProvider)
        {
            this.primaryBranchId = BranchId.GetNextId();

            this.workspaceServicesProvider = workspaceServicesProvider;

            // queue used for sending events
            var workspaceTaskSchedulerFactory = workspaceServicesProvider.GetService <IWorkspaceTaskSchedulerFactory>();

            this.taskQueue = workspaceTaskSchedulerFactory.CreateTaskQueue();

            // initialize with empty solution
            this.latestSolution = CreateSolution(SolutionId.CreateNewId());
        }
Beispiel #6
0
        public BackgroundParser(Workspace workspace)
        {
            _workspace = workspace;

            var taskSchedulerFactory = workspace.Services.GetService<IWorkspaceTaskSchedulerFactory>();
            _taskScheduler = taskSchedulerFactory.CreateTaskScheduler(TaskScheduler.Default);
            _workspace.WorkspaceChanged += this.OnWorkspaceChanged;

            var editorWorkspace = workspace as Workspace;
            if (editorWorkspace != null)
            {
                editorWorkspace.DocumentOpened += this.OnDocumentOpened;
                editorWorkspace.DocumentClosed += this.OnDocumentClosed;
            }
        }
Beispiel #7
0
        public BackgroundCompiler(Workspace workspace)
        {
            _workspace = workspace;

            // make a scheduler that runs on the thread pool
            var taskSchedulerFactory = workspace.Services.GetService<IWorkspaceTaskSchedulerFactory>();
            _compilationScheduler = taskSchedulerFactory.CreateTaskScheduler(TaskScheduler.Default);

            // default uses current (ideally UI/foreground scheduler) if possible
            _notificationQueue = taskSchedulerFactory.CreateTaskQueue();
            _cancellationSource = new CancellationTokenSource();
            _workspace.WorkspaceChanged += this.OnWorkspaceChanged;
            _workspace.DocumentOpened += OnDocumentOpened;
            _workspace.DocumentClosed += OnDocumentClosed;
        }
Beispiel #8
0
        /// <summary>
        /// Constructs a new workspace instance.
        /// </summary>
        /// <param name="host">The <see cref="HostServices"/> this workspace uses</param>
        /// <param name="workspaceKind">A string that can be used to identify the kind of workspace. Usually this matches the name of the class.</param>
        protected Workspace(HostServices host, string workspaceKind)
        {
            this.primaryBranchId = BranchId.GetNextId();
            this.workspaceKind   = workspaceKind;

            this.services = host.CreateWorkspaceServices(this);

            // queue used for sending events
            var workspaceTaskSchedulerFactory = this.services.GetService <IWorkspaceTaskSchedulerFactory>();

            this.taskQueue = workspaceTaskSchedulerFactory.CreateTaskQueue();

            // initialize with empty solution
            this.latestSolution = CreateSolution(SolutionId.CreateNewId());
        }
Beispiel #9
0
        public BackgroundParser(Workspace workspace)
        {
            _workspace = workspace;

            var taskSchedulerFactory = workspace.Services.GetService <IWorkspaceTaskSchedulerFactory>();

            _taskScheduler = taskSchedulerFactory.CreateBackgroundTaskScheduler();

            var editorWorkspace = workspace as Workspace;

            if (editorWorkspace != null)
            {
                editorWorkspace.DocumentOpened += this.OnDocumentOpened;
                editorWorkspace.DocumentClosed += this.OnDocumentClosed;
            }
        }
Beispiel #10
0
        public BackgroundCompiler(Workspace workspace)
        {
            _workspace = workspace;

            // make a scheduler that runs on the thread pool
            var taskSchedulerFactory = workspace.Services.GetService <IWorkspaceTaskSchedulerFactory>();

            _compilationScheduler = taskSchedulerFactory.CreateTaskScheduler(TaskScheduler.Default);

            // default uses current (ideally UI/foreground scheduler) if possible
            _notificationQueue           = taskSchedulerFactory.CreateTaskQueue();
            _cancellationSource          = new CancellationTokenSource();
            _workspace.WorkspaceChanged += this.OnWorkspaceChanged;
            _workspace.DocumentOpened   += OnDocumentOpened;
            _workspace.DocumentClosed   += OnDocumentClosed;
        }
        public BackgroundParser(Workspace workspace)
        {
            this.workspace = workspace;

            var taskSchedulerFactory = WorkspaceService.GetService <IWorkspaceTaskSchedulerFactory>(workspace);

            this.taskScheduler = taskSchedulerFactory.CreateTaskScheduler(TaskScheduler.Default);
            this.workspace.WorkspaceChanged += this.OnWorkspaceChanged;

            var editorWorkspace = workspace as Workspace;

            if (editorWorkspace != null)
            {
                editorWorkspace.DocumentOpened += this.OnDocumentOpened;
                editorWorkspace.DocumentClosed += this.OnDocumentClosed;
            }
        }