this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix site build, merlin hover errors, and mermaid SPA navigation

build-site.sh: Use dune-built worker.js (--no-worker + cp) so the
worker always matches the source tree. Previously jtw compiled against
the installed js_top_worker-web package via ocamlfind, which could be
stale. Also make @site and @doc steps fail on errors instead of
swallowing them.

js_top_worker: Add blank_directives to strip #require lines from source
before sending to merlin. The pre_source context prepends previous cells'
source (including #require directives) which causes Menhir's incremental
parser to throw force_reduction errors.

x-ocaml: Add bounds checking to Typed_enclosings response in
merlin_ext.ml, matching the existing pattern for Errors. Prevents
CodeMirror RangeError when merlin returns positions outside the cell's
document range.

odoc-mermaid-extension: Fix SPA navigation by replacing Js_inline init
script with Js_url support file using MutationObserver pattern. The old
startOnLoad:true approach only worked on full page loads; now mermaid.run()
is called explicitly whenever new pre.mermaid elements appear in the DOM.

site/dune.inc: Regenerated with --warn-error on odoc compile/link/
html-generate, and -L/-P flags for library/package cross-references
from @doc build output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+23
+23
lib/impl.cppo.ml
··· 197 197 (fun c c' -> c <> c' && c' <> ' ') 198 198 (String.to_seq orig) (String.to_seq src) 199 199 200 + (* Replace toplevel directive lines (#require, #use, etc.) with spaces, 201 + preserving byte positions so merlin locations stay correct. *) 202 + let blank_directives src = 203 + let buf = Buffer.create (String.length src) in 204 + let i = ref 0 in 205 + let len = String.length src in 206 + while !i < len do 207 + if src.[!i] = '#' && (!i = 0 || src.[!i - 1] = '\n') then begin 208 + (* Blank out until end of line *) 209 + while !i < len && src.[!i] <> '\n' do 210 + Buffer.add_char buf ' '; 211 + incr i 212 + done 213 + end else begin 214 + Buffer.add_char buf src.[!i]; 215 + incr i 216 + end 217 + done; 218 + Buffer.contents buf 219 + 200 220 let mangle_toplevel is_toplevel orig_source deps = 201 221 let src = 202 222 if not is_toplevel then orig_source ··· 1096 1116 Logs.info (fun m -> m "completing for id: %s" (match id with Some x -> x | None -> "(none)")); 1097 1117 1098 1118 let line1, src = mangle_toplevel is_toplevel source deps in 1119 + let src = blank_directives src in 1099 1120 Logs.info (fun m -> m "line1: '%s' (length: %d)" line1 (String.length line1)); 1100 1121 Logs.info (fun m -> m "src: '%s' (length: %d)" src (String.length src)); 1101 1122 let src = line1 ^ src in ··· 1246 1267 List.filter (fun dep -> not (Environment.is_cell_failed execution_env dep)) deps 1247 1268 in 1248 1269 let line1, src = mangle_toplevel is_toplevel orig_source deps in 1270 + let src = blank_directives src in 1249 1271 let full_source = line1 ^ src in 1250 1272 let source = Merlin_kernel.Msource.make full_source in 1251 1273 let query = ··· 1302 1324 List.filter (fun dep -> not (Environment.is_cell_failed execution_env dep)) deps 1303 1325 in 1304 1326 let line1, src = mangle_toplevel is_toplevel orig_source deps in 1327 + let src = blank_directives src in 1305 1328 let src = line1 ^ src in 1306 1329 let position = 1307 1330 match position with