aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlls/workspace.h
blob: d7da0922617739bd9be475135a8c8246383cb571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef WORKSPACE_H
#define WORKSPACE_H

#include "qqmlcodemodel.h"
#include "qlanguageserver.h"

QT_BEGIN_NAMESPACE

class WorkspaceHandlers : public QLanguageServerModule
{
    Q_OBJECT
public:
    enum class Status { NoIndex, Indexing };
    WorkspaceHandlers(QmlLsp::QQmlCodeModel *codeModel) : m_codeModel(codeModel) { }
    QString name() const override;
    void registerHandlers(QLanguageServer *server, QLanguageServerProtocol *protocol) override;
    void setupCapabilities(const QLspSpecification::InitializeParams &clientInfo,
                           QLspSpecification::InitializeResult &) override;
public slots:
    void clientInitialized(QLanguageServer *);

private:
    QmlLsp::QQmlCodeModel *m_codeModel = nullptr;
    Status m_status = Status::NoIndex;
};

QT_END_NAMESPACE

#endif // WORKSPACE_H