KTextEditor
katescriptmanager.cpp
58 if (highestPriorityIndenter && indenter->indentHeader().priority() < highestPriorityIndenter->indentHeader().priority()) {
60 qCDebug(LOG_KTE) << "Not overwriting indenter for" << language << "as the priority isn't big enough (" << indenter->indentHeader().priority() << '<'
121 // this will not allow global stuff to overwrite the stuff we ship in our resources to allow to install a more up-to-date ktexteditor lib locally!
122 const auto genericDataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
135 // iterate through the files and read info out of cache or file, no double loading of same scripts
160 qCDebug(LOG_KTE) << "Script parse error: Cannot find start of json header at start of file " << qPrintable(fileName) << '\n';
169 qCDebug(LOG_KTE) << "Script parse error: Cannot find end of json header at start of file " << qPrintable(fileName) << '\n';
176 const QJsonDocument metaInfo(QJsonDocument::fromJson(fileContent.mid(startOfJson, endOfJson - startOfJson), &error));
178 qCDebug(LOG_KTE) << "Script parse error: Cannot parse json header at start of file " << qPrintable(fileName) << error.errorString() << endOfJson
207 qCDebug(LOG_KTE) << "Script value error: No name specified in script meta data: " << qPrintable(fileName) << '\n'
213 indentHeader.setRequiredStyle(metaInfoObject.value(QStringLiteral("required-syntax-style")).toString());
215 QStringList indentLanguages = jsonToStringList(metaInfoObject.value(QStringLiteral("indent-languages")));
223 << "script " << qPrintable(fileName) << ". Using the name (" << qPrintable(indentHeader.name()) << ")\n";
241 commandHeader.setFunctions(jsonToStringList(metaInfoObject.value(QStringLiteral("functions"))));
244 qCDebug(LOG_KTE) << "Script value error: No functions specified in script meta data: " << qPrintable(fileName) << '\n'
255 qCDebug(LOG_KTE) << "Script value warning: Unknown type ('" << qPrintable(type) << "'): " << qPrintable(fileName) << '\n';
263 qCDebug(LOG_KTE) << "Python: " << indenter("Python")->global("triggerCharacters").isValid() << "\n";
264 qCDebug(LOG_KTE) << "Python: " << indenter("Python")->function("triggerCharacters").isValid() << "\n";
285bool KateScriptManager::exec(KTextEditor::View *view, const QString &_cmd, QString &errorMsg, const KTextEditor::Range &)
290 const QList<QStringView> args = QStringView(_cmd).split(QRegularExpression(QStringLiteral("\\s+")), Qt::SkipEmptyParts);
An object representing a section of text, from one Cursor to another.
Definition include/ktexteditor/range.h:49
A specialized class for scripts that are of type ScriptType::Indentation.
Definition katecommandlinescript.h:55
A specialized class for scripts that are of type ScriptType::Indentation.
Definition kateindentscript.h:102
Manage the scripts on disks – find them and query them.
Definition katescriptmanager.h:27
bool exec(KTextEditor::View *view, const QString &cmd, QString &errorMsg, const KTextEditor::Range &) override
execute command
Definition katescriptmanager.cpp:285
void reloaded()
this signal is emitted when all scripts are deleted and reloaded again.
KateIndentScript * indenter(const QString &language)
Get an indentation script for the given language – if there is more than one result,...
Definition katescriptmanager.cpp:52
bool help(KTextEditor::View *view, const QString &cmd, QString &msg) override
get help for a command
Definition katescriptmanager.cpp:305
QJSValue global(const QString &name)
Get a QJSValue for a global item in the script given its name, or an invalid QJSValue if no such glob...
Definition katescript.cpp:73
void setGeneralHeader(const KateScriptHeader &generalHeader)
set the general header after construction of the script
Definition katescript.cpp:235
QJSValue function(const QString &name)
Return a function in the script of the given name, or an invalid QJSValue if no such function exists.
Definition katescript.cpp:82
QString i18n(const char *text, const TYPE &arg...)
KIOCORE_EXPORT QStringList list(const QString &fileClass)
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition katetextblock.h:18
qsizetype indexOf(QByteArrayView bv, qsizetype from) const const
QByteArray mid(qsizetype pos, qsizetype len) const const
QByteArray & replace(QByteArrayView before, QByteArrayView after)
QStringList entryList(Filters filters, SortFlags sort) const const
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
QString baseName() const const
void clear()
iterator insert(const Key &key, const T &value)
T value(const Key &key) const const
QByteArray readAll()
ReadOnly
QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error)
bool isObject() const const
QJsonObject object() const const
QJsonValue value(QLatin1StringView key) const const
bool isString() const const
QJsonArray toArray() const const
QString toString() const const
void append(QList< T > &&value)
void clear()
T & first()
bool isEmpty() const const
void push_back(parameter_type value)
Q_EMITQ_EMIT
bool contains(const QSet< T > &other) const const
iterator insert(const T &value)
GenericDataLocation
QStringList standardLocations(StandardLocation type)
QString writableLocation(StandardLocation type)
bool isNull() const const
QString toLower() const const
QList< QStringView > split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
SkipEmptyParts
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:53:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:53:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.