{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/monaco-editor/issues/906","repository_url":"https://api.github.com/repos/Microsoft/monaco-editor","labels_url":"https://api.github.com/repos/Microsoft/monaco-editor/issues/906/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/monaco-editor/issues/906/comments","events_url":"https://api.github.com/repos/Microsoft/monaco-editor/issues/906/events","html_url":"https://github.com/Microsoft/monaco-editor/issues/906","id":328691638,"node_id":"MDU6SXNzdWUzMjg2OTE2Mzg=","number":906,"title":"getModelMarkers not working to get list of errors","user":{"login":"imzubair10","id":17908661,"node_id":"MDQ6VXNlcjE3OTA4NjYx","avatar_url":"https://avatars0.githubusercontent.com/u/17908661?v=4","gravatar_id":"","url":"https://api.github.com/users/imzubair10","html_url":"https://github.com/imzubair10","followers_url":"https://api.github.com/users/imzubair10/followers","following_url":"https://api.github.com/users/imzubair10/following{/other_user}","gists_url":"https://api.github.com/users/imzubair10/gists{/gist_id}","starred_url":"https://api.github.com/users/imzubair10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imzubair10/subscriptions","organizations_url":"https://api.github.com/users/imzubair10/orgs","repos_url":"https://api.github.com/users/imzubair10/repos","events_url":"https://api.github.com/users/imzubair10/events{/privacy}","received_events_url":"https://api.github.com/users/imzubair10/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-01T23:53:38Z","updated_at":"2018-06-02T11:34:05Z","closed_at":null,"author_association":"NONE","body":"I'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. \r\n    \r\n```\r\nupdateEditorText(val) {\r\n            const setModelMarkers = monaco.editor.setModelMarkers;\r\n            monaco.editor.setModelMarkers = (model, owner, markers) => {\r\n                debugger;\r\n                setModelMarkers.call(monaco.editor, model, owner, markers);\r\n                if (markers.length === 0) {\r\n                    this.containsValidationErrors = false;\r\n                    this.setJsonText(val);\r\n                } else {\r\n                    this.containsValidationErrors = true;\r\n                }\r\n            };\r\n        },\r\n```\r\n\r\nI found we can do like\r\n\r\n`monaco.editor.getModelMarkers({}).map(m => m.message).join(', ')`\r\n\r\nbut 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**\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t"},"comment":{"url":"https://api.github.com/repos/Microsoft/monaco-editor/issues/comments/394080450","html_url":"https://github.com/Microsoft/monaco-editor/issues/906#issuecomment-394080450","issue_url":"https://api.github.com/repos/Microsoft/monaco-editor/issues/906","id":394080450,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDA4MDQ1MA==","user":{"login":"rcjsuen","id":15629116,"node_id":"MDQ6VXNlcjE1NjI5MTE2","avatar_url":"https://avatars2.githubusercontent.com/u/15629116?v=4","gravatar_id":"","url":"https://api.github.com/users/rcjsuen","html_url":"https://github.com/rcjsuen","followers_url":"https://api.github.com/users/rcjsuen/followers","following_url":"https://api.github.com/users/rcjsuen/following{/other_user}","gists_url":"https://api.github.com/users/rcjsuen/gists{/gist_id}","starred_url":"https://api.github.com/users/rcjsuen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcjsuen/subscriptions","organizations_url":"https://api.github.com/users/rcjsuen/orgs","repos_url":"https://api.github.com/users/rcjsuen/repos","events_url":"https://api.github.com/users/rcjsuen/events{/privacy}","received_events_url":"https://api.github.com/users/rcjsuen/received_events","type":"User","site_admin":false},"created_at":"2018-06-02T11:34:05Z","updated_at":"2018-06-02T11:34:05Z","author_association":"CONTRIBUTOR","body":"Hi, @imzubair10. This code works fine for me. I see stuff printed in the console.\r\n\r\n```JavaScript\r\n// The Monaco Editor can be easily created, given an\r\n// empty container and an options literal.\r\n// Two members of the literal are \"value\" and \"language\".\r\n// The editor takes the full size of its container.\r\n\r\nlet model = monaco.editor.createModel(\"function hello() {\\n}\", \"javascript\");\r\n\r\nmonaco.editor.create(document.getElementById(\"container\"), {\r\n    model\r\n});\r\n\r\nmonaco.editor.setModelMarkers(model, \"owner\", [\r\n    {\r\n        startLineNumber: 1,\r\n        startColumn: 1,\r\n        endLineNumber: 1,\r\n        endColumn: 2,\r\n        message: \"error\",\r\n        severity: monaco.MarkerSeverity.Error\r\n    }\r\n]);\r\n\r\nconsole.log(monaco.editor.getModelMarkers());\r\n```"}}
{"actor":{"display_login":"rcjsuen"}}