qtdeclarative/tools/qmlls/qmllanguageservertool.cpp

39 lines
1.0 KiB
C++
Raw Permalink Normal View History

// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
qmlls: move into own private static library Qmlls was completely implemented in the ./tools directory, which made its code complicated to test and try out. Also, it required some "dirty" hacks in the actual tests (including files from others targets to be able to use them) and made testing new features for qmlls more complicated. To remedy this, the qmlls code was split into a tool (qmlls) and a static library (QmlLSPrivate). The tool only contains tools/qmlls/qmllanguageservertool.cpp (which has the qmlls main method) and links to QmlLSPrivate, that contains all the other qmlls-related code. This way, the tests can also link to QmlLSPrivate and test out individual functions there without needing to include files from other targets. Also rename all the files to make syncqt happy (adding "_p" to headers and prepending "q" to headers and files and includeguards), and use QString::fromUtf8() to silence the QString()-constructor deprecation warnings. On the way, move tools/shared/qqmltoolingsettings.* into its own private static library, instead of recompiling it for each tool that requires it. Move the qqmltoolingsettings stuff into the qt namespace to be usable. Also, add qmlls as a dependency to the qmlls tests to avoid testing an outdated qmlls-binary. This commit prepares qmlls's code to implement the go-to and find-usages features. Task-number: QTBUG-109006 Change-Id: I91eed689c68a0c53fb88006de335b0f852cc1a83 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-24 09:45:21 +00:00
#include <private/qmllsmain_p.h>
#include <QtCore/qcoreapplication.h>
// To debug:
//
// * simple logging can be redirected to a file
// passing -l <file> to the qmlls command
//
// * more complex debugging can use named pipes:
//
// mkfifo qmllsIn
// mkfifo qmllsOut
//
// this together with a qmllsEcho script that can be defined as
//
// #!/bin/sh
// cat -u < ~/qmllsOut &
// cat -u > ~/qmllsIn
//
// allows to use qmllsEcho as lsp server, and still easily start
// it in a terminal
//
// qmlls < ~/qmllsIn > ~/qmllsOut
//
// * statup can be slowed down to have the time to attach via the
// -w <nSeconds> flag.
using namespace Qt::StringLiterals;
int main(int argv, char *argc[])
{
QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
QCoreApplication::setApplicationName("qmlls"_L1);
return QmlLsp::qmllsMain(argv, argc);
}