zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 75ccdcc356839687033ba982a34fe0703ba1e349 (tree)
parent b745a96d20e8159a68be53478d30c72f8c216dd3
Author: Ian Johnson <ian@ianjohnson.dev>
Date:   Sat, 15 Feb 2025 16:57:04 -0500

Autodoc: report errors in user interface

Also includes panics by virtue of the previous commit, checking one item off #19249.

Diffstat:
Mlib/docs/index.html | 32++++++++++++++++++++++++++++++++
Mlib/docs/main.js | 4++++
2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/lib/docs/index.html b/lib/docs/index.html @@ -6,6 +6,9 @@ <title>Zig Documentation</title> <link rel="icon" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNTMgMTQwIj48ZyBmaWxsPSIjRjdBNDFEIj48Zz48cG9seWdvbiBwb2ludHM9IjQ2LDIyIDI4LDQ0IDE5LDMwIi8+PHBvbHlnb24gcG9pbnRzPSI0NiwyMiAzMywzMyAyOCw0NCAyMiw0NCAyMiw5NSAzMSw5NSAyMCwxMDAgMTIsMTE3IDAsMTE3IDAsMjIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMzEsOTUgMTIsMTE3IDQsMTA2Ii8+PC9nPjxnPjxwb2x5Z29uIHBvaW50cz0iNTYsMjIgNjIsMzYgMzcsNDQiLz48cG9seWdvbiBwb2ludHM9IjU2LDIyIDExMSwyMiAxMTEsNDQgMzcsNDQgNTYsMzIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTE2LDk1IDk3LDExNyA5MCwxMDQiLz48cG9seWdvbiBwb2ludHM9IjExNiw5NSAxMDAsMTA0IDk3LDExNyA0MiwxMTcgNDIsOTUiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTUwLDAgNTIsMTE3IDMsMTQwIDEwMSwyMiIvPjwvZz48Zz48cG9seWdvbiBwb2ludHM9IjE0MSwyMiAxNDAsNDAgMTIyLDQ1Ii8+PHBvbHlnb24gcG9pbnRzPSIxNTMsMjIgMTUzLDExNyAxMDYsMTE3IDEyMCwxMDUgMTI1LDk1IDEzMSw5NSAxMzEsNDUgMTIyLDQ1IDEzMiwzNiAxNDEsMjIiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIvPjxwb2x5Z29uIHBvaW50cz0iMTI1LDk1IDEzMCwxMTAgMTA2LDExNyIvPjwvZz48L2c+PC9zdmc+"> <style type="text/css"> + *, *::before, *::after { + box-sizing: border-box; + } body { font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif; color: #000000; @@ -157,6 +160,23 @@ cursor: default; } + #errors { + background-color: #faa; + position: fixed; + left: 0; + bottom: 0; + width: 100%; + max-height: min(20em, 50vh); + padding: 0.5em; + overflow: auto; + } + #errors h1 { + font-size: 1.5em; + } + #errors pre { + background-color: #fcc; + } + #listSearchResults li.selected { background-color: #93e196; } @@ -252,6 +272,14 @@ #listSearchResults li.selected a { color: #fff; } + #errors { + background-color: #800; + color: #fff; + } + #errors pre { + background-color: #a00; + color: #fff; + } dl > div { border-color: #373737; } @@ -414,6 +442,10 @@ <dl><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd></dl> <dl><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd></dl> </div> + <div id="errors" class="hidden"> + <h1>Errors</h1> + <pre id="errorsText"></pre> + </div> <script src="main.js"></script> </body> </html> diff --git a/lib/docs/main.js b/lib/docs/main.js @@ -53,6 +53,8 @@ const domStatus = document.getElementById("status"); const domTableFnErrors = document.getElementById("tableFnErrors"); const domTldDocs = document.getElementById("tldDocs"); + const domErrors = document.getElementById("errors"); + const domErrorsText = document.getElementById("errorsText"); var searchTimer = null; @@ -94,6 +96,8 @@ switch (level) { case LOG_err: console.error(msg); + domErrorsText.textContent += msg + "\n"; + domErrors.classList.remove("hidden"); break; case LOG_warn: console.warn(msg);