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;
|
||||
|
||||
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)) {
|
||||
client->updateQmllsSemanticHighlightingCapability();
|
||||
setSourcesWithCapabilities(client->capabilities());
|
||||
@@ -781,9 +781,7 @@ void QmlJSEditorDocumentPrivate::settingsChanged()
|
||||
if (LanguageClientManager::clientForDocument(q) != nullptr) {
|
||||
qCDebug(qmllsLog) << "deactivating " << q->filePath() << "in qmlls" << newQmlls;
|
||||
LanguageClientManager::openDocumentWithClient(q, nullptr);
|
||||
} else
|
||||
qCWarning(qmllsLog) << "Could not find client to disable for document " << q->filePath()
|
||||
<< " in LanguageClient::LanguageClientManager";
|
||||
}
|
||||
setCompletionSource(QmllsStatus::Source::EmbeddedCodeModel);
|
||||
setSemanticWarningSource(QmllsStatus::Source::EmbeddedCodeModel);
|
||||
setSemanticHighlightSource(QmllsStatus::Source::EmbeddedCodeModel);
|
||||
|
@@ -45,6 +45,7 @@ static QHash<FilePath, QmllsClient *> &qmllsClients()
|
||||
|
||||
QmllsClient *QmllsClient::clientForQmlls(const FilePath &qmlls)
|
||||
{
|
||||
QTC_ASSERT(!qmlls.isEmpty(), return nullptr);
|
||||
if (auto client = qmllsClients()[qmlls]) {
|
||||
switch (client->state()) {
|
||||
case Client::State::Uninitialized:
|
||||
|
Reference in New Issue
Block a user