forked from qt-creator/qt-creator
qmlls client: avoid creating clients for an empty qmlls path
This is plain wrong and may result in unwanted side effects down the line. Change-Id: Ibe6f1fc31788a9994f4d9d0ff130fc88dc4422aa Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This commit is contained in:
@@ -765,7 +765,7 @@ void QmlJSEditorDocumentPrivate::settingsChanged()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
FilePath newQmlls = qmllsForFile(q->filePath(), ModelManagerInterface::instance());
|
FilePath newQmlls = qmllsForFile(q->filePath(), ModelManagerInterface::instance());
|
||||||
if (m_qmllsStatus.qmllsPath == newQmlls) {
|
if (!newQmlls.isEmpty() && m_qmllsStatus.qmllsPath == newQmlls) {
|
||||||
if (QmllsClient *client = QmllsClient::clientForQmlls(newQmlls)) {
|
if (QmllsClient *client = QmllsClient::clientForQmlls(newQmlls)) {
|
||||||
client->updateQmllsSemanticHighlightingCapability();
|
client->updateQmllsSemanticHighlightingCapability();
|
||||||
setSourcesWithCapabilities(client->capabilities());
|
setSourcesWithCapabilities(client->capabilities());
|
||||||
@@ -781,9 +781,7 @@ void QmlJSEditorDocumentPrivate::settingsChanged()
|
|||||||
if (LanguageClientManager::clientForDocument(q) != nullptr) {
|
if (LanguageClientManager::clientForDocument(q) != nullptr) {
|
||||||
qCDebug(qmllsLog) << "deactivating " << q->filePath() << "in qmlls" << newQmlls;
|
qCDebug(qmllsLog) << "deactivating " << q->filePath() << "in qmlls" << newQmlls;
|
||||||
LanguageClientManager::openDocumentWithClient(q, nullptr);
|
LanguageClientManager::openDocumentWithClient(q, nullptr);
|
||||||
} else
|
}
|
||||||
qCWarning(qmllsLog) << "Could not find client to disable for document " << q->filePath()
|
|
||||||
<< " in LanguageClient::LanguageClientManager";
|
|
||||||
setCompletionSource(QmllsStatus::Source::EmbeddedCodeModel);
|
setCompletionSource(QmllsStatus::Source::EmbeddedCodeModel);
|
||||||
setSemanticWarningSource(QmllsStatus::Source::EmbeddedCodeModel);
|
setSemanticWarningSource(QmllsStatus::Source::EmbeddedCodeModel);
|
||||||
setSemanticHighlightSource(QmllsStatus::Source::EmbeddedCodeModel);
|
setSemanticHighlightSource(QmllsStatus::Source::EmbeddedCodeModel);
|
||||||
|
@@ -45,6 +45,7 @@ static QHash<FilePath, QmllsClient *> &qmllsClients()
|
|||||||
|
|
||||||
QmllsClient *QmllsClient::clientForQmlls(const FilePath &qmlls)
|
QmllsClient *QmllsClient::clientForQmlls(const FilePath &qmlls)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(!qmlls.isEmpty(), return nullptr);
|
||||||
if (auto client = qmllsClients()[qmlls]) {
|
if (auto client = qmllsClients()[qmlls]) {
|
||||||
switch (client->state()) {
|
switch (client->state()) {
|
||||||
case Client::State::Uninitialized:
|
case Client::State::Uninitialized:
|
||||||
|
Reference in New Issue
Block a user