Best way to listen to textDocumet events on Theia Extension

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.

[original thread by DoroNahari]

that’s right