示例#1
0
        public DefaultRazorProjectChangePublisher(
            JoinableTaskContext joinableTaskContext,
            LSPEditorFeatureDetector lSPEditorFeatureDetector,
            RazorLogger logger)
        {
            if (joinableTaskContext is null)
            {
                throw new ArgumentNullException(nameof(joinableTaskContext));
            }

            if (lSPEditorFeatureDetector is null)
            {
                throw new ArgumentNullException(nameof(lSPEditorFeatureDetector));
            }

            if (logger is null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _deferredPublishTasks    = new Dictionary <string, Task>(FilePathComparer.Instance);
            _pendingProjectPublishes = new Dictionary <string, ProjectSnapshot>(FilePathComparer.Instance);
            _publishLock             = new object();

            _lspEditorFeatureDetector = lSPEditorFeatureDetector;

            _logger = logger;

            _serializer.Converters.Add(TagHelperDescriptorJsonConverter.Instance);
            _serializer.Converters.Add(RazorConfigurationJsonConverter.Instance);
            _serializer.Converters.Add(CodeAnalysis.Razor.Workspaces.Serialization.ProjectSnapshotJsonConverter.Instance);
            _joinableTaskContext = joinableTaskContext;
        }
示例#2
0
        public DefaultRazorProjectChangePublisher(
            LSPEditorFeatureDetector lSPEditorFeatureDetector,
            ProjectConfigurationFilePathStore projectConfigurationFilePathStore,
            [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
            RazorLogger logger)
        {
            if (lSPEditorFeatureDetector is null)
            {
                throw new ArgumentNullException(nameof(lSPEditorFeatureDetector));
            }

            if (projectConfigurationFilePathStore is null)
            {
                throw new ArgumentNullException(nameof(projectConfigurationFilePathStore));
            }

            if (logger is null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (serviceProvider is null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            _deferredPublishTasks    = new Dictionary <string, Task>(FilePathComparer.Instance);
            _pendingProjectPublishes = new Dictionary <string, ProjectSnapshot>(FilePathComparer.Instance);
            _publishLock             = new object();

            _lspEditorFeatureDetector          = lSPEditorFeatureDetector;
            _projectConfigurationFilePathStore = projectConfigurationFilePathStore;
            _logger = logger;

            _serializer.Converters.Add(TagHelperDescriptorJsonConverter.Instance);
            _serializer.Converters.Add(RazorConfigurationJsonConverter.Instance);
            _serializer.Converters.Add(CodeAnalysis.Razor.Workspaces.Serialization.ProjectSnapshotJsonConverter.Instance);

            if (serviceProvider.GetService(typeof(SVsOperationProgress)) is IVsOperationProgressStatusService service)
            {
                _operationProgressStatusService = service;
            }
        }