looking quickly through the code, I was able to come up with this solution. I’m sure there are better ones, but they are probably a bit more involved:
const editorWidget = open(this.openService, uri);
if (editorWidget instanceof EditorWidget) { // You could also cast here, but using instanceof is safer
const editor = editorWidget.editor;
if (editor instanceof MonacoEditor) { // You could also cast here, but using instanceof is safer
const standaloneMonacoEditor = (editor as any).editor // Gets the actual monaco editor. It is protected, so we have to cast to any beforehand
standaloneMonacoEditor.updateOptions({ readOnly: true })
}
}