How to Add a Streamlit Editable Code Editor with Python Syntax Highlighting?

I would recommend streamlit-code-editor if the look you are going for is like st.code but editable (so not exactly like st.text_area). By default, the code editor will return a response when the user presses Ctrl+Enter just like st.text_area.

Here is the current repo where you will find installation instructions and more:

Another option that hasnt been mentioned yet is the Monaco editor: