For reference:
https://discourse.slicer.org/t/support-python-text-highlighting-in-text-module/34511
and
https://projectweek.na-mic.org/PW41_2024_MIT/Projects/SimpleEditorForPythonScripting/
Regarding integration with the scene, I suggest we start just by using Text nodes, since those are already exist. I could make sense to have a subclass that does some “scripty” things, but I don’t think that’s needed now. We could have a node attribute that flags script nodes as a kind of text node to be handled specially, e.g. to always save in a file rather than in the xml.
But I’m still not convinced that mixing code and data is a good architecture. Usually we try to have scripts that are generic and can be applied to any data rather than having data-specific scripts. Perhaps for demos or training though having everything in the scene can make sense so I suggest we play with it and maybe add more features before deciding about any changes to the core.
Also can we put this in the extension manager now so it’s easier for people to discover and try?