| 1 | // Copyright (C) 2023 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 QQMLFORMATTING_P_H |
| 5 | #define QQMLFORMATTING_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 "qqmlbasemodule_p.h" |
| 20 | #include "qqmlcodemodel_p.h" |
| 21 | |
| 22 | #include <QtQmlFormat/private/qqmlformatoptions_p.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | Q_DECLARE_LOGGING_CATEGORY(formatLog) |
| 27 | |
| 28 | struct DocumentFormattingRequest |
| 29 | : public BaseRequest<QLspSpecification::DocumentFormattingParams, |
| 30 | QLspSpecification::Responses::DocumentFormattingResponseType> |
| 31 | { |
| 32 | }; |
| 33 | |
| 34 | class QQmlDocumentFormatting : public QQmlBaseModule<DocumentFormattingRequest> |
| 35 | { |
| 36 | Q_OBJECT |
| 37 | public: |
| 38 | QQmlDocumentFormatting(QmlLsp::QQmlCodeModel *codeModel); |
| 39 | QString name() const override; |
| 40 | void registerHandlers(QLanguageServer *server, QLanguageServerProtocol *protocol) override; |
| 41 | void setupCapabilities(const QLspSpecification::InitializeParams &clientInfo, |
| 42 | QLspSpecification::InitializeResult &) override; |
| 43 | void process(RequestPointerArgument req) override; |
| 44 | |
| 45 | private: |
| 46 | QQmlFormatOptions m_formatOptions; |
| 47 | }; |
| 48 | |
| 49 | QT_END_NAMESPACE |
| 50 | |
| 51 | #endif // QQMLFORMATTING_P_H |
| 52 |
