(error, doc)
| 28 | return []; |
| 29 | }; |
| 30 | function getErrorPosition(error, doc) { |
| 31 | let m; |
| 32 | if (m = error.message.match(/at position (\d+)/)) |
| 33 | return Math.min(+m[1], doc.length); |
| 34 | if (m = error.message.match(/at line (\d+) column (\d+)/)) |
| 35 | return Math.min(doc.line(+m[1]).from + (+m[2]) - 1, doc.length); |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | A language provider that provides JSON parsing. |