Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
QQmlLSCompletion provides completions for all kinds of QML and JS constructs. More...
#include <qqmllscompletion_p.h>
Public Types | |
using | CompletionItem = QLspSpecification::CompletionItem |
using | BackInsertIterator = std::back_insert_iterator<QList<CompletionItem>> |
Public Member Functions | |
QQmlLSCompletion (const QFactoryLoader &pluginLoader) | |
QList< CompletionItem > | completions (const DomItem ¤tItem, const CompletionContextStrings &ctx) const |
Static Public Member Functions | |
static CompletionItem | makeSnippet (QUtf8StringView qualifier, QUtf8StringView label, QUtf8StringView insertText) |
static CompletionItem | makeSnippet (QUtf8StringView label, QUtf8StringView insertText) |
QQmlLSCompletion provides completions for all kinds of QML and JS constructs.
Use the \l{completions} method to obtain completions at a certain DomItem.
All the other methods in this class are helper methods: some compute completions for specific QML and JS constructs and some are shared between multiple QML or JS constructs to avoid code duplication. Most of the helper methods add their completion items via a BackInsertIterator.
Some helper methods are called "suggest*" and will try to suggest code that does not exist yet. For example, any JS statement can be expected inside a Blockstatement so suggestJSStatementCompletion() is used to suggest JS statements inside of BlockStatements. Another example might be suggestReachableTypes() that will suggest Types for type annotations, attached types or Qml Object hierarchies, or suggestCaseAndDefaultStatementCompletion() that will only suggest "case" and "default" clauses for switch statements.
Some helper methods are called "inside*" and will try to suggest code inside an existing structure. For example, insideForStatementCompletion() will try to suggest completion for the different code pieces initializer, condition, increment and statement that exist inside of: \badcode for(initializer; condition; increment) statement
Definition at line 36 of file qqmllscompletion_p.h.
using QQmlLSCompletion::BackInsertIterator = std::back_insert_iterator<QList<CompletionItem>> |
Definition at line 43 of file qqmllscompletion_p.h.
using QQmlLSCompletion::CompletionItem = QLspSpecification::CompletionItem |
Definition at line 42 of file qqmllscompletion_p.h.
QQmlLSCompletion::QQmlLSCompletion | ( | const QFactoryLoader & | pluginLoader | ) |
Definition at line 1842 of file qqmllscompletion.cpp.
QList< CompletionItem > QQmlLSCompletion::completions | ( | const DomItem & | currentItem, |
const CompletionContextStrings & | contextStrings ) const |
Decide which completions can be used at currentItem and compute them.
Definition at line 1639 of file qqmllscompletion.cpp.
|
static |
Definition at line 63 of file qqmllscompletion.cpp.
References makeSnippet(), and QByteArray().
|
static |
Definition at line 41 of file qqmllscompletion.cpp.
References QString::data(), and QString::isEmpty().
Referenced by makeSnippet(), QQmlLSQuickCompletionPlugin::suggestSnippetsForLeftHandSideOfBinding(), and QQmlLSQuickCompletionPlugin::suggestSnippetsForRightHandSideOfBinding().