# Implementing TAB autocompletion in Elixir - Need guidance

**URL:** https://forum.codecrafters.io/t/implementing-tab-autocompletion-in-elixir-need-guidance/15685
**Category:** Challenges
**Tags:** challenge:shell
**Created:** [December 22, 2025, 6:25pm UTC](https://forum.codecrafters.io/t/implementing-tab-autocompletion-in-elixir-need-guidance/15685 "2025-12-22T18:25:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Illuminaxx](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/illuminaxx/32/19931_2.png) [@Illuminaxx](https://forum.codecrafters.io/u/Illuminaxx)
#### Post date: [December 22, 2025, 6:25pm UTC](https://forum.codecrafters.io/t/implementing-tab-autocompletion-in-elixir-need-guidance/15685/1 "2025-12-22T18:25:13Z")

</div>

Hi CodeCrafters team,

I’m working on the Shell challenge using Elixir and I’m stuck on Stage #QP2 (Tab Autocompletion - Builtin completion).

**The Problem:** The test expects TAB autocompletion to work, but Elixir/Erlang doesn’t have native readline support in standalone escripts like Node.js does with its built-in `readline` module.

**What I’ve Tried:**

- `:io.setopts(:standard_io, [expand_fun: &my_func/1])`
- `Application.put_env(:stdlib, :shell_expand_fun, &my_func/1)`
- Manual character-by-character reading with `IO.getn/2`
- Various terminal control sequences (ANSI, backspace, etc.)

None of these approaches work because Erlang’s `expand_fun` only works in an interactive Erlang shell, not in a compiled escript running standalone.

**The Issue:** In JavaScript (as shown in the community solutions), you can use Node.js’s `readline` module with a `completer` function:

javascript

```auto
readline.createInterface({
    completer: (line) => { /* autocomplete logic */ }
});

```

Elixir doesn’t have an equivalent built-in feature. The only solution would be to use an external library like `erlang-readline` or implement a C NIF binding to libreadline.

**My Questions:**

1. Is it expected that Elixir users add external dependencies for this stage?
2. Can I modify `mix.exs` to add `{:erlang-readline, "~> 1.0"}` or similar?
3. Is there a CodeCrafters-specific solution I’m missing?
4. Should I skip this stage for now if no native solution exists?

**Current Test Output:**

```auto
Expected: "$ echo "
Received: "$ ech "

```

The autocompletion function is never triggered because there’s no way to hook into TAB handling in an Elixir escript without external libraries.

Any guidance would be greatly appreciated!

Thanks,  
Illuminaxx

---

<div class="post-metadata">

### Author: ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)
#### Post date: [December 22, 2025, 6:25pm UTC](https://forum.codecrafters.io/t/implementing-tab-autocompletion-in-elixir-need-guidance/15685/2 "2025-12-22T18:25:14Z")

</div>

Hi, thanks for your post!

I’m currently out of the office for the holidays and will be back on January 5. I’ll get back to you as soon as possible once I return.

---

<div class="post-metadata">

### Author: ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)
#### Post date: [May 25, 2026, 8:23am UTC](https://forum.codecrafters.io/t/implementing-tab-autocompletion-in-elixir-need-guidance/15685/5 "2026-05-25T08:23:38Z")

</div>

Hey @Illuminaxx, sorry for the delayed response! Let me know if you’d still like assistance with this.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)
#### Post date: [May 31, 2026, 6:13pm UTC](https://forum.codecrafters.io/t/implementing-tab-autocompletion-in-elixir-need-guidance/15685/7 "2026-05-31T18:13:37Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
