1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QLANGUAGESERVER_P_P_H |
5 | #define QLANGUAGESERVER_P_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qlanguageserver_p.h" |
19 | #include <QtLanguageServer/private/qlanguageserverprotocol_p.h> |
20 | #include <QtCore/QMutex> |
21 | #include <QtCore/QHash> |
22 | #include <QtCore/private/qobject_p.h> |
23 | #include <QtLanguageServer/private/qlspnotifysignals_p.h> |
24 | |
25 | #include <memory> |
26 | |
27 | QT_BEGIN_NAMESPACE |
28 | |
29 | class QRequestInProgress |
30 | { |
31 | public: |
32 | bool canceled = false; |
33 | }; |
34 | |
35 | class QLanguageServerPrivate : public QObjectPrivate |
36 | { |
37 | public: |
38 | QLanguageServerPrivate(const QJsonRpcTransport::DataHandler &h); |
39 | |
40 | // The order of the class members matters here. ShutdownResponse holds and uses a pointer to |
41 | // protocol in its destructor, so shutdownResponse has to be destroyed after protocol in |
42 | // ~QLanguageServerPrivate(). This happens only when protocol is defined above/before |
43 | // shutdownResponse. |
44 | QLanguageServerProtocol protocol; |
45 | |
46 | mutable QMutex mutex; |
47 | // mutex gated, monotonically increasing |
48 | QLanguageServer::RunStatus runStatus = QLanguageServer::RunStatus::NotSetup; |
49 | QHash<QJsonValue, QRequestInProgress> requestsInProgress; // mutex gated |
50 | bool clientInitialized = false; // mutex gated |
51 | QLspSpecification::InitializeParams clientInfo; // immutable after runStatus > DidInitialize |
52 | QLspSpecification::InitializeResult serverInfo; // immutable after runStatus > DidInitialize |
53 | QLspSpecification::Responses::ShutdownResponseType shutdownResponse; |
54 | QHash<QString, QLanguageServerModule *> modules; |
55 | QLspNotifySignals notifySignals; |
56 | }; |
57 | |
58 | QT_END_NAMESPACE |
59 | #endif // QLANGUAGESERVER_P_P_H |
60 | |