private void ValidateTextDocument(TextDocumentItem document) { if (!ValaDocumentValidator.IsHandled(document)) { return; } List <Diagnostic> diagnostics = new List <Diagnostic>(); try { List <Diagnostic> messages = _validator.Validate(document.GetDocumentPath()); diagnostics.AddRange(messages); } catch (ParseException ex) { if (ex.error_type != ParseError.SYNTAX) { throw ex; } diagnostics.Add(new Diagnostic { severity = DiagnosticSeverity.Error, message = ex.Message, source = "syntax" }); } finally { Proxy.TextDocument.PublishDiagnostics(new PublishDiagnosticsParams { uri = document.uri, diagnostics = diagnostics.ToArray() }); } }
public App(Stream input, Stream output) : base(input, output) { GLib.GLibInitialize(); _documents = new TextDocumentManager(); _documents.Changed += Documents_Changed; _validator = new ValaDocumentValidator(); Logger.Get.Attach(this); }