在摩纳哥编辑器中,是否有捕捉格式事件的事件?

In monaco editor, is there an event for catching format event?

cont editor = monaco.editor.create(element, {
            value: text,
            language: mode,
            automaticLayout: true,
            autoIndent: true,
            contextmenu: false,
            formatOnType: true
        });
editor.trigger('any', 'editor.action.formatDocument');

有没有办法将回调传递给触发方法,或者为格式化完成操作捕获事件?

以下语法将 运行 执行操作后的 console.log 语句,使用承诺。

editor.getAction('editor.action.formatDocument').run().then(() => console.log('finished'));

答案来自:

https://github.com/Microsoft/monaco-editor/issues/978