5#include <QtQmlLS/private/qqmllsutils_p.h>
6#include <QtQmlLS/private/qqmllscompletion_p.h>
15 return std::make_unique<QQmlLSQuickCompletionPlugin>();
26 const auto &imports =
file->imports();
27 auto it = std::find_if(imports.constBegin(), imports.constEnd(), [](
const Import &
import) {
28 return import.uri.moduleUri() == u
"QtQuick";
40 if (!userTypedQualifier.isEmpty()
41 && !
it->importId.startsWith(
QStringView(userTypedQualifier).chopped(1))) {
50 auto resolver =
file->typeResolver();
53 const auto qquickItemScope = resolver->typeForName(prefixWithDotForSnippet + u
"Item"_s);
55 if (!ownerScope || !qquickItemScope)
58 if (ownerScope->inherits(qquickItemScope)) {
60 "states binding with PropertyChanges in State",
62 "\t"_ba.append(prefixWithDotForSnippet)
64 "\t\tname: \"${1:name}\"\n"
65 "\t\t"_ba.append(prefixWithDotForSnippet)
66 .append(
"PropertyChanges {\n"
67 "\t\t\ttarget: ${2:object}\n"
73 "\t"_ba.append(prefixWithDotForSnippet)
74 .append(
"Transition {\n"
75 "\t\tfrom: \"${1:fromState}\"\n"
76 "\t\tto: \"${2:fromState}\"\n"
90 const auto &imports =
file->imports();
91 auto it = std::find_if(imports.constBegin(), imports.constEnd(), [](
const Import &
import) {
92 return import.uri.moduleUri() == u
"QtQuick";
101 if (!userTypedQualifier.isEmpty()
102 && !
it->importId.startsWith(
QStringView(userTypedQualifier).chopped(1))) {
115 "\tsource: \"${2:file}\"\n"
116 "\twidth: ${3:100}; height: ${4:100}\n"
117 "\tborder.left: ${5: 5}; border.top: ${5}\n"
118 "\tborder.right: ${5}; border.bottom: ${5}\n"
122 "\tfrom: \"${1:white}\"\n"
123 "\tto: \"${2:black}\"\n"
124 "\tduration: ${3:200}\n"
129 "\tsource: \"${2:file}\"\n"
136 "NumberAnimation {\n"
137 "\ttarget: ${1:object}\n"
138 "\tproperty: \"${2:name}\"\n"
139 "\tduration: ${3:200}\n"
140 "\teasing.type: "_ba.append(prefixWithDotForSnippet)
141 .append(
"Easing.${4:InOutQuad}\n"
144 "NumberAnimation {\n"
145 "\ttargets: [${1:object}]\n"
146 "\tproperties: \"${2:name}\"\n"
147 "\tduration: ${3:200}\n"
151 "\tduration: ${1:200}\n"
155 "\ttarget: ${1:object}\n"
156 "\tproperty: \"${2:name}\"\n"
160 "\ttargets: [${1:object}]\n"
161 "\tproperties: \"${2:name}\"\n"
164 "PropertyChanges {\n"
165 "\ttarget: ${1:object}\n"
169 "\tname: ${1:name}\n"
170 "\t"_ba.append(prefixWithDotForSnippet)
171 .append(
"PropertyChanges {\n"
172 "\t\ttarget: ${2:object}\n"
178 "\ttext: qsTr(\"${2:text}\")\n"
182 "\tfrom: \"${1:fromState}\"\n"
183 "\tto: \"${2:toState}\"\n"
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
DomItem containingFile() const
DomItem qmlObject(GoTo option=GoTo::Strict, FilterUpOptions options=FilterUpOptions::ReturnOuter) const
QQmlJSScope::ConstPtr semanticScope() const
A QmlFile, when loaded in a DomEnvironment that has the DomCreationOption::WithSemanticAnalysis,...
std::back_insert_iterator< QList< QLspSpecification::CompletionItem > > BackInsertIterator
static CompletionItem makeSnippet(QUtf8StringView qualifier, QUtf8StringView label, QUtf8StringView insertText)
void suggestSnippetsForLeftHandSideOfBinding(const QQmlJS::Dom::DomItem &items, BackInsertIterator result) const override
void suggestSnippetsForRightHandSideOfBinding(const QQmlJS::Dom::DomItem &items, BackInsertIterator result) const override
std::unique_ptr< QQmlLSCompletionPlugin > createCompletionPlugin() const override
static QString qualifiersFrom(const DomItem &el)
const_iterator constEnd() const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
QSet< QString >::iterator it
Combined button and popup list for selecting options.
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()