File indexing completed on 2024-05-12 04:39:08

0001 /*
0002     SPDX-FileCopyrightText: 2014 Milian Wolff <mail@milianw.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #ifndef CLANGCODECOMPLETIONMODEL_H
0008 #define CLANGCODECOMPLETIONMODEL_H
0009 
0010 #include <language/codecompletion/codecompletionmodel.h>
0011 
0012 #include "clangprivateexport.h"
0013 
0014 class ClangIndex;
0015 
0016 class KDEVCLANGPRIVATE_EXPORT ClangCodeCompletionModel : public KDevelop::CodeCompletionModel
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit ClangCodeCompletionModel(ClangIndex* index, QObject* parent);
0022     ~ClangCodeCompletionModel() override;
0023 
0024     bool shouldStartCompletion(KTextEditor::View* view, const QString& inserted,
0025                                bool userInsertion, const KTextEditor::Cursor& position) override;
0026 
0027     KTextEditor::Range completionRange(KTextEditor::View* view, const KTextEditor::Cursor& position) override;
0028 
0029     bool shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range& range, const QString& currentCompletion) override;
0030 
0031 Q_SIGNALS:
0032     void requestCompletion(const QUrl &url, const KTextEditor::Cursor& cursor, const QString& text, const QString& followingText);
0033 
0034 protected:
0035     KDevelop::CodeCompletionWorker* createCompletionWorker() override;
0036 
0037     void completionInvokedInternal(KTextEditor::View* view, const KTextEditor::Range& range,
0038                                    InvocationType invocationType, const QUrl &url) override;
0039 
0040 private:
0041     ClangIndex* m_index;
0042 };
0043 
0044 #endif // CLANGCODECOMPLETIONMODEL_H