diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp index a7ed5199c1e..6d74d885440 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.cpp +++ b/src/plugins/qmljseditor/qmljseditordocument.cpp @@ -37,6 +37,7 @@ using namespace QmlJSEditor; using namespace QmlJS; using namespace QmlJS::AST; using namespace QmlJSTools; +using namespace Utils; namespace { @@ -502,7 +503,7 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare connect(&m_updateOutlineModelTimer, &QTimer::timeout, this, &QmlJSEditorDocumentPrivate::updateOutlineModel); - modelManager->updateSourceFiles(Utils::FilePaths({parent->filePath()}), false); + modelManager->updateSourceFiles({parent->filePath()}, false); } QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate() @@ -522,7 +523,7 @@ void QmlJSEditorDocumentPrivate::invalidateFormatterCache() void QmlJSEditorDocumentPrivate::reparseDocument() { - ModelManagerInterface::instance()->updateSourceFiles(Utils::FilePaths({q->filePath()}), false); + ModelManagerInterface::instance()->updateSourceFiles({q->filePath()}, false); } void QmlJSEditorDocumentPrivate::onDocumentUpdated(Document::Ptr doc) @@ -733,8 +734,7 @@ void QmlJSEditorDocumentPrivate::setSourcesWithCapabilities( setSemanticHighlightSource(QmllsStatus::Source::EmbeddedCodeModel); } -static Utils::FilePath qmllsForFile(const Utils::FilePath &file, - QmlJS::ModelManagerInterface *modelManager) +static FilePath qmllsForFile(const FilePath &file, QmlJS::ModelManagerInterface *modelManager) { QmllsSettingsManager *settingsManager = QmllsSettingsManager::instance(); bool enabled = settingsManager->useQmlls(); @@ -757,14 +757,15 @@ void QmlJSEditorDocumentPrivate::settingsChanged() if (q->isTemporary()) return; - Utils::FilePath newQmlls = qmllsForFile(q->filePath(), ModelManagerInterface::instance()); + FilePath newQmlls = qmllsForFile(q->filePath(), ModelManagerInterface::instance()); if (m_qmllsStatus.qmllsPath == newQmlls) return; + + using namespace LanguageClient; m_qmllsStatus.qmllsPath = newQmlls; - auto lspClientManager = LanguageClient::LanguageClientManager::instance(); if (newQmlls.isEmpty()) { qCDebug(qmllsLog) << "disabling qmlls for" << q->filePath(); - if (LanguageClient::Client *client = lspClientManager->clientForDocument(q)) { + if (Client *client = LanguageClientManager::clientForDocument(q)) { qCDebug(qmllsLog) << "deactivating " << q->filePath() << "in qmlls" << newQmlls; client->deactivateDocument(q); } else @@ -775,32 +776,32 @@ void QmlJSEditorDocumentPrivate::settingsChanged() setSemanticHighlightSource(QmllsStatus::Source::EmbeddedCodeModel); } else if (QmllsClient *client = QmllsClient::clientForQmlls(newQmlls)) { bool shouldActivate = false; - if (auto oldClient = lspClientManager->clientForDocument(q)) { + if (auto oldClient = LanguageClientManager::clientForDocument(q)) { // check if it was disabled if (client == oldClient) shouldActivate = true; } switch (client->state()) { - case LanguageClient::Client::State::Uninitialized: - case LanguageClient::Client::State::InitializeRequested: + case Client::State::Uninitialized: + case Client::State::InitializeRequested: connect(client, - &LanguageClient::Client::initialized, + &Client::initialized, this, &QmlJSEditorDocumentPrivate::setSourcesWithCapabilities); break; - case LanguageClient::Client::State::Initialized: + case Client::State::Initialized: setSourcesWithCapabilities(client->capabilities()); break; - case LanguageClient::Client::State::FailedToInitialize: - case LanguageClient::Client::State::Error: + case Client::State::FailedToInitialize: + case Client::State::Error: qCWarning(qmllsLog) << "qmlls" << newQmlls << "requested for document" << q->filePath() << "had errors, skipping setSourcesWithCababilities"; break; - case LanguageClient::Client::State::Shutdown: + case Client::State::Shutdown: qCWarning(qmllsLog) << "qmlls" << newQmlls << "requested for document" << q->filePath() << "did stop, skipping setSourcesWithCababilities"; break; - case LanguageClient::Client::State::ShutdownRequested: + case Client::State::ShutdownRequested: qCWarning(qmllsLog) << "qmlls" << newQmlls << "requested for document" << q->filePath() << "is stopping, skipping setSourcesWithCababilities"; break; @@ -810,7 +811,7 @@ void QmlJSEditorDocumentPrivate::settingsChanged() client->activateDocument(q); } else { qCDebug(qmllsLog) << "opening " << q->filePath() << "in qmlls" << newQmlls; - lspClientManager->openDocumentWithClient(q, client); + LanguageClientManager::openDocumentWithClient(q, client); } } else { qCWarning(qmllsLog) << "could not start qmlls " << newQmlls << "for" << q->filePath(); @@ -874,8 +875,8 @@ void QmlJSEditorDocument::setIsDesignModePreferred(bool value) d->m_isDesignModePreferred = value; if (value) { if (infoBar()->canInfoBeAdded(QML_UI_FILE_WARNING)) { - Utils::InfoBarEntry info(QML_UI_FILE_WARNING, - Tr::tr("This file should only be edited in Design mode.")); + InfoBarEntry info(QML_UI_FILE_WARNING, + Tr::tr("This file should only be edited in Design mode.")); info.addCustomButton(Tr::tr("Switch Mode"), []() { Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN); });