private void AnalyzeCore(CancellationToken ct) { try { Interlocked.Exchange(ref willLint, 0); while (Interlocked.Exchange(ref impendingRequests, 0) > 0) { ct.ThrowIfCancellationRequested(); //Owner.Logger.LogDebug(0, "Start analyzing {document}.", Owner.TextDocument.Uri); var doc = Owner.TextDocument; //var linted = Owner.WikitextLinter.Lint(doc, ct); var linted = ReStructuredTextParser.ParseContent(doc.Content); // document has been changed! // then just wait for another RequestLint() if (doc != Owner.TextDocument) { continue; } Owner.LintedDocument = linted; Owner.OnDocumentLinted(); } } catch (Exception ex) { //Owner.Logger.LogError(0, ex, "Error analyzing {document}.", Owner.TextDocument.Uri); } finally { lock (syncLock) analyzeTask = null; //Owner.Logger.LogDebug(0, "Finished analyzing {document}.", Owner.TextDocument.Uri); } }
public static Document Test(string fileName) { var path = Path.Combine("Input", fileName); var result = ReStructuredTextParser.ParseDocument(path); return(result); }
/// <summary> /// Apply impending changes to <see cref="LintedDocument"/> right now. /// </summary> public void AnalyzeAsync() { //await Synchronizer.ApplyChangesAsync(); //await DocumentLinter.AnalyzeAsync(ct); //if (LintedDocument == null || TextDocument.) { LintedDocument = ReStructuredTextParser.ParseContent(TextDocument.Content); } }
public DocumentState(TextDocument doc, ReStructuredTextParser parser, ILoggerFactory loggerFactory) { //if (loggerFactory == null) throw new ArgumentNullException(nameof(loggerFactory)); //Logger = loggerFactory.CreateLogger<DocumentState>(); TextDocument = doc ?? throw new ArgumentNullException(nameof(doc)); WikitextLinter = parser; // DocumentLinter = new TextDocumentLinter(this); Synchronizer = new TextDocumentSynchronizer(this); // Caller's responsibility. // DocumentLinter.RequestLint(); }
/// <summary> /// Apply impending changes to <see cref="LintedDocument"/> right now. /// </summary> public async Task AnalyzeAsync(CancellationToken ct) { ct.ThrowIfCancellationRequested(); await Synchronizer.ApplyChangesAsync(); ct.ThrowIfCancellationRequested(); //await DocumentLinter.AnalyzeAsync(ct); //if (LintedDocument == null || TextDocument.) { LintedDocument = ReStructuredTextParser.ParseContent(TextDocument.Content); } }
public void TestDockPanelSuite() { var path = "/Users/lextm/dockpanelsuite_docs"; if (Directory.Exists(path)) { foreach (string file in Directory.EnumerateFiles( path, "*.rst", SearchOption.AllDirectories)) { try { var result = ReStructuredTextParser.ParseDocument(file); } catch (Exception ex) { Assert.Equal(path, file); } } } }