KTextEditor
codecompletionmodel.h
170 * is an argument-hint item(@see ArgumentHintDepth). When this role is requested, the item should
171 * be noted, and whenever MatchQuality is requested, it should be computed by matching the item given
174 * Feel free to ignore this, but ideally you should return QVariant::Invalid to make clear that your model does not support this.
190 * - QTextFormat attribute (note: attribute may be a KTextEditor::Attribute, as it is a child class)
210 * This allows items in the completion-list to be expandable. If a model returns an QVariant bool value
211 * that evaluates to true, the completion-widget will draw a handle to expand the item, and will also make
221 * If the model returns a QVariant of type QWidget*, the code-completion takes over the given widget
222 * and embeds it into the completion-list under the completion-item. The widget will be automatically deleted at some point.
223 * The completion-widget will use the height of the widget as a hint for its preferred size, but it will
226 * If the mode returns a QVariant of type QString, it will create a small html-widget showing the given html-code,
248 * Above that, the model may return a QString, which then should then contain html-code. A html-widget
249 * will then be displayed as a one- or two-liner under the currently selected item(it will be partially expanded)
254 * The model should return an integral positive number if the item is an argument-hint, and QVariant() or 0 if it is not one.
259 * all functions named function2 should have ArgumentHintDepth 1, all functions found for function1 should have ArgumentHintDepth 2,
262 * Later, a completed item may then be matched with the first argument of function2, the return-type of function2 with the first
263 * argument-type of function1, and the return-type of function1 with the argument-type of otherFunction.
265 * If the model returns a positive value on this role for a row, the content will be treated specially:
268 * - Match-qualities will be illustrated by differently highlighting the matched argument if possible
269 * The argument-hint list strings will be built from all source-model, with a little special behavior:
270 * Prefix - Should be all text of the function-signature up to left of the matched argument of the function
271 * Name - Should be the type and name of the function's matched argument. This part will be highlighted differently depending on the match-quality
274 * Example: You are matching a function with signature "void test(int param1, int param2)", and you are matching the first argument.
280 * If you don't use the highlighting, matching, etc. you can also return the columns in the usual way.
285 * This will be requested for each item to ask whether it should be included in computing a best-matches list.
286 * If you return a valid positive integer n here, the n best matches will be listed at top of the completion-list separately.
288 * This is expensive because all items of the whole completion-list will be tested for their matching-quality, with each of the level 1
296 * The following three enumeration-values are only used on expanded completion-list items that contain an expanding-widget(@see ExpandingWidget)
300 * AccessibilityNext will be requested on an item if it is expanded, contains an expanding-widget, and the user triggers a special navigation
307 * AccessibilityPrevious will be requested on an item if it is expanded, contains an expanding-widget, and the user triggers a special navigation
308 * short-cut to go to navigate to the previous position within the expanding-widget(if applicable).
314 * AccessibilityAccept will be requested on an item if it is expanded, contains an expanding-widget, and the user triggers a special
315 * shortcut to trigger the action associated with the position within the expanding-widget the user has navigated to using AccessibilityNext and
318 * This should return QVariant(true) if an action was triggered, else QVariant(false) or QVariant().
323 * Using this Role, it is possible to greatly optimize the time needed to process very long completion-lists.
325 * In the completion-list, the items are usually ordered by some properties like argument-hint depth,
326 * inheritance-depth and attributes. Kate usually has to query the completion-models for these values
327 * for each item in the completion-list in order to extract the argument-hints and correctly sort the
328 * completion-list. However, with a very long completion-list, only a very small fraction of the items is actually
331 * By using a tree structure you can give the items in a grouped order to kate, so it does not need to look at each
337 * - When the inner node is queried for GroupRole, it should return the "ExtraItemDataRoles" that all sub-nodes have in common
344 * This role can also be used to define completely custom groups, bypassing the editors builtin grouping:
347 * - Optional: Return an integer sorting-value when InheritanceDepth is requested. This number will
381 virtual void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType);
393 virtual void executeCompletionItem(KTextEditor::View *view, const Range &word, const QModelIndex &index) const;
405 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
An item model for providing code completion, and meta information for enhanced presentation.
Definition codecompletionmodel.h:68
void hasGroupsChanged(KTextEditor::CodeCompletionModel *model, bool hasGroups)
Internal.
void waitForReset()
Emit this if the code-completion for this model was invoked, some time is needed in order to get the ...
HighlightMethod
Definition codecompletionmodel.h:133
CompletionProperty
Definition codecompletionmodel.h:89
ExtraItemDataRoles
Meta information is passed through extra {Qt::ItemDataRole}s.
Definition codecompletionmodel.h:143
@ InheritanceDepth
Returns the inheritance depth of the completion.
Definition codecompletionmodel.h:207
@ GroupRole
Using this Role, it is possible to greatly optimize the time needed to process very long completion-l...
Definition codecompletionmodel.h:352
@ SetMatchContext
Is requested before MatchQuality(..) is requested.
Definition codecompletionmodel.h:176
@ HighlightingMethod
Define which highlighting method will be used:
Definition codecompletionmodel.h:183
@ ItemSelected
Whenever an item is selected, this will be requested from the underlying model.
Definition codecompletionmodel.h:251
@ AccessibilityAccept
AccessibilityAccept will be requested on an item if it is expanded, contains an expanding-widget,...
Definition codecompletionmodel.h:320
@ UnimportantItemRole
Return a nonzero value here to enforce sorting the item at the end of the list.
Definition codecompletionmodel.h:357
@ BestMatchesCount
This will be requested for each item to ask whether it should be included in computing a best-matches...
Definition codecompletionmodel.h:293
@ ScopeIndex
The model should return an index to the scope -1 represents no scope.
Definition codecompletionmodel.h:150
@ ExpandingWidget
After a model returned true for a row on IsExpandable, the row may be expanded by the user.
Definition codecompletionmodel.h:243
@ ArgumentHintDepth
Is this completion-item an argument-hint? The model should return an integral positive number if the ...
Definition codecompletionmodel.h:282
@ AccessibilityNext
The following three enumeration-values are only used on expanded completion-list items that contain a...
Definition codecompletionmodel.h:305
@ MatchQuality
If requested, your model should try to determine whether the completion in question is a suitable mat...
Definition codecompletionmodel.h:166
@ AccessibilityPrevious
AccessibilityPrevious will be requested on an item if it is expanded, contains an expanding-widget,...
Definition codecompletionmodel.h:312
@ IsExpandable
This allows items in the completion-list to be expandable.
Definition codecompletionmodel.h:214
An object representing a section of text, from one Cursor to another.
Definition include/ktexteditor/range.h:49
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition katetextblock.h:18
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:56:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:56:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.