2.3.5 Idle Completions Mode

Semantic Idle Completions mode is a minor mode for performing code completions during idle time. The completions are displayed inline, with key bindings that allow you to cycle through different alternatives.

Semantic Idle Completions mode performs completion based on the Semantic Analyzer (see Analyzer).

global-semantic-idle-completions-mode: &optional arg

This command toggles Semantic Idle Completions mode in every Semantic-enabled buffer. You can also toggle it via the ‘Show Tag Completions’ menu item in the ‘Development’ menu.

If the tag at point has at least one completion, Semantic Idle Completions mode displays that completion inline—i.e., as part of the buffer text (you can change the display method by customizing semantic-complete-inline-analyzer-idle-displayer-class, as described below). The completed part is highlighted, to indicate that it is not yet properly inserted into the buffer. The echo area shows the completion, and whether there are other possible completions, like this:

besselj [1 of 6 matches]

While the completion is being displayed, the following key bindings take effect:

RET
C-m

Accept the current completion (semantic-complete-inline-done), placing it in the buffer and moving point to the end of the completed tag.

M-n

Select the next possible completion (semantic-complete-inline-down). The new completion is shown inline, replacing the old completion.

M-p

Select the previous possible completion (semantic-complete-inline-up).

TAB
C-i

Accept as much of the completion as possible. If no additional completion can be accepted without ambiguity, select the next possible completion (semantic-complete-inline-TAB).

C-g

Quit without completing (semantic-complete-inline-quit).

You can also exit inline completion by issuing any other Emacs command. The completion text then disappears from the buffer.

Command: semantic-complete-analyze-inline-idle

This is the command for performing inline code completion. It is called by Semantic Idle Completions mode during idle time, but you can also call it yourself. It returns immediately, leaving the buffer in a state for inline completion.

Option: semantic-complete-inline-analyzer-idle-displayer-class

The value of this variable determines how semantic-complete-analyze-inline-idle shows its completions. Possible values include:

semantic-displayer-ghost

Display completions “inline” with the buffer text, as described above. This is the default value.

semantic-displayer-tooltip

Display completions in a tooltip.

semantic-displayer-traditional

Display completions in a separate window.