Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

aiorepl: Add tab completion support.#1081

Open
andrewleech wants to merge 1 commit intomicropython:master from
andrewleech:aiorepl-tab-completion
Open

aiorepl: Add tab completion support. #1081
andrewleech wants to merge 1 commit intomicropython:master from
andrewleech:aiorepl-tab-completion

Conversation

@andrewleech
Copy link
Contributor

@andrewleech andrewleech commented Feb 17, 2026

Summary

Adds tab completion to aiorepl using the new micropython.repl_autocomplete() function exposed in micropython/micropython#17011. Behaviour matches the native REPL: single match inserts the completion, multiple matches prints candidates and redraws the prompt, tab after whitespace inserts 4 spaces for indentation. Falls back gracefully on ports without MICROPY_HELPER_REPL by checking for the function with getattr at startup.

Also uses micropython.stdio_mode_raw() when available (also from #17011) to switch terminal mode around code execution, matching how the native REPL toggles between raw mode for input and cooked mode during exec.

Version bumped to 0.3.0.

Testing

  • test_autocomplete.py + .py.exp added covering the autocomplete API contract, multi-match via __main__ globals injection, and the whitespace-before-cursor indentation logic.
  • Tested interactively on unix port with both single and multiple completions, cursor-in-middle-of-line completion, and tab-as-indentation.

pi-mst reacted with eyes emoji
Use micropython.repl_autocomplete() to provide tab completion matching
the native REPL behavior: single match inserts the completion, multiple
matches prints candidates and redraws the prompt, tab after whitespace
inserts 4 spaces for indentation. Falls back gracefully on ports without
MICROPY_HELPER_REPL.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /