Swift autocompletion with lldb from CLI

Is there a reason why lldb doesn't provide completions when typing an expression?

Say I have a variable named myAwesomeIvar in the frame lldb has stopped at. Hitting tab after typing po myAwes doesn't give any results but tab after typing v myAwes will complete it to v myAwesomeIvar. Is this by design or is there some setting I can enable?

This is with running lldb bundled with Xcode 11.5 from the command line. Completions work fine using Xcode.

LLDB doesn't offer completions when typing Swift expressions just because it's not implemented (patches are welcome!). The reason why it works in Xcode is that Xcode detects when you are typing an expression and directly provides the completions to you (LLDB is not involved at all in this process). And as a lot of users use LLDB within Xcode, there just isn't an urgent need to implement expression completions for a standalone LLDB.

The reason why v works is that it's not actually a Swift expression but a very simple LLDB-specific language (and providing completions for it is straightforward).

1 Like