KTextEditor

katekeywordcompletion.h
1/*
2 SPDX-FileCopyrightText: 2014 Sven Brauch <svenbrauch@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATEKEYWORDCOMPLETIONMODEL_H
8#define KATEKEYWORDCOMPLETIONMODEL_H
9
10#include "codecompletionmodelcontrollerinterface.h"
11#include "ktexteditor/codecompletionmodel.h"
12
13/**
14 * @brief Highlighting-file based keyword completion for the editor.
15 *
16 * This model offers completion of language-specific keywords based on information
17 * taken from the kate syntax files. It queries the highlighting engine to get the
18 * correct context for a given cursor position, then suggests all keyword items
19 * from the XML file for the active language.
20 */
22{
25
26public:
28 QVariant data(const QModelIndex &index, int role) const override;
29 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
30 QModelIndex parent(const QModelIndex &index) const override;
31 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
32 void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType) override;
34 bool shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString &currentCompletion) override;
35 bool shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position) override;
36 MatchReaction matchingItem(const QModelIndex &matched) override;
37 bool shouldHideItemsWithEqualNames() const override;
38
39private:
40 QList<QString> m_items;
41};
42
43#endif // KATEKEYWORDCOMPLETIONMODEL_H
44
45// kate: indent-width 4; replace-tabs on
An item model for providing code completion, and meta information for enhanced presentation.
The Cursor represents a position in a Document.
Definition cursor.h:75
An object representing a section of text, from one Cursor to another.
A text widget with KXMLGUIClient that represents a Document.
Definition view.h:244
Highlighting-file based keyword completion for the editor.
void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType) override
This function is responsible to generating / updating the list of current completions.
bool shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position) override
This function decides if the automatic completion should be started when the user entered some text.
bool shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString &currentCompletion) override
This function decides if the completion should be aborted.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Reimplemented from QAbstractItemModel::index().
KTextEditor::Range completionRange(KTextEditor::View *view, const KTextEditor::Cursor &position) override
This function returns the completion range that will be used for the current completion.
MatchReaction matchingItem(const QModelIndex &matched) override
Called whenever an item in the completion-list perfectly matches the current filter text.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Reimplemented from QAbstractItemModel::rowCount().
bool shouldHideItemsWithEqualNames() const override
When multiple completion models are used at the same time, it may happen that multiple models add ite...
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:15:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.