File indexing completed on 2024-05-05 05:52:18
0001 /* This file is part of the Kate project. 0002 * Based on the snippet plugin from KDevelop 4. 0003 * 0004 * SPDX-FileCopyrightText: 2009 Milian Wolff <mail@milianw.de> 0005 * SPDX-FileCopyrightText: 2012 Christoph Cullmann <cullmann@kde.org> 0006 * 0007 * SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 /// TODO: push this into kdevplatform/language/codecompletion so language plugins can reuse it's functionality 0013 0014 #include <QString> 0015 #include <QVariant> 0016 0017 class Snippet; 0018 class SnippetRepository; 0019 class QModelIndex; 0020 0021 namespace KTextEditor 0022 { 0023 class View; 0024 class Range; 0025 class CodeCompletionModel; 0026 } 0027 0028 class SnippetCompletionItem 0029 { 0030 public: 0031 SnippetCompletionItem(Snippet *snippet, SnippetRepository *repo); 0032 ~SnippetCompletionItem(); 0033 0034 void execute(KTextEditor::View *view, const KTextEditor::Range &word); 0035 QVariant data(const QModelIndex &index, int role, const KTextEditor::CodeCompletionModel *model) const; 0036 0037 private: 0038 // we copy since the snippet itself can be deleted at any time 0039 QString m_name; 0040 QString m_snippet; 0041 SnippetRepository *m_repo; 0042 };