KTextEditor
codecompletionmodel.h
133 enum HighlightMethod { NoHighlighting = 0x0, InternalHighlighting = 0x1, CustomHighlighting = 0x2 };
166 * is an argument-hint item(@see ArgumentHintDepth). When this role is requested, the item should
167 * be noted, and whenever MatchQuality is requested, it should be computed by matching the item given
170 * Feel free to ignore this, but ideally you should return QVariant::Invalid to make clear that your model does not support this.
186 * - QTextFormat attribute (note: attribute may be a KTextEditor::Attribute, as it is a child class)
206 * This allows items in the completion-list to be expandable. If a model returns an QVariant bool value
207 * that evaluates to true, the completion-widget will draw a handle to expand the item, and will also make
217 * If the model returns a QVariant of type QWidget*, the code-completion takes over the given widget
218 * and embeds it into the completion-list under the completion-item. The widget will be automatically deleted at some point.
219 * The completion-widget will use the height of the widget as a hint for its preferred size, but it will
222 * If the mode returns a QVariant of type QString, it will create a small html-widget showing the given html-code,
244 * Above that, the model may return a QString, which then should then contain html-code. A html-widget
245 * will then be displayed as a one- or two-liner under the currently selected item(it will be partially expanded)
250 * The model should return an integral positive number if the item is an argument-hint, and QVariant() or 0 if it is not one.
255 * all functions named function2 should have ArgumentHintDepth 1, all functions found for function1 should have ArgumentHintDepth 2,
258 * Later, a completed item may then be matched with the first argument of function2, the return-type of function2 with the first
259 * argument-type of function1, and the return-type of function1 with the argument-type of otherFunction.
261 * If the model returns a positive value on this role for a row, the content will be treated specially:
264 * - Match-qualities will be illustrated by differently highlighting the matched argument if possible
265 * The argument-hint list strings will be built from all source-model, with a little special behavior:
266 * Prefix - Should be all text of the function-signature up to left of the matched argument of the function
267 * Name - Should be the type and name of the function's matched argument. This part will be highlighted differently depending on the match-quality
270 * Example: You are matching a function with signature "void test(int param1, int param2)", and you are matching the first argument.
276 * If you don't use the highlighting, matching, etc. you can also return the columns in the usual way.
281 * This will be requested for each item to ask whether it should be included in computing a best-matches list.
282 * If you return a valid positive integer n here, the n best matches will be listed at top of the completion-list separately.
284 * This is expensive because all items of the whole completion-list will be tested for their matching-quality, with each of the level 1
292 * The following three enumeration-values are only used on expanded completion-list items that contain an expanding-widget(@see ExpandingWidget)
296 * AccessibilityNext will be requested on an item if it is expanded, contains an expanding-widget, and the user triggers a special navigation
303 * AccessibilityPrevious will be requested on an item if it is expanded, contains an expanding-widget, and the user triggers a special navigation
304 * short-cut to go to navigate to the previous position within the expanding-widget(if applicable).
310 * AccessibilityAccept will be requested on an item if it is expanded, contains an expanding-widget, and the user triggers a special
311 * shortcut to trigger the action associated with the position within the expanding-widget the user has navigated to using AccessibilityNext and
314 * This should return QVariant(true) if an action was triggered, else QVariant(false) or QVariant().
319 * Using this Role, it is possible to greatly optimize the time needed to process very long completion-lists.
321 * In the completion-list, the items are usually ordered by some properties like argument-hint depth,
322 * inheritance-depth and attributes. Kate usually has to query the completion-models for these values
323 * for each item in the completion-list in order to extract the argument-hints and correctly sort the
324 * completion-list. However, with a very long completion-list, only a very small fraction of the items is actually
327 * 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
333 * - When the inner node is queried for GroupRole, it should return the "ExtraItemDataRoles" that all sub-nodes have in common
340 * This role can also be used to define completely custom groups, bypassing the editors builtin grouping:
343 * - Optional: Return an integer sorting-value when InheritanceDepth is requested. This number will
373 virtual void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType);
385 virtual void executeCompletionItem(KTextEditor::View *view, const Range &word, const QModelIndex &index) const;
397 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:139
@ InheritanceDepth
Returns the inheritance depth of the completion.
Definition codecompletionmodel.h:203
@ GroupRole
Using this Role, it is possible to greatly optimize the time needed to process very long completion-l...
Definition codecompletionmodel.h:348
@ SetMatchContext
Is requested before MatchQuality(..) is requested.
Definition codecompletionmodel.h:172
@ HighlightingMethod
Define which highlighting method will be used:
Definition codecompletionmodel.h:179
@ ItemSelected
Whenever an item is selected, this will be requested from the underlying model.
Definition codecompletionmodel.h:247
@ AccessibilityAccept
AccessibilityAccept will be requested on an item if it is expanded, contains an expanding-widget,...
Definition codecompletionmodel.h:316
@ UnimportantItemRole
Return a nonzero value here to enforce sorting the item at the end of the list.
Definition codecompletionmodel.h:353
@ BestMatchesCount
This will be requested for each item to ask whether it should be included in computing a best-matches...
Definition codecompletionmodel.h:289
@ ScopeIndex
The model should return an index to the scope -1 represents no scope.
Definition codecompletionmodel.h:146
@ ExpandingWidget
After a model returned true for a row on IsExpandable, the row may be expanded by the user.
Definition codecompletionmodel.h:239
@ ArgumentHintDepth
Is this completion-item an argument-hint? The model should return an integral positive number if the ...
Definition codecompletionmodel.h:278
@ AccessibilityNext
The following three enumeration-values are only used on expanded completion-list items that contain a...
Definition codecompletionmodel.h:301
@ MatchQuality
If requested, your model should try to determine whether the completion in question is a suitable mat...
Definition codecompletionmodel.h:162
@ AccessibilityPrevious
AccessibilityPrevious will be requested on an item if it is expanded, contains an expanding-widget,...
Definition codecompletionmodel.h:308
@ IsExpandable
This allows items in the completion-list to be expandable.
Definition codecompletionmodel.h:210
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:20
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 12:03:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 12:03:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.