public override IRazorSpanMappingService GetMappingService()
            {
                if (_mappingService == null)
                {
                    _mappingService = new RazorLSPSpanMappingService(_lspDocumentMappingProvider, _documentSnapshot, _textSnapshot);
                }

                return(_mappingService);
            }
コード例 #2
0
        public TService GetService <TService>() where TService : class
        {
            if (_documentContainer == null)
            {
                return(this as TService);
            }

            if (typeof(TService) == typeof(IRazorSpanMappingService))
            {
                if (_spanMappingService == null)
                {
                    lock (_lock)
                    {
                        if (_spanMappingService == null)
                        {
                            _spanMappingService = _documentContainer.GetMappingService();
                        }
                    }
                }

                return((TService)_spanMappingService);
            }

            if (typeof(TService) == typeof(IRazorDocumentExcerptService))
            {
                if (_excerptService == null)
                {
                    lock (_lock)
                    {
                        if (_excerptService == null)
                        {
                            _excerptService = _documentContainer.GetExcerptService();
                        }
                    }
                }

                return((TService)_excerptService);
            }

            if (typeof(TService) == typeof(IRazorDocumentPropertiesService))
            {
                if (_documentPropertiesService == null)
                {
                    lock (_lock)
                    {
                        if (_documentPropertiesService == null)
                        {
                            _documentPropertiesService = _documentContainer.GetDocumentPropertiesService();
                        }
                    }
                }

                return((TService)_documentPropertiesService);
            }

            return(this as TService);
        }
コード例 #3
0
        public RazorDocumentExcerptService(DocumentSnapshot document, IRazorSpanMappingService mapper)
        {
            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }

            _document = document;
            _mapper   = mapper;
        }
コード例 #4
0
        public RazorDocumentExcerptService(DocumentSnapshot document, IRazorSpanMappingService mappingService)
        {
            if (document is null)
            {
                throw new ArgumentNullException(nameof(document));
            }

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

            _document       = document;
            _mappingService = mappingService;
        }
コード例 #5
0
        public CSharpDocumentExcerptService(
            IRazorSpanMappingService mappingService,
            LSPDocumentSnapshot documentSnapshot)
        {
            if (mappingService is null)
            {
                throw new ArgumentNullException(nameof(mappingService));
            }

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

            _mappingService   = mappingService;
            _documentSnapshot = documentSnapshot;
        }
コード例 #6
0
 public RazorSpanMappingServiceWrapper(IRazorSpanMappingService razorSpanMappingService)
 {
     _razorSpanMappingService = razorSpanMappingService ?? throw new ArgumentNullException(nameof(razorSpanMappingService));
 }