Issues to set Model Markers
See original GitHub issuehow to access setModelMarkers
?
The only way I found to access it was to add the reference to the package monaco-editor
and to call it the following way:
import * as monacoEditor from "monaco-editor/esm/vs/editor/editor.api";
/// blabla
monacoEditor.editor.setModelMarkers(myEditor.getModel(), "ScriptEditor", []);
the pb is that from the moment I make an actual use of monacoEditor.editor in the code, the editor doesn’t behave correctly anymore: ctrl+arrow doesn’t work, syntaxic coloration doesn’t work, autocomplete doesn’t work…
I believe that the import overrides some calls that are done in your version your are exposing, and ruins the behavior. I assume this because even if I make the following I still have the pb:
if(false){
// this will never be called, but still, the compiler feels compelled to integrate
// the code in the final bundle, and that causes the issue as well
monacoEditor.editor.setModelMarkers(myEditor.getModel(), "ScriptEditor", []);
}
here the working/failling example: https://codesandbox.io/s/funny-sara-kbws9?fontsize=14&hidenavigation=1&theme=dark
FYI, I would need to access some types that are necessary, like IStandaloneCodeEditor
, or MarkerSeverity
but it is as well impossible to access it. I think you should expose the full api of monaco, or at least a wrapper for most common features.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
After I run it with @monaco-editor/react, the result is
Check it here
Hello @paillave.
To access
setModelMarkers
you need to access the monaco instance.I think it helps. Thank you!