Get active Texteditor (Textdocument)

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

workspace.onDidOpenTextDocument
workspace.textDocuments

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: https://spectrum.chat/theia/dev/programmatic-find-text-pattern-in-active-editor~700c81e2-d5a7-424f-b391-3795ae582eebhttps://spectrum.chat/theia/dev/programmatic-find-textpattern-in-active-editor~700c81e2-d5a7-424f-b391-3795ae582eeb

[javahacks]

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