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>.
Loading...
Searching...
No Matches
QQmlLSCompletion Class Reference

QQmlLSCompletion provides completions for all kinds of QML and JS constructs. More...

#include <qqmllscompletion_p.h>

+ Collaboration diagram for QQmlLSCompletion:

Public Types

using CompletionItem = QLspSpecification::CompletionItem
 
using BackInsertIterator = std::back_insert_iterator<QList<CompletionItem>>
 

Public Member Functions

 QQmlLSCompletion (const QFactoryLoader &pluginLoader)
 
QList< CompletionItemcompletions (const DomItem &currentItem, const CompletionContextStrings &ctx) const
 

Static Public Member Functions

static CompletionItem makeSnippet (QUtf8StringView qualifier, QUtf8StringView label, QUtf8StringView insertText)
 
static CompletionItem makeSnippet (QUtf8StringView label, QUtf8StringView insertText)
 

Detailed Description

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.

Member Typedef Documentation

◆ BackInsertIterator

using QQmlLSCompletion::BackInsertIterator = std::back_insert_iterator<QList<CompletionItem>>

Definition at line 43 of file qqmllscompletion_p.h.

◆ CompletionItem

using QQmlLSCompletion::CompletionItem = QLspSpecification::CompletionItem

Definition at line 42 of file qqmllscompletion_p.h.

Constructor & Destructor Documentation

◆ QQmlLSCompletion()

QQmlLSCompletion::QQmlLSCompletion ( const QFactoryLoader & pluginLoader)

Definition at line 1842 of file qqmllscompletion.cpp.

References i, and keys.

Member Function Documentation

◆ completions()

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.

◆ makeSnippet() [1/2]

CompletionItem QQmlLSCompletion::makeSnippet ( QUtf8StringView label,
QUtf8StringView insertText )
static

Definition at line 63 of file qqmllscompletion.cpp.

References makeSnippet(), and QByteArray().

+ Here is the call graph for this function:

◆ makeSnippet() [2/2]

CompletionItem QQmlLSCompletion::makeSnippet ( QUtf8StringView qualifier,
QUtf8StringView label,
QUtf8StringView insertText )
static

Definition at line 41 of file qqmllscompletion.cpp.

References QString::data(), and QString::isEmpty().

Referenced by makeSnippet(), QQmlLSQuickCompletionPlugin::suggestSnippetsForLeftHandSideOfBinding(), and QQmlLSQuickCompletionPlugin::suggestSnippetsForRightHandSideOfBinding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: