getModelMarkers not working to get list of errors
See original GitHub issueI’m trying to get list of validation errors generated by monaco editor and do some custom operations, my current implementation is working but it’s not an ideal solution, I’m looking for something like where i can use getModelMarkers instead of setModelMarkers which i’m using currently shown below.
updateEditorText(val) {
const setModelMarkers = monaco.editor.setModelMarkers;
monaco.editor.setModelMarkers = (model, owner, markers) => {
debugger;
setModelMarkers.call(monaco.editor, model, owner, markers);
if (markers.length === 0) {
this.containsValidationErrors = false;
this.setJsonText(val);
} else {
this.containsValidationErrors = true;
}
};
},
I found we can do like
monaco.editor.getModelMarkers({}).map(m => m.message).join(', ')
but when i try to use it in my function above instead of setModelMarkers it does’nt work and throws errors. Please suggest How can i use monaco.editor.getModelMarkers
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Getting errors from Monaco editor - Stack Overflow
It looks like you can call monaco.editor.getModelMarkers({}) to get the list of all markers in the document, and then filter that yourself ...
Read more >editor | Monaco Editor API
Create a new diff editor under domElement . domElement should be empty (not contain other dom nodes). The editor will read the size...
Read more >monaco-editor - UNPKG
Therefore `Uri#fsPath` exists - it's sugar to ease working ... 901, export function getModelMarkers(filter: { ... 919, * Get all the created models....
Read more >Warnings are not displayed in the error list
Also sometimes numbers(amounts of errors, warnings and messages) are not correct or updated with a long delay. Visual Studiowindows 10.0editorvisual studio 2019 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed my issue by grabbing the editor off of the window rather than from the
ngx-monaco-editoron-load callback.(<any>window).monaco.editor.getModelMarkers({});Hey @JoshYaxley, good to know that you were able to figure out the fix at your end, just an fyi, my issue is that we’re using older version of Monaco Editor 0.8.2 and this getModelMarkers api is not available in that version