The Semantic Analyzer can be used to perform code completion in a manner that takes the local context into account. (In addition to the user commands in this section, Semantic Idle Completions mode also uses the Semantic Analyzer. See Idle Completions Mode.)
This is the most basic command for Semantic Analyzer-based completion. Called interactively, it displays a list of the possible completions for the symbol at point.
When called from a Lisp program,
semantic-analyze-possible-completionsdoes not display a completions list. The argument context should be either a buffer position, or a context object. The return value is a list of Semantic tag objects that complete the symbol for context, based on the following criteria:
- Elements currently in scope.
- Constants currently in scope.
- Elements matching the context's
- Type of the completion matching the type of the context.
Most of the other commands documented in this section call
This command is bound to C-c , <SPC> when Semantic mode is enabled (see Semantic mode user commands). It displays a list of possible completions for the symbol at point, and activates a special set of keybindings for choosing a completion.
You can type <RET> to accept the current completion, M-n and M-p to cycle through the possible completions, <TAB> to complete as far as possible and then cycle through completions, and either C-g or any other key to abort the completion.
This command is similar to the completion performed by Semantic Idle Completions mode. The main difference is that it is called explicitly, whereas Semantic Idle Completions mode completes during idle time (see Idle Completions Mode).
The value of this variable determines how
semantic-complete-analyze-inlineshows its completions. Possible values include:
- Display completions in a separate window. This is the default value.
- Display completions “inline” with the buffer text, similar to the default behavior of Semantic Idle Completions mode (see Idle Completions Mode).
- Display completions in a tooltip.
In addition to
semantic-complete-analyze-inline, you can use
the simpler command
semantic-ia-complete-symbol point. This
behaves like the usual M-<TAB> (
command (see Symbol Completion), except it
uses the Semantic Analyzer.