marimo-team/marimo

mo.ui.code_editor UI improvements

Opened this issue · 3 comments

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
  1. height option doesn't seem to have an effect
  2. debounce requested, like in mo.ui.text
  3. currently Tab changes indentation; with this option, Tab would move focus out of the editor; when debounce=True this would effectively run a query
  4. 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

Image

@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 :)