Skip to content

Commit

Permalink
Update generated API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukstafi committed Mar 17, 2023
1 parent 28425a6 commit 04345f7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/_html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<div class="by-name">
<h2>OCaml package documentation</h2>
<ol>
<li><a href="minidebug_runtime/index.html">minidebug_runtime</a> <span class="version">0.1.2</span></li>
<li><a href="ppx_minidebug/index.html">ppx_minidebug</a> <span class="version">0.1.2</span></li>
<li><a href="minidebug_runtime/index.html">minidebug_runtime</a> <span class="version">0.1.3</span></li>
<li><a href="ppx_minidebug/index.html">ppx_minidebug</a> <span class="version">0.1.3</span></li>
</ol>
</div>
</main>
Expand Down
34 changes: 26 additions & 8 deletions docs/_html/ppx_minidebug/Ppx_minidebug/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,38 @@
<span><span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression <span class="arrow">&#45;&gt;</span></span>
<span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression)</span>
<span class="xref-unresolved">Stdlib</span>.ref</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-collect_fun"><a href="#val-collect_fun" class="anchor"></a><code><span><span class="keyword">val</span> collect_fun :
<span><span><span>(<span class="xref-unresolved">Ppxlib_ast</span>.Ast.pattern * <span class="xref-unresolved">Ppxlib</span>.location)</span> list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="xref-unresolved">Ppxlib_ast</span>.Ast.pattern * <span class="xref-unresolved">Ppxlib</span>.location)</span> list</span>
<span><span><span>(<span class="xref-unresolved">Ppxlib</span>.arg_label
* <span><span class="xref-unresolved">Ppxlib</span>.expression option</span>
* <span class="xref-unresolved">Ppxlib</span>.pattern
* <span class="xref-unresolved">Ppxlib</span>.location
* <span class="xref-unresolved">Ppxlib</span>.location_stack
* <span class="xref-unresolved">Ppxlib</span>.attributes)</span>
list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Ppxlib</span>.expression <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span class="xref-unresolved">Ppxlib</span>.arg_label
* <span><span class="xref-unresolved">Ppxlib</span>.expression option</span>
* <span class="xref-unresolved">Ppxlib</span>.pattern
* <span class="xref-unresolved">Ppxlib</span>.location
* <span class="xref-unresolved">Ppxlib</span>.location_stack
* <span class="xref-unresolved">Ppxlib</span>.attributes)</span>
list</span>
* <span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression
* <span><span class="xref-unresolved">Ppxlib_ast</span>.Ast.core_type option</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-expand_fun"><a href="#val-expand_fun" class="anchor"></a><code><span><span class="keyword">val</span> expand_fun :
<span><span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span class="xref-unresolved">Ppxlib_ast</span>.Ast.pattern * <span class="xref-unresolved">Ppxlib</span>.location)</span> list</span> <span class="arrow">&#45;&gt;</span></span>
<span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-debug_fun"><a href="#val-debug_fun" class="anchor"></a><code><span><span class="keyword">val</span> debug_fun :
<span><span class="xref-unresolved">Ppxlib</span>.expression <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<span class="xref-unresolved">Ppxlib</span>.arg_label
* <span><span class="xref-unresolved">Ppxlib</span>.expression option</span>
* <span class="xref-unresolved">Ppxlib</span>.pattern
* <span class="xref-unresolved">Ppxlib</span>.location
* <span class="xref-unresolved">Ppxlib</span>.location_stack
* <span class="xref-unresolved">Ppxlib</span>.attributes)</span>
list</span> <span class="arrow">&#45;&gt;</span></span>
<span class="xref-unresolved">Ppxlib</span>.expression</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-debug_fun"><a href="#val-debug_fun" class="anchor"></a><code><span><span class="keyword">val</span> debug_fun :
<span><span>(<span><span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression <span class="arrow">&#45;&gt;</span></span> <span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Ppxlib</span>.pattern <span class="arrow">&#45;&gt;</span></span>
<span><span>string <span class="xref-unresolved">Ppxlib</span>.loc</span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="xref-unresolved">Ppxlib_ast</span>.Ast.core_type option</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression <span class="arrow">&#45;&gt;</span></span>
<span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-debug_binding"><a href="#val-debug_binding" class="anchor"></a><code><span><span class="keyword">val</span> debug_binding :
<span><span class="xref-unresolved">Ppxlib</span>.expression <span class="arrow">&#45;&gt;</span></span>
<span class="xref-unresolved">Ppxlib</span>.expression</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-debug_binding"><a href="#val-debug_binding" class="anchor"></a><code><span><span class="keyword">val</span> debug_binding :
<span><span>(<span><span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression <span class="arrow">&#45;&gt;</span></span> <span class="xref-unresolved">Ppxlib_ast</span>.Ast.expression)</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="xref-unresolved">Ppxlib</span>.value_binding <span class="arrow">&#45;&gt;</span></span>
<span class="xref-unresolved">Ppxlib</span>.value_binding</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-traverse"><a href="#val-traverse" class="anchor"></a><code><span><span class="keyword">val</span> traverse : <span class="xref-unresolved">Ppxlib</span>.Ast_traverse.map</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-debug_this_expander"><a href="#val-debug_this_expander" class="anchor"></a><code><span><span class="keyword">val</span> debug_this_expander : <span><span class="xref-unresolved">Ppxlib</span>.expression <span class="arrow">&#45;&gt;</span></span> <span class="xref-unresolved">Ppxlib</span>.expression</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-debug_expander"><a href="#val-debug_expander" class="anchor"></a><code><span><span class="keyword">val</span> debug_expander :
Expand Down
18 changes: 12 additions & 6 deletions docs/_html/ppx_minidebug/index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>index (ppx_minidebug.index)</title><link rel="stylesheet" href="../_odoc_support/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../_odoc_support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – ppx_minidebug</nav><header class="odoc-preamble"><h2 id="ppx_minidebug-usage"><a href="#ppx_minidebug-usage" class="anchor"></a><code>ppx_minidebug</code> usage</h2><p><code>ppx_minidebug</code> traces selected code if it has type annotations. <code>ppx_minidebug</code> offers three ways of instrumenting the code: <code>%debug_pp</code> and <code>%debug_show</code> based on <code>deriving.show</code>, and <code>%debug_sexp</code> based on the <code>sexplib</code>. The syntax extension expects a module <code>Debug_runtime</code> in the scope. <code>minidebug_runtime</code> offers three ways of logging the traces, as functors generating <code>Debug_runtime</code> modules given a file path.</p><p>Take a look at <a href="https://github.com/dariusf/ppx_debug"><code>ppx_debug</code></a> which is significantly more powerful!</p><p>See <a href="http://lukstafi.github.io/ppx_minidebug/minidebug_runtime/Minidebug_runtime/index.html"><code>Minidebug_runtime</code></a> for the provided loggers.</p></header><nav class="odoc-toc"><ul><li><a href="#usage">Usage</a></li><li><a href="#vs-code-suggestions">VS Code suggestions</a><ul><li><a href="#visualize-the-flame-graph-using-log-inspector">Visualize the flame graph using <em>Log Inspector</em></a></li><li><a href="#go-to-file-location-using-find-and-transform">Go to file location using <em>Find and Transform</em></a></li></ul></li></ul></nav><div class="odoc-content"><h3 id="usage"><a href="#usage" class="anchor"></a>Usage</h3><p>To trace a function, you have to type-annotate the function result. To trace an argument of a traced function, or a <code>let</code>-binding, you need to type-annotate it. You can control how much gets logged by adding or removing type annotations.</p><p>Tracing only happens in explicitly marked scopes, using the extension points: <code>%debug_pp</code>, <code>%debug_this_pp</code>, <code>%debug_show</code>, <code>%debug_this_show</code> (based on printing functionality provided by <code>deriving.show</code>), <code>%debug_sexp</code>, <code>%debug_this_sexp</code> (using functionality provided by <code>sexplib</code> and <code>ppx_sexp</code>). See examples in <a href="https://github.com/lukstafi/ppx_minidebug/tree/main/test">the test directory</a>.</p><p>The <code>%debug_this</code> variants are intended only for <code>let</code>-bindings: <code>let%debug_this v: t = compute value in body</code> will trace <code>v</code> and the type-annotated bindings and functions inside <code>compute value</code>, but it will not trace <code>body</code>.</p><p>Example setting up a logger printing to the screen:</p><pre class="language-ocaml"><code>module Debug_runtime =
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>index (ppx_minidebug.index)</title><link rel="stylesheet" href="../_odoc_support/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../_odoc_support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – ppx_minidebug</nav><header class="odoc-preamble"><h2 id="ppx_minidebug-usage"><a href="#ppx_minidebug-usage" class="anchor"></a><code>ppx_minidebug</code> usage</h2><p><code>ppx_minidebug</code> traces selected code if it has type annotations. <code>ppx_minidebug</code> offers three ways of instrumenting the code: <code>%debug_pp</code> and <code>%debug_show</code> based on <code>deriving.show</code>, and <code>%debug_sexp</code> based on the <code>sexplib</code>. The syntax extension expects a module <code>Debug_runtime</code> in the scope. <code>minidebug_runtime</code> offers three ways of logging the traces, as functors generating <code>Debug_runtime</code> modules given a file path.</p><p>Take a look at <a href="https://github.com/dariusf/ppx_debug"><code>ppx_debug</code></a> which is significantly more powerful!</p><p>See <a href="http://lukstafi.github.io/ppx_minidebug/minidebug_runtime/Minidebug_runtime/index.html"><code>Minidebug_runtime</code></a> for the provided loggers.</p></header><nav class="odoc-toc"><ul><li><a href="#usage">Usage</a></li><li><a href="#vs-code-suggestions">VS Code suggestions</a><ul><li><a href="#add-/-remove-type-annotations-and-visit-files-using-vocaml">Add / remove type annotations and visit files using <em>VOCaml</em></a></li><li><a href="#visualize-the-flame-graph-using-log-inspector">Visualize the flame graph using <em>Log Inspector</em></a></li><li><a href="#go-to-file-location-using-find-and-transform">Go to file location using <em>Find and Transform</em></a></li></ul></li></ul></nav><div class="odoc-content"><h3 id="usage"><a href="#usage" class="anchor"></a>Usage</h3><p>To trace a function, you have to type-annotate the function result. To trace an argument of a traced function, or a <code>let</code>-binding, you need to type-annotate it. You can control how much gets logged by adding or removing type annotations.</p><p>Tracing only happens in explicitly marked scopes, using the extension points: <code>%debug_pp</code>, <code>%debug_this_pp</code>, <code>%debug_show</code>, <code>%debug_this_show</code> (based on printing functionality provided by <code>deriving.show</code>), <code>%debug_sexp</code>, <code>%debug_this_sexp</code> (using functionality provided by <code>sexplib</code> and <code>ppx_sexp</code>). See examples in <a href="https://github.com/lukstafi/ppx_minidebug/tree/main/test">the test directory</a>.</p><p>The <code>%debug_this</code> variants are intended only for <code>let</code>-bindings: <code>let%debug_this v: t = compute value in body</code> will trace <code>v</code> and the type-annotated bindings and functions inside <code>compute value</code>, but it will not trace <code>body</code>.</p><p>Example setting up a logger printing to the screen:</p><pre class="language-ocaml"><code>module Debug_runtime =
Minidebug_runtime.Flushing(struct let debug_ch = stdout end)
let%debug_show test_logging: string = &quot;Hello World&quot;</code></pre><p>Example setting up a logger printing to a file:</p><pre class="language-ocaml"><code>module Debug_runtime =
Minidebug_runtime.Flushing(
Minidebug_runtime.Debug_ch(struct let filename = &quot;debugger_flushing.log&quot; end))
let%debug_show test_logging: string = &quot;Hello World&quot;</code></pre><h3 id="vs-code-suggestions"><a href="#vs-code-suggestions" class="anchor"></a>VS Code suggestions</h3><h4 id="visualize-the-flame-graph-using-log-inspector"><a href="#visualize-the-flame-graph-using-log-inspector" class="anchor"></a>Visualize the flame graph using <em>Log Inspector</em></h4><p><a href="https://marketplace.visualstudio.com/items?itemName=lukstafi.loginspector-submillisecond">Log Inspector (sub-millisecond)</a>'s main feature is visualizing timestamped logs as flame graphs. To invoke it in VS Code, go to the <code>Minidebug_runtime.Flushing</code>-style logs file, press <em>crtl+shift+P</em>, and execute the command <em>Log Inspector: Draw</em>.</p><p>Note that <a href="https://marketplace.visualstudio.com/items?itemName=lukstafi.loginspector-submillisecond">Log Inspector (sub-millisecond)</a> is a forked variant of the Log Inspector extension.</p><h4 id="go-to-file-location-using-find-and-transform"><a href="#go-to-file-location-using-find-and-transform" class="anchor"></a>Go to file location using <em>Find and Transform</em></h4><p><a href="https://marketplace.visualstudio.com/items?itemName=ArturoDent.find-and-transform">Find and Transform</a> is a powerful VS Code extension, so there might be easier ways to accomplish this, but it gets the job done. I put the following in my `keybindings.json` file (command: <em>Open Keyboard Shortcuts (JSON)</em>):</p><pre class="language-json"><code>{
let%debug_show test_logging: string = &quot;Hello World&quot;</code></pre><h3 id="vs-code-suggestions"><a href="#vs-code-suggestions" class="anchor"></a>VS Code suggestions</h3><h4 id="add-/-remove-type-annotations-and-visit-files-using-vocaml"><a href="#add-/-remove-type-annotations-and-visit-files-using-vocaml" class="anchor"></a>Add / remove type annotations and visit files using <em>VOCaml</em></h4><p><a href="https://marketplace.visualstudio.com/items?itemName=lukstafi.vocaml">VOCaml helpers for coding in OCaml</a> provide commands to add and remove annotations on selected bindings. They can be used to introduce logging, tune it, and cleanup afterward. It also has a command to populate the _Quick Open_ dialog with a file name and location from a line under cursor. It can be used to jump to the source code from a log file.</p><p>Note that you can add and remove type annotations using VSCode OCaml Platform's code actions, and the <em>Find and Transform</em> suggestion below is a more flexible go-to-file solution -- so VOCaml is somewhat redundant. But, it is still valuable: (1) it annotates multiple <code>let</code>-bindings at once in a selection, and (2) it annotates the argument types and the return type of a function (as required by <code>ppx_debug</code>) when invoked on a function definition.</p><h4 id="visualize-the-flame-graph-using-log-inspector"><a href="#visualize-the-flame-graph-using-log-inspector" class="anchor"></a>Visualize the flame graph using <em>Log Inspector</em></h4><p><a href="https://marketplace.visualstudio.com/items?itemName=lukstafi.loginspector-submillisecond">Log Inspector (sub-millisecond)</a>'s main feature is visualizing timestamped logs as flame graphs. To invoke it in VS Code, go to the <code>Minidebug_runtime.Flushing</code>-style logs file, press <em>crtl+shift+P</em>, and execute the command <em>Log Inspector: Draw</em>.</p><p>Note that <a href="https://marketplace.visualstudio.com/items?itemName=lukstafi.loginspector-submillisecond">Log Inspector (sub-millisecond)</a> is a forked variant of the Log Inspector extension.</p><h4 id="go-to-file-location-using-find-and-transform"><a href="#go-to-file-location-using-find-and-transform" class="anchor"></a>Go to file location using <em>Find and Transform</em></h4><p>This will expand your general-purpose VS Code toolbox!</p><p><a href="https://marketplace.visualstudio.com/items?itemName=ArturoDent.find-and-transform">Find and Transform</a> is a powerful VS Code extension. I put the following in my `keybindings.json` file (command: <em>Open Keyboard Shortcuts (JSON)</em>):</p><pre class="language-json"><code>{
&quot;key&quot;: &quot;alt+q&quot;,
&quot;command&quot;: &quot;findInCurrentFile&quot;,
&quot;args&quot;: {
&quot;description&quot;: &quot;Open file at cursor&quot;,
&quot;find&quot;: &quot;\&quot;([^\&quot;]+)\&quot;:([0-9]+)&quot;,
&quot;replace&quot;: [
&quot;run&quot;: [
&quot;$${&quot;,
&quot;vscode.commands.executeCommand('workbench.action.quickOpen', `$1:$2`);&quot;,
&quot;return '\\\&quot;$1\\\&quot;:$2';&quot;,
&quot;const pos = new vscode.Position($2, 0);&quot;,
&quot;const range = new vscode.Range(pos, pos);&quot;,
&quot;const options = {selection: range};&quot;,
&quot;const wsFolderUri = vscode.workspace.workspaceFolders[0].uri;&quot;,
&quot;const uri = await vscode.Uri.joinPath(wsFolderUri, '$1');&quot;,
&quot;await vscode.commands.executeCommand('vscode.open', uri, options);&quot;,

// &quot;await vscode.commands.executeCommand('workbench.action.quickOpen', `$1:$2`);&quot;,
&quot;}$$&quot;,
],
&quot;isRegex&quot;: true,
&quot;restrictFind&quot;: &quot;line&quot;,
}
}</code></pre><p>Then, pressing `alt+q` will open a pre-populated dialog, and `enter` will get me to the file location.</p></div></body></html>
}</code></pre><p>Then, pressing `alt+q` will open a pre-populated dialog, and `enter` will get me to the file location. The file-and-location detection above matches the default one from the <code>Flushing</code> module, you can adjust the <code>find</code> pattern to match other formats.</p></div></body></html>

0 comments on commit 04345f7

Please sign in to comment.