Skip to content

fix(editor): restore python auto-indent by removing custom ipython indent service#727

Merged
rgbkrk merged 1 commit intomainfrom
quill/fix-python-indent
Mar 12, 2026
Merged

fix(editor): restore python auto-indent by removing custom ipython indent service#727
rgbkrk merged 1 commit intomainfrom
quill/fix-python-indent

Conversation

@rgbkrk
Copy link
Member

@rgbkrk rgbkrk commented Mar 12, 2026

When IPython magic support (%%html, %%bash, etc.) was added, a custom indent service was included to prevent indentation after magic lines. However, this broke standard Python indentation — pressing Enter after "class Thing:" or "def foo():" no longer indented the next line.

The custom service attempted to fall back to CodeMirror's Python indentation by returning null, but this fallback wasn't working correctly. Rather than trying to calculate indentation manually (error-prone), we now rely entirely on CodeMirror's Python indentation logic.

Trade-off: Magic lines may now indent when they shouldn't, but this is preferable to breaking regular Python code indentation.

Verification

  • Type class Thing: + Enter → next line is indented 4 spaces
  • Type def foo(): + Enter → next line is indented 4 spaces
  • Type if True: + Enter → next line is indented 4 spaces
  • Test nested indentation: inside a function, type for i in range(10): + Enter → indents further

PR submitted by @rgbkrk's agent, Quill

…dent service

When IPython magic support (%%html, %%bash, etc.) was added, a custom indent
service was included to prevent indentation after magic lines. However, this
broke standard Python indentation — pressing Enter after "class Thing:" or
"def foo():" no longer indented the next line.

The custom service was returning null to fall back to Python's tree-based
indentation, but this fallback wasn't working correctly. Rather than trying
to calculate indentation manually (error-prone), we now rely entirely on
CodeMirror's Python indentation logic.

Trade-off: Magic lines may now indent when they shouldn't, but this is
preferable to breaking regular Python code indentation.
@rgbkrk rgbkrk merged commit 5db3d83 into main Mar 12, 2026
6 checks passed
@rgbkrk rgbkrk deleted the quill/fix-python-indent branch March 12, 2026 19:02
@rgbkrk rgbkrk mentioned this pull request Mar 12, 2026
48 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant