File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -191,13 +191,22 @@ let createEditor = %raw(`
191191 return errorsArray .map (err => {
192192 try {
193193 const doc = view .state .doc ;
194- // Validate line numbers (1-based to 0-based conversion)
194+ // Error row/endRow are 1-based (same as CodeMirror 5)
195+ // Validate line numbers are within document bounds
195196 const fromLine = Math .max (1 , Math .min (err .row , doc .lines ));
196197 const toLine = Math .max (1 , Math .min (err .endRow , doc .lines ));
197198
199+ // Get line objects
200+ const startLine = doc .line (fromLine);
201+ const endLine = doc .line (toLine);
202+
203+ // Validate column positions are within line bounds
204+ const fromCol = Math .max (0 , Math .min (err .column , startLine .length ));
205+ const toCol = Math .max (0 , Math .min (err .endColumn , endLine .length ));
206+
198207 return {
199- from: doc . line (fromLine). from + err . column ,
200- to: doc . line (toLine). from + err . endColumn ,
208+ from: startLine . from + fromCol ,
209+ to: endLine . from + toCol ,
201210 severity: err .kind === 0 ? " error" : " warning" ,
202211 message: err .text
203212 };
You can’t perform that action at this time.
0 commit comments