Get() 공개 추상적인 메소드

public abstract Get ( string physicalFilePath ) : Microsoft.AspNetCore.Razor.LanguageServer.ReferenceOutputCapturingContainer
physicalFilePath string
리턴 Microsoft.AspNetCore.Razor.LanguageServer.ReferenceOutputCapturingContainer
예제 #1
0
        public override HostDocument Create(string filePath, string targetFilePath, string fileKind)
        {
            if (filePath is null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

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

            var hostDocument = new HostDocument(filePath, targetFilePath, fileKind);

            hostDocument.GeneratedDocumentContainer.GeneratedCSharpChanged += GeneratedDocumentContainer_Changed;
            hostDocument.GeneratedDocumentContainer.GeneratedHtmlChanged   += GeneratedDocumentContainer_Changed;

            return(hostDocument);

            void GeneratedDocumentContainer_Changed(object sender, TextChangeEventArgs args)
            {
                var sharedContainer = _generatedDocumentContainerStore.Get(filePath);
                var container       = (GeneratedDocumentContainer)sender;
                var latestDocument  = (DefaultDocumentSnapshot)container.LatestDocument;

                _ = Task.Factory.StartNew(
                    () => sharedContainer.SetOutputAndCaptureReferenceAsync(latestDocument),
                    CancellationToken.None,
                    TaskCreationOptions.None,
                    TaskScheduler.Default);
            }
        }
예제 #2
0
        public override HostDocument Create(string filePath, string targetFilePath, string fileKind)
        {
            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            if (targetFilePath == null)
            {
                throw new ArgumentNullException(nameof(targetFilePath));
            }

            var hostDocument = new HostDocument(filePath, targetFilePath, fileKind);

            hostDocument.GeneratedDocumentContainer.GeneratedCSharpChanged += GeneratedDocumentContainer_Changed;
            hostDocument.GeneratedDocumentContainer.GeneratedHtmlChanged   += GeneratedDocumentContainer_Changed;

            return(hostDocument);

            void GeneratedDocumentContainer_Changed(object sender, TextChangeEventArgs args)
            {
                var sharedContainer = _generatedDocumentContainerStore.Get(filePath);
                var container       = (GeneratedDocumentContainer)sender;
                var latestDocument  = (DefaultDocumentSnapshot)container.LatestDocument;

                _ = Task.Factory.StartNew(async() =>
                {
                    var codeDocument = await latestDocument.GetGeneratedOutputAsync();

                    sharedContainer.SetOutput(
                        latestDocument,
                        codeDocument.GetCSharpDocument(),
                        codeDocument.GetHtmlDocument(),
                        container.InputVersion,
                        container.OutputCSharpVersion,
                        container.OutputHtmlVersion);
                }, CancellationToken.None, TaskCreationOptions.None, _foregroundDispatcher.BackgroundScheduler);
            }
        }