monaco-editor: SetModelMarkers shows "Undefined" as error message
Hi, I am using “setModelMarkers()” to highlight the syntax errors in Monaco editor for my custom language. The message added to the marker is not getting displayed on hovering over the highlighted text.
{
code: null,
source: null,
severity: 3,
startLineNumber: 1,
startColumn: 1,
endLineNumber: 1,
endColumn: 4 + 1,
message: 'Syntax error\n'
}
The message always shows as “undefined”.
Please let me know if any thing is missed or done wrong.
monaco-editor version: 0.11.1 Browser: Chrome OS: win 7
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 21 (8 by maintainers)
Commits related to this issue
- Revert monaco-editor version Because of a few bugs in the new version: https://github.com/Microsoft/monaco-editor/issues/772 https://github.com/Microsoft/monaco-editor/issues/790 — committed to gentics/mesh-ui by deleted user 6 years ago
- Fixed 'undefined' error message in mapper editor. Error was caused due to discrepancies between zone.js and monaco editor Promise.all implementation. Added polyfill patch for short term solution. Tr... — committed to project-flogo/flogo-web by fcastill 6 years ago
- Fixed 'undefined' error message in mapper editor. Error was caused due to discrepancies between zone.js and monaco editor Promise.all implementation. Added polyfill patch for short term solution. Tr... — committed to project-flogo/flogo-web by fcastill 6 years ago
- Fix ZoneAwarePromise.all to resolve at the correct time (#1150) For ZoneAwarePromise.all, as [implemented](https://github.com/angular/zone.js/blob/7201d44451f6c67eac2b86eca3cbfafde14035d6/lib/common/... — committed to angular/zone.js by trevorade 6 years ago
I have similar “undefined” issue with a bit different steps but I think root cause is the same.
This example from monaco playground when running from Angular 5 application produces “undefined” when you hover over warning on enum value, other warnings like “Missing property XXX” are affected too.
Issue is happening when signalInnerHTML is executed which triggers Promise.all resolving above it.
But the issue is actually on Angular’s Zone.js side as it re-defines promises. It has to be fixed in Promise.all definition, index/count mismatch is happening in monaco-editor case.
The only workaround I have for now is by redefining Promise.all with a fix locally (e.g. within polyfills.ts)
This works fine for me:
@jrieken I see that removal of WinJS.Promise is an epic you’re working on. Would you be open to a PR fixing this issue specifically? Changing MarkdownRenderer.getOptions’ codeBlockRenderer to return a native promise? Or perhaps ModeServiceImpl._onReady to use Promise.resolve(true) instead of WinJS.Promise.as(true) ?
@taras-mytofir . Can you suggest a solution to work around this ? . I am using monaco-edtior version 0.13 with angular 5 and face the same issue