1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef EVENTDEFINITIONS_H |
6 | #define EVENTDEFINITIONS_H |
7 | |
8 | #include "common/lsp/protocol/newprotocol.h" |
9 | #include "framework.h" |
10 | |
11 | #include <QString> |
12 | |
13 | OPI_OBJECT(recent, |
14 | OPI_INTERFACE(saveOpenedProject, "kitName" , "language" , "workspace" ) |
15 | OPI_INTERFACE(saveOpenedFile, "filePath" ) |
16 | ) |
17 | |
18 | OPI_OBJECT(project, |
19 | // in |
20 | OPI_INTERFACE(openProject, "kitName" , "language" , "workspace" ) |
21 | OPI_INTERFACE(activeProject, "kitName" , "language" , "workspace" ) |
22 | // out |
23 | OPI_INTERFACE(activedProject, "projectInfo" ) |
24 | OPI_INTERFACE(deletedProject, "projectInfo" ) |
25 | OPI_INTERFACE(createdProject, "projectInfo" ) |
26 | ) |
27 | |
28 | OPI_OBJECT(debugger, |
29 | OPI_INTERFACE(prepareDebugProgress, "message" ) |
30 | OPI_INTERFACE(prepareDebugDone, "succeed" , "message" ) |
31 | OPI_INTERFACE(executeStart) |
32 | ) |
33 | |
34 | OPI_OBJECT(editor, |
35 | // in |
36 | OPI_INTERFACE(openFile, "filePath" ) |
37 | OPI_INTERFACE(jumpToLine, "filePath" , "line" ) |
38 | OPI_INTERFACE(openFileWithKey, "workspace" , "language" , "filePath" ) |
39 | OPI_INTERFACE(jumpToLineWithKey, "workspace" , "language" , "filePath" , "line" ) |
40 | // (AnnotationInfo)annInfo |
41 | OPI_INTERFACE(setAnnotation, "filePath" , "line" , "title" , "annInfo" ) |
42 | OPI_INTERFACE(cleanAnnotation, "filePath" , "title" ) |
43 | OPI_INTERFACE(runningToLine, "filePath" , "line" ) |
44 | OPI_INTERFACE(cleanRunning) |
45 | OPI_INTERFACE(setLineBackground, "filePath" , "line" , "color" ) |
46 | OPI_INTERFACE(delLineBackground, "filePath" , "line" ) |
47 | OPI_INTERFACE(cleanLineBackground, "filePath" ) |
48 | OPI_INTERFACE(setModifiedAutoReload, "filePath" , "flag" ) |
49 | OPI_INTERFACE(addDebugPoint, "filePath" , "line" ) |
50 | OPI_INTERFACE(removeDebugPoint, "filePath" , "line" ) |
51 | // out |
52 | OPI_INTERFACE(openedFile, "filePath" ) |
53 | OPI_INTERFACE(closedFile, "filePath" ) |
54 | OPI_INTERFACE(switchedFile, "filePath" ) |
55 | OPI_INTERFACE(addadDebugPoint, "filePath" , "line" ) |
56 | OPI_INTERFACE(removedDebugPoint, "filePath" , "line" ) |
57 | // (FindType)findType |
58 | OPI_INTERFACE(searchText, "text" , "findType" ) |
59 | // (FindType)repalceType |
60 | OPI_INTERFACE(replaceText, "text" , "target" , "repalceType" ) |
61 | OPI_INTERFACE(switchContext, "name" ) |
62 | OPI_INTERFACE(switchWorkspace, "name" ) |
63 | ) |
64 | |
65 | OPI_OBJECT(symbol, |
66 | OPI_INTERFACE(parse, "workspace" , "language" , "storage" ) |
67 | OPI_INTERFACE(parseDone, "workspace" , "language" , "storage" , "success" ) |
68 | ) |
69 | |
70 | OPI_OBJECT(navigation, |
71 | OPI_INTERFACE(doSwitch, "actionText" ) |
72 | ) |
73 | |
74 | OPI_OBJECT(actionanalyse, |
75 | // in |
76 | OPI_INTERFACE(analyse, "workspace" , "language" , "storage" ) |
77 | // analysedData value custom struct from AnalysedData |
78 | OPI_INTERFACE(analyseDone, "workspace" , "language" , "storage" , "analysedData" ) |
79 | // out |
80 | OPI_INTERFACE(enabled, "flag" ) |
81 | ) |
82 | |
83 | OPI_OBJECT(commandLine, |
84 | OPI_INTERFACE(build) |
85 | ) |
86 | |
87 | struct AnnotationInfo |
88 | { |
89 | struct RoleElem |
90 | { |
91 | QString display; |
92 | int code; |
93 | bool operator == (const RoleElem &elem) |
94 | { |
95 | return display == elem.display |
96 | && code == elem.code; |
97 | } |
98 | }; |
99 | enum_def(Role, RoleElem) |
100 | { |
101 | enum_exp Note = {"Note" , 767}; |
102 | enum_exp Warning = {"Warning" , 766}; |
103 | enum_exp Error = {"Error" , 765}; |
104 | enum_exp Fatal = {"Fatal" , 764}; |
105 | }; |
106 | Role::type_value role; |
107 | QString text; |
108 | AnnotationInfo(const QString &text) |
109 | : text(text) { role = Role::get()->Note;} |
110 | AnnotationInfo(Role::type_value role, const QString &text) |
111 | : role(role), text(text){} |
112 | AnnotationInfo() :role(Role::get()->Note), text("" ){} |
113 | AnnotationInfo(const AnnotationInfo &info) |
114 | : role(info.role), text(info.text){} |
115 | bool operator == (const AnnotationInfo &info) { |
116 | return role == info.role |
117 | && text == info.text; |
118 | } |
119 | }; |
120 | Q_DECLARE_METATYPE(AnnotationInfo); |
121 | |
122 | struct AnalysedData |
123 | { |
124 | struct TokenMap |
125 | { |
126 | newlsp::Enum::SemanticTokenTypes::type_value semanticTokenType; |
127 | newlsp::Enum::SemanticTokenModifiers::type_value semanticTokenModifier; |
128 | std::vector<float> result; |
129 | }; |
130 | std::vector<std::string> rules; |
131 | std::vector<TokenMap> tokenMaps; |
132 | }; |
133 | Q_DECLARE_METATYPE(AnalysedData); |
134 | |
135 | enum FindType{ |
136 | Previous = 0, |
137 | Next |
138 | }; |
139 | Q_DECLARE_METATYPE(FindType); |
140 | |
141 | enum RepalceType{ |
142 | Repalce = 0, |
143 | FindAndReplace, |
144 | RepalceAll |
145 | }; |
146 | Q_DECLARE_METATYPE(RepalceType); |
147 | |
148 | extern const QString ; |
149 | extern const QString T_FILEBROWSER; |
150 | extern const QString T_DEBUGGER; |
151 | extern const QString T_BUILDER; |
152 | extern const QString T_WORKSPACE; |
153 | extern const QString T_RECENT; |
154 | extern const QString T_SYMBOL; |
155 | extern const QString T_PROCESSMESSAGE; |
156 | extern const QString T_FIND; |
157 | extern const QString T_COLLABORATORS; |
158 | |
159 | extern const QString D_BUILD_STATE; |
160 | extern const QString ; |
161 | extern const QString D_BUILD_TARGET; |
162 | extern const QString D_SHOW; |
163 | extern const QString D_HIDE; |
164 | extern const QString D_ADDTEXT; |
165 | extern const QString D_BUILD_COMMAND; |
166 | extern const QString ; |
167 | extern const QString ; |
168 | extern const QString ; |
169 | extern const QString D_OPEN_REPOS; |
170 | |
171 | extern const QString D_SEARCH; |
172 | extern const QString D_REPLACE; |
173 | extern const QString D_OPENFILE; |
174 | |
175 | extern const QString P_ACTION_TEXT; // value QString |
176 | extern const QString P_FILELINE; // value int |
177 | extern const QString P_PROJECTPATH; // value QString |
178 | extern const QString P_TARGETPATH; // value QString |
179 | extern const QString P_WORKSPACEFOLDER;// value QString |
180 | extern const QString P_COMPILEFOLDER; // value QString |
181 | extern const QString P_BUILDSYSTEM; // value QString |
182 | extern const QString P_BUILDDIRECTORY; // value QString |
183 | extern const QString P_BUILDFILEPATH; // value QString |
184 | extern const QString P_BUILDARGUMENTS; // value QStringList |
185 | extern const QString P_TEXT; // value QString |
186 | extern const QString P_ORIGINCMD; // value QString, event sender id. |
187 | extern const QString P_PERCENT; // value int |
188 | extern const QString P_MAX_PERCENT; // value int |
189 | extern const QString P_STATE; // value int |
190 | extern const QString P_KITNAME; // value QString |
191 | extern const QString P_LANGUAGE; // value QString |
192 | extern const QString P_PROJECT_INFO; // value dpfService::ProjectInfo |
193 | extern const QString P_ANNOTATION_ROLE; // only with 0:Note 1:Warning 2:Error 3:Fatal |
194 | extern const QString P_COLOR; // value QColor |
195 | |
196 | extern const QString P_OPRATETYPE; |
197 | extern const QString P_SRCTEXT; |
198 | extern const QString P_DESTTEXT; |
199 | |
200 | extern const QString P_BUILDPROGRAM; |
201 | extern const QString P_BUILDWORKINGDIR; |
202 | |
203 | #endif // EVENTDEFINITIONS_H |
204 | |