Best way to listen to textDocumet events on Theia Extension

Hi,
In my Theia extension i want to listen to text document events such as onDidSaveTextDocument.
How should i do it?

I tried to import the MonacoWorkspace class and use it’s events. it works but i’m not sure if it right. https://github.com/eclipse-theia/theia/blob/master/packages/monaco/src/browser/monaco-workspace.ts#L133

[original thread by DoroNahari]

that’s right