this repo has no description
0
fork

Configure Feed

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

Fix CodeMirror errors: accumulate output, clamp lint, skip formatter

Three changes to address CodeMirror RangeError and cm-gap issues:

1. jtw_client: Accumulate per-phrase output and emit as single
Top_response at cell end, instead of per-phrase Top_response_at.
Eliminates mid-document widget decorations that cause cm-gap
artifacts in CodeMirror's virtual rendering.

2. merlin_codemirror: Clamp lint diagnostic positions to current
document length. The doc can change between query send and
response arrival (e.g., formatter), making positions stale.

3. cell.ml: Skip formatter for run_on=load cells. The formatter
can change document length, creating changesets that invalidate
decoration positions from concurrent eval responses.

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

+7 -2
+7 -2
src/extension/merlin_codemirror.ml
··· 15 15 let open Fut.Syntax in 16 16 let doc = Utils.get_full_doc @@ Editor.View.state view in 17 17 let+ result = Merlin_client.query_errors worker doc in 18 + (* Re-read doc length — the document may have changed while the 19 + query was in flight (e.g. formatter ran). Clamp positions to 20 + avoid CodeMirror RangeError. *) 21 + let cur_doc = Utils.get_full_doc @@ Editor.View.state view in 22 + let doc_len = String.length cur_doc in 18 23 List.map (fun Protocol.{ kind; loc; main; sub = _; source } -> 19 - let from = loc.loc_start.pos_cnum in 20 - let to_ = loc.loc_end.pos_cnum in 24 + let from = max 0 (min loc.loc_start.pos_cnum doc_len) in 25 + let to_ = max from (min loc.loc_end.pos_cnum doc_len) in 21 26 let source = Protocol.report_source_to_string source in 22 27 let severity = match kind with 23 28 | Report_error