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 QQMLLANGUAGESERVER_P_H
5#define QQMLLANGUAGESERVER_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 "qqmlcodemodel_p.h"
20#include "qqmlfindusagessupport_p.h"
21#include "qtextsynchronization_p.h"
22#include "qqmllintsuggestions_p.h"
23#include "qworkspace_p.h"
24#include "qqmlcompletionsupport_p.h"
25#include "qqmlgototypedefinitionsupport_p.h"
26#include "qqmlformatting_p.h"
27#include "qqmlgotodefinitionsupport_p.h"
28
29QT_BEGIN_NAMESPACE
30
31class QQmlToolingSettings;
32
33namespace QmlLsp {
34
35class QQmlLanguageServer : public QLanguageServerModule
36{
37 Q_OBJECT
38public:
39 QQmlLanguageServer(std::function<void(const QByteArray &)> sendData,
40 QQmlToolingSettings *settings = nullptr);
41
42 QString name() const final;
43 void registerHandlers(QLanguageServer *server, QLanguageServerProtocol *protocol) final;
44 void setupCapabilities(const QLspSpecification::InitializeParams &clientInfo,
45 QLspSpecification::InitializeResult &serverInfo) final;
46
47 int returnValue() const;
48
49 QQmlCodeModel *codeModel();
50 QLanguageServer *server();
51 TextSynchronization *textSynchronization();
52 QmlLintSuggestions *lint();
53 WorkspaceHandlers *worspace();
54
55public Q_SLOTS:
56 void exit();
57 void errorExit();
58
59private:
60 QQmlCodeModel m_codeModel;
61 QLanguageServer m_server;
62 TextSynchronization m_textSynchronization;
63 QmlLintSuggestions m_lint;
64 WorkspaceHandlers m_workspace;
65 QmlCompletionSupport m_completionSupport;
66 QmlGoToTypeDefinitionSupport m_navigationSupport;
67 QmlGoToDefinitionSupport m_definitionSupport;
68 QQmlFindUsagesSupport m_referencesSupport;
69 QQmlDocumentFormatting m_documentFormatting;
70 int m_returnValue = 1;
71};
72
73} // namespace QmlLsp
74QT_END_NAMESPACE
75#endif // QQMLLANGUAGESERVER_P_H
76

source code of qtdeclarative/src/qmlls/qqmllanguageserver_p.h