public override VisualStudioRazorParser Create(VisualStudioDocumentTracker documentTracker)
        {
            if (documentTracker == null)
            {
                throw new ArgumentNullException(nameof(documentTracker));
            }

            _dispatcher.AssertForegroundThread();

            var parser = new DefaultVisualStudioRazorParser(
                _dispatcher,
                documentTracker,
                _templateEngineFactoryService,
                _errorReporter,
                _completionBroker);

            return(parser);
        }
        public void TryGetFromBuffer_UsesVisualStudioRazorParserIfAvailable()
        {
            // Arrange
            var expectedCodeDocument = TestRazorCodeDocument.Create("Hello World");
            var parser     = new DefaultVisualStudioRazorParser(expectedCodeDocument);
            var properties = new PropertyCollection();

            properties.AddProperty(typeof(VisualStudioRazorParser), parser);
            var textBuffer = new Mock <ITextBuffer>();

            textBuffer.Setup(buffer => buffer.Properties)
            .Returns(properties);
            var provider = new LegacyTextBufferCodeDocumentProvider();

            // Act
            var result = provider.TryGetFromBuffer(textBuffer.Object, out var codeDocument);

            // Assert
            Assert.True(result);
            Assert.Same(expectedCodeDocument, codeDocument);
        }