KTextEditor
#include <codecompletioninterface.h>
Public Member Functions | |
virtual | ~CodeCompletionInterface () |
virtual void | abortCompletion ()=0 |
virtual void | forceCompletion ()=0 |
virtual bool | isAutomaticInvocationEnabled () const =0 |
virtual bool | isCompletionActive () const =0 |
virtual void | registerCompletionModel (CodeCompletionModel *model)=0 |
virtual void | setAutomaticInvocationEnabled (bool enabled=true)=0 |
virtual void | startCompletion (const Range &word, CodeCompletionModel *model)=0 |
virtual void | unregisterCompletionModel (CodeCompletionModel *model)=0 |
Detailed Description
Code completion extension interface for the View.
Introduction
The CodeCompletionInterface is designed to provide code completion functionality for a KTextEditor::View. This interface provides the basic mechanisms to display a list of completions, update this list according to user input, and allow the user to select a completion.
Essentially, this provides an item view for the available completions. In order to use this interface, you will need to implement a CodeCompletionModel that generates the relevant completions given the current input.
Accessing the CodeCompletionInterface
The CodeCompletionInterface is an extension interface for a View, i.e. the View inherits the interface provided that the used KTextEditor library implements the interface. Use qobject_cast to access the interface:
Using the CodeCompletionInterface
The CodeCompletionInterface can be used in different ways, which we will call "automatic", and "manual".
Automatic
In automatic mode, the CodeCompletionInterface will take care of starting and aborting the generation of code completions as appropriate, when the users inserts or changes text.
To use the interface in this way, first register a CodeCompletionModel using registerCompletionModel(). Now call setAutomaticCompletionEnabled() to enabled automatic completions.
Manual
If you need more control over when code completions get shown or not, or which fragment of the text should be considered as the basis for generated completions, proceed as follows:
Call setAutomaticCompletionEnabled(false) to disable automatic completions. To start the generation of code completions for the current word, call startCompletion(), with the appropriate parameters. To hide the generated completions, use abortCompletion().
Definition at line 92 of file codecompletioninterface.h.
Constructor & Destructor Documentation
|
virtual |
Definition at line 23 of file codecompletioninterface.cpp.
Member Function Documentation
|
pure virtual |
Abort the currently displayed code completion without executing any currently selected completion.
This is safe, even when the completion box is not currently active.
- See also
- isCompletionActive()
|
pure virtual |
Force execution of the currently selected completion, and hide the code completion box.
|
pure virtual |
Determine the status of automatic code completion invocation.
|
pure virtual |
Query whether the code completion box is currently displayed.
|
pure virtual |
Register a new code completion model
.
- Parameters
-
model new completion model
- See also
- unregisterCompletionModel()
|
pure virtual |
Enable or disable automatic code completion invocation.
|
pure virtual |
Invoke code completion over a given range, with a specific model.
|
pure virtual |
Unregister a code completion model
.
- Parameters
-
model the model that should be unregistered
- See also
- registerCompletionModel()
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:27:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.