File indexing completed on 2024-05-12 04:39:08
0001 /* 0002 SPDX-FileCopyrightText: 2014 Sergey Kalinichev <kalinichev.so.0@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef INCLUDEPATHCOMPLETIONCONTEXT_H 0008 #define INCLUDEPATHCOMPLETIONCONTEXT_H 0009 0010 #include "duchain/parsesession.h" 0011 #include "clangprivateexport.h" 0012 0013 #include <language/codecompletion/codecompletioncontext.h> 0014 #include <language/util/includeitem.h> 0015 0016 0017 struct KDEVCLANGPRIVATE_EXPORT IncludePathProperties 0018 { 0019 // potentially already existing path to a directory 0020 QString prefixPath; 0021 // whether we look at a i.e. #include "local" 0022 // or a #include <global> include line 0023 bool local = false; 0024 // whether the line actually includes an #include 0025 bool valid = false; 0026 // start offset into @p text where to insert the new item 0027 int inputFrom = -1; 0028 // end offset into @p text where to insert the new item 0029 int inputTo = -1; 0030 0031 static IncludePathProperties parseText(const QString& text, int rightBoundary = -1); 0032 }; 0033 0034 class KDEVCLANGPRIVATE_EXPORT IncludePathCompletionContext : public KDevelop::CodeCompletionContext 0035 { 0036 public: 0037 IncludePathCompletionContext(const KDevelop::DUContextPointer& context, 0038 const ParseSessionData::Ptr& sessionData, 0039 const QUrl& url, 0040 const KTextEditor::Cursor& position, 0041 const QString& text); 0042 0043 QList<KDevelop::CompletionTreeItemPointer> completionItems(bool& abort, bool fullCompletion = true) override; 0044 0045 ~IncludePathCompletionContext() override = default; 0046 0047 private: 0048 QVector<KDevelop::IncludeItem> m_includeItems; 0049 }; 0050 0051 #endif // INCLUDEPATHCOMPLETIONCONTEXT_H