summaryrefslogtreecommitdiff
path: root/graphics/asymptote/LspCpp/include/LibLsp/lsp/language/language.h
blob: 96b4b61fa95ac37fb87e0b80f6cc98ffaa79e70b (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#pragma once

#include "LibLsp/JsonRpc/RequestInMessage.h"
#include "LibLsp/JsonRpc/NotificationInMessage.h"

#include "LibLsp/lsp/lsDocumentUri.h"
#include "LibLsp/lsp/lsCommand.h"

#ifdef _WIN32
#include <ppltasks.h>
#endif

struct  StatusReport {

        std::string ToString() const
        {
                std::string info;
                info += "type:" + type + "\n";
                info += "message:" + message + "\n";
                return info;
        }
        /**
         * The message type. See {
         *
         */

        std::string  type;
        /**
         * The actual message
         *
         */

        std::string  message;
        MAKE_SWAP_METHOD(StatusReport, type, message);
};
MAKE_REFLECT_STRUCT(StatusReport, type, message);

/**
 * The show message notification is sent from a server to a client to ask
 * the client to display a particular message in the user interface.
 */
DEFINE_NOTIFICATION_TYPE(lang_status, StatusReport, "language/status");


enum class MessageType {

        /**
         * An error message.
         */
        Error=(1),

        /**
         * A warning message.
         */
         Warning=(2),

         /**
          * An information message.
          */
          Info=(3),

          /**
           * A log message.
           */
           Log=(4)
};
MAKE_REFLECT_TYPE_PROXY(MessageType);


struct ActionableNotification {



        /**
         * The message type. See {
         *
         */

         MessageType severity;
        /**
         * The actual message
         *
         */

         std::string message;

        /**
         * Optional data
         *
         */

        optional<lsp::Any> data;


        /**
         * Optional commands
         *
         */

         std::vector<lsCommandWithAny> commands;

         MAKE_SWAP_METHOD(ActionableNotification, severity, message, data, commands)
};
MAKE_REFLECT_STRUCT(ActionableNotification, severity, message, data, commands)


/**
 * The actionable notification is sent from a server to a client to ask the
 * client to display a particular message in the user interface, and possible
 * commands to execute. The commands must be implemented on the client side.
 */
DEFINE_NOTIFICATION_TYPE(lang_actionableNotification, ActionableNotification, "language/actionableNotification");



struct  ProgressReport {
        std::string ToString() const;

        std::string id;


        std::string task;


        std::string subTask;


        std::string status;

         int totalWork = 0;


         int workDone = 0;


         bool complete = false;
         MAKE_SWAP_METHOD(ProgressReport, id, task, subTask, status, workDone, complete);
};


MAKE_REFLECT_STRUCT(ProgressReport, id, task, subTask, status, workDone, complete);

/**
 * The progress report notification is sent from a server to be handled by the
 * client.
 */
DEFINE_NOTIFICATION_TYPE(lang_progressReport, ProgressReport, "language/progressReport");

enum EventType {
        /**
         * classpath updated event.
         */
        ClasspathUpdated = (100),

        /**
         * projects imported event.
         */
         ProjectsImported = (200)
};

struct EventNotification
{
        int eventType;
        lsp::Any data;
        std::string ToString() const;
        MAKE_SWAP_METHOD(EventNotification, eventType, data)
};
MAKE_REFLECT_STRUCT(EventNotification, eventType, data);

DEFINE_NOTIFICATION_TYPE(lang_eventNotification, EventNotification, "language/eventNotification");