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

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