Open SSlippa opened 4 months ago
could you please share a code snippet, I want to see how you try to get getModelMarkers()
@suren-atoyan sure, as you see here, only onDidChangeModelContent() event is working as expected I have tried different ways, but if I check what is inside the object, those methods do not exist
loader.init().then((monaco: Monaco) => {
this.monacoEditor = monaco.editor.create(this.editorElement.nativeElement, {
value: this.cssString,
language: 'css',
theme: 'vs',
});
this.monacoEditor.onDidChangeModelContent(() => {
// HERE IT WORKS
});
this.monacoEditor.getModelMarkers(() => {
// DOES NOT WORK
});
this.monacoEditor.onDidChangeMarkers(() => {
// DOES NOT WORK
});
});
UPDATE: Found a way, how it supposed to work
this.monacoEditor.editor.onDidChangeMarkers(() => {
// We have to provide an owner to getModelMarkers(), that is doing a job
const updatedMarkers = monaco.editor.getModelMarkers({ owner: 'css' });
console.log('Updated markers:', updatedMarkers);
});
I am trying to get makers to have some aside validation but somehow it does not exist on the
editor
object. However, it exists in the editor API, any solution or explanation would be useful Using @monaco-editor/loader v 1.4.0Thanks