File indexing completed on 2024-04-21 15:24:06

0001 /*
0002     SPDX-FileCopyrightText: 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
0003     SPDX-FileCopyrightText: 2008 Niko Sams <niko.sams@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef COMPLETIONHELPERS_H
0009 #define COMPLETIONHELPERS_H
0010 
0011 #include <QStringList>
0012 
0013 #include <language/duchain/types/abstracttype.h>
0014 
0015 #include "phpcompletionexport.h"
0016 
0017 class QString;
0018 class QVariant;
0019 template<class T>
0020 class QList;
0021 
0022 namespace KTextEditor {
0023     class Document;
0024 }
0025 
0026 namespace Php
0027 {
0028 class NormalDeclarationCompletionItem;
0029 
0030 /**
0031  * @param phpTypeHinting set to true if you only want PHP-valid typehinting (i.e. only array and classes)
0032  */
0033 void KDEVPHPCOMPLETION_EXPORT createArgumentList(const NormalDeclarationCompletionItem& item, QString& ret, QList<QVariant>* highlighting, bool phpTypeHinting = false);
0034 
0035 /// get a list of tokens which define a method at the end of the given text
0036 /// NOTE: result will contain "function" if it's the last token at the end of the text
0037 QStringList getMethodTokens(QString text);
0038 
0039 /**
0040  * Get a string representing an indentation.
0041  *
0042  * @param document The current document.
0043  * @returns a QString containing the indentation to be used.
0044  */
0045 const QString KDEVPHPCOMPLETION_EXPORT indentString(KTextEditor::Document *document);
0046 
0047 /**
0048  * Get the indentation of a given line.
0049  *
0050  * You usually want to use it with something like the following:
0051  *
0052  * \code
0053  * const QString indentation = getIndentation( document->line(replaceRange.start().line()) );
0054  * \endcode
0055  */
0056 QString KDEVPHPCOMPLETION_EXPORT getIndentation( const QString &line );
0057 }
0058 
0059 #endif
0060