• Godot Help
  • How do can I get the the current text of the editor from EditorPlugin

I am looking for the equivalent of get_current_script() but to get the text from a .txt file instead of a gd file. Something like a TextEditor. But it is not available/exposed in gdscript. TextEdit does not provide a reference to the Editor interface.

tool extends EditorPlugin

var ef = EditorPlugin.new().get_editor_interface()
var se:ScriptEditor = ef.get_script_editor()
var sc:Script = se.get_current_script()
print(sc.source_code)

I guess that's related to why an EditorPlugin I found in the Asset library uses a .gd file to pass information, rather than a .txt file. I don't have the answer.