public abstract Get ( string physicalFilePath ) : Microsoft.AspNetCore.Razor.LanguageServer.ReferenceOutputCapturingContainer | ||
physicalFilePath | string | |
return | Microsoft.AspNetCore.Razor.LanguageServer.ReferenceOutputCapturingContainer |
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); } }
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); } }