Get active Texteditor (Textdocument)

What is the best way to get the currently active text editor in an extension? I know about


but none of these helped. There seems to be a property in the plugin API (window.activeTextEditor) but how can I access it in an extension?

[original thread by javahacks]

@javahacks if you are developing a theia extension then you cannot use the plugin api. Instead, you should use the underlying logic and APIs (provided by other theia extensions) to achieve your goal. In your case, if you want the active text document then you should follow something similar to this previous answer:


Hi Vince, your answer helped me to find the class EditorManager that provides all necessary methods. Thank you!