marimo
marimo copied to clipboard
mo.ui.code_editor UI improvements
This is most useful for using Code Editor cells in marimo run (app) mode. Alternative could be making SQL cells available outside marimo edit.
sql_editor = mo.ui.code_editor(
language="sql",
value=placeholder,
# min_height=5, <- 1. this does not do anything
# debounce=True, <- 2. new feature requested
# tab_moves_focus=True <- 3. new feature requested
)
sql_editor = sql_editor.form(label="### SQL Editor") # <- 4. on hitting submit (Ctrl+Enter), new line should not be created in editor
- height option doesn't seem to have an effect
- debounce requested, like in
mo.ui.text - currently Tab changes indentation; with this option, Tab would move focus out of the editor; when
debounce=Truethis would effectively run a query - If using code editor in a form, Submit can be activated by Ctrl+Enter, but it also creates a new line in the editor.
Illustration of app-mode SQL editor
@liquidcarbon - min_height is "minimum height of the code editor in pixels". it works fine for me. 5 is too small for a single line
for the other feature requests, would you be interested in contributing those? i think they are great ideas
Aaaah, I didn't even consider the unit of measure - I assumed it height means number of rows, which is how they have it in Gradio.
Alas I have zero experience with TS, so I'll defer to the experts :)