I would like to get hold of the errors created by default by Monaco editor.

It looks like you can call monaco.editor.getModelMarkers({}) to get the list of all markers in the document, and then filter that yourself to limit it to the errors you're interested in. I would prefer a more clearly-documented route, but in my ad-hoc testing this works.
This is a simple sample to log errors:
import * as monaco from 'monaco-editor'
// ...
monaco.editor.onDidChangeMarkers(([uri]) => {
const markers = monaco.editor.getModelMarkers({resource: uri})
console.log('markers:', markers.map(
({ message, startLineNumber, startColumn, endLineNumber, endColumn }) =>
`${message} [${startLineNumber}:${startColumn}-${endLineNumber}:${endColumn}]`,
))
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With