@lvce-editor/editor-worker 18.23.0 → 18.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editorWorkerMain.js +521 -567
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1,58 +1,122 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
if (line.startsWith('VError: ')) {
|
|
6
|
-
return line.slice('VError: '.length);
|
|
7
|
-
}
|
|
8
|
-
return line;
|
|
9
|
-
};
|
|
10
|
-
const getCombinedMessage = (error, message) => {
|
|
11
|
-
const stringifiedError = normalizeLine(`${error}`);
|
|
12
|
-
if (message) {
|
|
13
|
-
return `${message}: ${stringifiedError}`;
|
|
14
|
-
}
|
|
15
|
-
return stringifiedError;
|
|
1
|
+
const toCommandId = key => {
|
|
2
|
+
const dotIndex = key.indexOf('.');
|
|
3
|
+
return key.slice(dotIndex + 1);
|
|
16
4
|
};
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
5
|
+
const create$j = () => {
|
|
6
|
+
const states = Object.create(null);
|
|
7
|
+
const commandMapRef = {};
|
|
8
|
+
return {
|
|
9
|
+
clear() {
|
|
10
|
+
for (const key of Object.keys(states)) {
|
|
11
|
+
delete states[key];
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
diff(uid, modules, numbers) {
|
|
15
|
+
const {
|
|
16
|
+
newState,
|
|
17
|
+
oldState
|
|
18
|
+
} = states[uid];
|
|
19
|
+
const diffResult = [];
|
|
20
|
+
for (let i = 0; i < modules.length; i++) {
|
|
21
|
+
const fn = modules[i];
|
|
22
|
+
if (!fn(oldState, newState)) {
|
|
23
|
+
diffResult.push(numbers[i]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return diffResult;
|
|
27
|
+
},
|
|
28
|
+
dispose(uid) {
|
|
29
|
+
delete states[uid];
|
|
30
|
+
},
|
|
31
|
+
get(uid) {
|
|
32
|
+
return states[uid];
|
|
33
|
+
},
|
|
34
|
+
getCommandIds() {
|
|
35
|
+
const keys = Object.keys(commandMapRef);
|
|
36
|
+
const ids = keys.map(toCommandId);
|
|
37
|
+
return ids;
|
|
38
|
+
},
|
|
39
|
+
getKeys() {
|
|
40
|
+
return Object.keys(states).map(key => {
|
|
41
|
+
return Number.parseFloat(key);
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
registerCommands(commandMap) {
|
|
45
|
+
Object.assign(commandMapRef, commandMap);
|
|
46
|
+
},
|
|
47
|
+
set(uid, oldState, newState) {
|
|
48
|
+
states[uid] = {
|
|
49
|
+
newState,
|
|
50
|
+
oldState
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
wrapCommand(fn) {
|
|
54
|
+
const wrapped = async (uid, ...args) => {
|
|
55
|
+
const {
|
|
56
|
+
newState,
|
|
57
|
+
oldState
|
|
58
|
+
} = states[uid];
|
|
59
|
+
const newerState = await fn(newState, ...args);
|
|
60
|
+
if (oldState === newerState || newState === newerState) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const latestOld = states[uid];
|
|
64
|
+
const latestNew = {
|
|
65
|
+
...latestOld.newState,
|
|
66
|
+
...newerState
|
|
67
|
+
};
|
|
68
|
+
states[uid] = {
|
|
69
|
+
newState: latestNew,
|
|
70
|
+
oldState: latestOld.oldState
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
return wrapped;
|
|
74
|
+
},
|
|
75
|
+
wrapGetter(fn) {
|
|
76
|
+
const wrapped = (uid, ...args) => {
|
|
77
|
+
const {
|
|
78
|
+
newState
|
|
79
|
+
} = states[uid];
|
|
80
|
+
return fn(newState, ...args);
|
|
81
|
+
};
|
|
82
|
+
return wrapped;
|
|
83
|
+
},
|
|
84
|
+
wrapLoadContent(fn) {
|
|
85
|
+
const wrapped = async (uid, ...args) => {
|
|
86
|
+
const {
|
|
87
|
+
newState,
|
|
88
|
+
oldState
|
|
89
|
+
} = states[uid];
|
|
90
|
+
const result = await fn(newState, ...args);
|
|
91
|
+
const {
|
|
92
|
+
error,
|
|
93
|
+
state
|
|
94
|
+
} = result;
|
|
95
|
+
if (oldState === state || newState === state) {
|
|
96
|
+
return {
|
|
97
|
+
error
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const latestOld = states[uid];
|
|
101
|
+
const latestNew = {
|
|
102
|
+
...latestOld.newState,
|
|
103
|
+
...state
|
|
104
|
+
};
|
|
105
|
+
states[uid] = {
|
|
106
|
+
newState: latestNew,
|
|
107
|
+
oldState: latestOld.oldState
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
error
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
return wrapped;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
20
116
|
};
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
return parent;
|
|
24
|
-
}
|
|
25
|
-
const parentNewLineIndex = getNewLineIndex$1(parent);
|
|
26
|
-
const childNewLineIndex = getNewLineIndex$1(child);
|
|
27
|
-
if (childNewLineIndex === -1) {
|
|
28
|
-
return parent;
|
|
29
|
-
}
|
|
30
|
-
const parentFirstLine = parent.slice(0, parentNewLineIndex);
|
|
31
|
-
const childRest = child.slice(childNewLineIndex);
|
|
32
|
-
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
33
|
-
if (parentFirstLine.includes(childFirstLine)) {
|
|
34
|
-
return parentFirstLine + childRest;
|
|
35
|
-
}
|
|
36
|
-
return child;
|
|
117
|
+
const terminate = () => {
|
|
118
|
+
globalThis.close();
|
|
37
119
|
};
|
|
38
|
-
class VError extends Error {
|
|
39
|
-
constructor(error, message) {
|
|
40
|
-
const combinedMessage = getCombinedMessage(error, message);
|
|
41
|
-
super(combinedMessage);
|
|
42
|
-
this.name = 'VError';
|
|
43
|
-
if (error instanceof Error) {
|
|
44
|
-
this.stack = mergeStacks(this.stack, error.stack);
|
|
45
|
-
}
|
|
46
|
-
if (error.codeFrame) {
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
this.codeFrame = error.codeFrame;
|
|
49
|
-
}
|
|
50
|
-
if (error.code) {
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
this.code = error.code;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
120
|
|
|
57
121
|
class AssertionError extends Error {
|
|
58
122
|
constructor(message) {
|
|
@@ -121,6 +185,62 @@ const boolean = value => {
|
|
|
121
185
|
}
|
|
122
186
|
};
|
|
123
187
|
|
|
188
|
+
const normalizeLine = line => {
|
|
189
|
+
if (line.startsWith('Error: ')) {
|
|
190
|
+
return line.slice('Error: '.length);
|
|
191
|
+
}
|
|
192
|
+
if (line.startsWith('VError: ')) {
|
|
193
|
+
return line.slice('VError: '.length);
|
|
194
|
+
}
|
|
195
|
+
return line;
|
|
196
|
+
};
|
|
197
|
+
const getCombinedMessage = (error, message) => {
|
|
198
|
+
const stringifiedError = normalizeLine(`${error}`);
|
|
199
|
+
if (message) {
|
|
200
|
+
return `${message}: ${stringifiedError}`;
|
|
201
|
+
}
|
|
202
|
+
return stringifiedError;
|
|
203
|
+
};
|
|
204
|
+
const NewLine$3 = '\n';
|
|
205
|
+
const getNewLineIndex$1 = (string, startIndex = undefined) => {
|
|
206
|
+
return string.indexOf(NewLine$3, startIndex);
|
|
207
|
+
};
|
|
208
|
+
const mergeStacks = (parent, child) => {
|
|
209
|
+
if (!child) {
|
|
210
|
+
return parent;
|
|
211
|
+
}
|
|
212
|
+
const parentNewLineIndex = getNewLineIndex$1(parent);
|
|
213
|
+
const childNewLineIndex = getNewLineIndex$1(child);
|
|
214
|
+
if (childNewLineIndex === -1) {
|
|
215
|
+
return parent;
|
|
216
|
+
}
|
|
217
|
+
const parentFirstLine = parent.slice(0, parentNewLineIndex);
|
|
218
|
+
const childRest = child.slice(childNewLineIndex);
|
|
219
|
+
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
220
|
+
if (parentFirstLine.includes(childFirstLine)) {
|
|
221
|
+
return parentFirstLine + childRest;
|
|
222
|
+
}
|
|
223
|
+
return child;
|
|
224
|
+
};
|
|
225
|
+
class VError extends Error {
|
|
226
|
+
constructor(error, message) {
|
|
227
|
+
const combinedMessage = getCombinedMessage(error, message);
|
|
228
|
+
super(combinedMessage);
|
|
229
|
+
this.name = 'VError';
|
|
230
|
+
if (error instanceof Error) {
|
|
231
|
+
this.stack = mergeStacks(this.stack, error.stack);
|
|
232
|
+
}
|
|
233
|
+
if (error.codeFrame) {
|
|
234
|
+
// @ts-ignore
|
|
235
|
+
this.codeFrame = error.codeFrame;
|
|
236
|
+
}
|
|
237
|
+
if (error.code) {
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
this.code = error.code;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
124
244
|
const isMessagePort = value => {
|
|
125
245
|
return value && value instanceof MessagePort;
|
|
126
246
|
};
|
|
@@ -765,7 +885,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
765
885
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
766
886
|
return create$1$1(id, errorProperty);
|
|
767
887
|
};
|
|
768
|
-
const create$
|
|
888
|
+
const create$i = (message, result) => {
|
|
769
889
|
return {
|
|
770
890
|
id: message.id,
|
|
771
891
|
jsonrpc: Two$1,
|
|
@@ -774,7 +894,7 @@ const create$j = (message, result) => {
|
|
|
774
894
|
};
|
|
775
895
|
const getSuccessResponse = (message, result) => {
|
|
776
896
|
const resultProperty = result ?? null;
|
|
777
|
-
return create$
|
|
897
|
+
return create$i(message, resultProperty);
|
|
778
898
|
};
|
|
779
899
|
const getErrorResponseSimple = (id, error) => {
|
|
780
900
|
return {
|
|
@@ -868,7 +988,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
868
988
|
|
|
869
989
|
const Two = '2.0';
|
|
870
990
|
|
|
871
|
-
const create$
|
|
991
|
+
const create$h = (method, params) => {
|
|
872
992
|
return {
|
|
873
993
|
jsonrpc: Two,
|
|
874
994
|
method,
|
|
@@ -876,7 +996,7 @@ const create$i = (method, params) => {
|
|
|
876
996
|
};
|
|
877
997
|
};
|
|
878
998
|
|
|
879
|
-
const create$
|
|
999
|
+
const create$g = (id, method, params) => {
|
|
880
1000
|
const message = {
|
|
881
1001
|
id,
|
|
882
1002
|
jsonrpc: Two,
|
|
@@ -887,12 +1007,12 @@ const create$h = (id, method, params) => {
|
|
|
887
1007
|
};
|
|
888
1008
|
|
|
889
1009
|
let id = 0;
|
|
890
|
-
const create$
|
|
1010
|
+
const create$f = () => {
|
|
891
1011
|
return ++id;
|
|
892
1012
|
};
|
|
893
1013
|
|
|
894
1014
|
const registerPromise = map => {
|
|
895
|
-
const id = create$
|
|
1015
|
+
const id = create$f();
|
|
896
1016
|
const {
|
|
897
1017
|
promise,
|
|
898
1018
|
resolve
|
|
@@ -909,7 +1029,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
909
1029
|
id,
|
|
910
1030
|
promise
|
|
911
1031
|
} = registerPromise(callbacks);
|
|
912
|
-
const message = create$
|
|
1032
|
+
const message = create$g(id, method, params);
|
|
913
1033
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
914
1034
|
ipc.sendAndTransfer(message);
|
|
915
1035
|
} else {
|
|
@@ -945,7 +1065,7 @@ const createRpc = ipc => {
|
|
|
945
1065
|
* @deprecated
|
|
946
1066
|
*/
|
|
947
1067
|
send(method, ...params) {
|
|
948
|
-
const message = create$
|
|
1068
|
+
const message = create$h(method, params);
|
|
949
1069
|
ipc.send(message);
|
|
950
1070
|
}
|
|
951
1071
|
};
|
|
@@ -985,7 +1105,7 @@ const listen$1 = async (module, options) => {
|
|
|
985
1105
|
return ipc;
|
|
986
1106
|
};
|
|
987
1107
|
|
|
988
|
-
const create$
|
|
1108
|
+
const create$e = async ({
|
|
989
1109
|
commandMap,
|
|
990
1110
|
isMessagePortOpen = true,
|
|
991
1111
|
messagePort
|
|
@@ -1003,7 +1123,7 @@ const create$f = async ({
|
|
|
1003
1123
|
return rpc;
|
|
1004
1124
|
};
|
|
1005
1125
|
|
|
1006
|
-
const create$
|
|
1126
|
+
const create$d = async ({
|
|
1007
1127
|
commandMap,
|
|
1008
1128
|
isMessagePortOpen,
|
|
1009
1129
|
send
|
|
@@ -1013,7 +1133,7 @@ const create$e = async ({
|
|
|
1013
1133
|
port2
|
|
1014
1134
|
} = new MessageChannel();
|
|
1015
1135
|
await send(port1);
|
|
1016
|
-
return create$
|
|
1136
|
+
return create$e({
|
|
1017
1137
|
commandMap,
|
|
1018
1138
|
isMessagePortOpen,
|
|
1019
1139
|
messagePort: port2
|
|
@@ -1048,13 +1168,13 @@ const createSharedLazyRpc = factory => {
|
|
|
1048
1168
|
};
|
|
1049
1169
|
};
|
|
1050
1170
|
|
|
1051
|
-
const create$
|
|
1171
|
+
const create$c = async ({
|
|
1052
1172
|
commandMap,
|
|
1053
1173
|
isMessagePortOpen,
|
|
1054
1174
|
send
|
|
1055
1175
|
}) => {
|
|
1056
1176
|
return createSharedLazyRpc(() => {
|
|
1057
|
-
return create$
|
|
1177
|
+
return create$d({
|
|
1058
1178
|
commandMap,
|
|
1059
1179
|
isMessagePortOpen,
|
|
1060
1180
|
send
|
|
@@ -1062,17 +1182,17 @@ const create$d = async ({
|
|
|
1062
1182
|
});
|
|
1063
1183
|
};
|
|
1064
1184
|
|
|
1065
|
-
const create$
|
|
1185
|
+
const create$b = async ({
|
|
1066
1186
|
commandMap,
|
|
1067
1187
|
messagePort
|
|
1068
1188
|
}) => {
|
|
1069
|
-
return create$
|
|
1189
|
+
return create$e({
|
|
1070
1190
|
commandMap,
|
|
1071
1191
|
messagePort
|
|
1072
1192
|
});
|
|
1073
1193
|
};
|
|
1074
1194
|
|
|
1075
|
-
const create$
|
|
1195
|
+
const create$a = async ({
|
|
1076
1196
|
commandMap
|
|
1077
1197
|
}) => {
|
|
1078
1198
|
// TODO create a commandMap per rpc instance
|
|
@@ -1115,7 +1235,7 @@ const remove$8 = id => {
|
|
|
1115
1235
|
};
|
|
1116
1236
|
|
|
1117
1237
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1118
|
-
const create$
|
|
1238
|
+
const create$9 = rpcId => {
|
|
1119
1239
|
return {
|
|
1120
1240
|
async dispose() {
|
|
1121
1241
|
const rpc = get$7(rpcId);
|
|
@@ -1233,7 +1353,7 @@ const FocusEditorText$1 = 12;
|
|
|
1233
1353
|
const {
|
|
1234
1354
|
invoke: invoke$f,
|
|
1235
1355
|
set: set$d
|
|
1236
|
-
} = create$
|
|
1356
|
+
} = create$9(ExtensionHostWorker);
|
|
1237
1357
|
|
|
1238
1358
|
const ExtensionHost = {
|
|
1239
1359
|
__proto__: null,
|
|
@@ -1244,7 +1364,7 @@ const ExtensionHost = {
|
|
|
1244
1364
|
const {
|
|
1245
1365
|
invoke: invoke$e,
|
|
1246
1366
|
set: set$c
|
|
1247
|
-
} = create$
|
|
1367
|
+
} = create$9(ExtensionManagementWorker);
|
|
1248
1368
|
const getLanguages$1 = (platform, assetDir) => {
|
|
1249
1369
|
return invoke$e('Extensions.getLanguages', platform, assetDir);
|
|
1250
1370
|
};
|
|
@@ -1252,45 +1372,50 @@ const getLanguages$1 = (platform, assetDir) => {
|
|
|
1252
1372
|
const {
|
|
1253
1373
|
invoke: invoke$d,
|
|
1254
1374
|
set: set$b
|
|
1255
|
-
} = create$
|
|
1375
|
+
} = create$9(OpenerWorker);
|
|
1256
1376
|
const openUrl = async (url, platform) => {
|
|
1257
1377
|
return invoke$d('Open.openUrl', url, platform);
|
|
1258
1378
|
};
|
|
1259
1379
|
|
|
1260
1380
|
const {
|
|
1261
1381
|
invoke: invoke$c,
|
|
1262
|
-
invokeAndTransfer,
|
|
1263
1382
|
set: set$a
|
|
1264
|
-
} = create$
|
|
1383
|
+
} = create$9(IconThemeWorker);
|
|
1384
|
+
|
|
1385
|
+
const {
|
|
1386
|
+
invoke: invoke$b,
|
|
1387
|
+
invokeAndTransfer,
|
|
1388
|
+
set: set$9
|
|
1389
|
+
} = create$9(RendererWorker$1);
|
|
1265
1390
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1266
1391
|
number(uid);
|
|
1267
1392
|
number(menuId);
|
|
1268
1393
|
number(x);
|
|
1269
1394
|
number(y);
|
|
1270
|
-
await invoke$
|
|
1395
|
+
await invoke$b('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1271
1396
|
};
|
|
1272
1397
|
const sendMessagePortToOpenerWorker = async (port, rpcId) => {
|
|
1273
1398
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1274
1399
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
|
|
1275
1400
|
};
|
|
1276
1401
|
const readFile = async uri => {
|
|
1277
|
-
return invoke$
|
|
1402
|
+
return invoke$b('FileSystem.readFile', uri);
|
|
1278
1403
|
};
|
|
1279
1404
|
const handleWorkspaceRefresh = async () => {
|
|
1280
|
-
return invoke$
|
|
1405
|
+
return invoke$b('Layout.handleWorkspaceRefresh');
|
|
1281
1406
|
};
|
|
1282
1407
|
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1283
1408
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1284
1409
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1285
1410
|
};
|
|
1286
1411
|
const writeClipBoardText = async text => {
|
|
1287
|
-
await invoke$
|
|
1412
|
+
await invoke$b('ClipBoard.writeText', /* text */text);
|
|
1288
1413
|
};
|
|
1289
1414
|
const readClipBoardText = async () => {
|
|
1290
|
-
return invoke$
|
|
1415
|
+
return invoke$b('ClipBoard.readText');
|
|
1291
1416
|
};
|
|
1292
1417
|
const activateByEvent$1 = (event, assetDir, platform) => {
|
|
1293
|
-
return invoke$
|
|
1418
|
+
return invoke$b('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
|
|
1294
1419
|
};
|
|
1295
1420
|
const sendMessagePortToTextMeasurementWorker = async port => {
|
|
1296
1421
|
const command = 'TextMeasurement.handleMessagePort';
|
|
@@ -1301,10 +1426,10 @@ const sendMessagePortToExtensionManagementWorker$1 = async (port, rpcId) => {
|
|
|
1301
1426
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1302
1427
|
};
|
|
1303
1428
|
const getPreference = async key => {
|
|
1304
|
-
return await invoke$
|
|
1429
|
+
return await invoke$b('Preferences.get', key);
|
|
1305
1430
|
};
|
|
1306
1431
|
const openUri = async (uri, focus, options) => {
|
|
1307
|
-
await invoke$
|
|
1432
|
+
await invoke$b('Main.openUri', uri, focus, options);
|
|
1308
1433
|
};
|
|
1309
1434
|
const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
|
|
1310
1435
|
await invokeAndTransfer('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
@@ -1315,7 +1440,7 @@ const RendererWorker = {
|
|
|
1315
1440
|
activateByEvent: activateByEvent$1,
|
|
1316
1441
|
getPreference,
|
|
1317
1442
|
handleWorkspaceRefresh,
|
|
1318
|
-
invoke: invoke$
|
|
1443
|
+
invoke: invoke$b,
|
|
1319
1444
|
invokeAndTransfer,
|
|
1320
1445
|
openUri,
|
|
1321
1446
|
readClipBoardText,
|
|
@@ -1325,20 +1450,15 @@ const RendererWorker = {
|
|
|
1325
1450
|
sendMessagePortToOpenerWorker,
|
|
1326
1451
|
sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
|
|
1327
1452
|
sendMessagePortToTextMeasurementWorker,
|
|
1328
|
-
set: set$
|
|
1453
|
+
set: set$9,
|
|
1329
1454
|
showContextMenu2,
|
|
1330
1455
|
writeClipBoardText
|
|
1331
1456
|
};
|
|
1332
1457
|
|
|
1333
|
-
const {
|
|
1334
|
-
invoke: invoke$b,
|
|
1335
|
-
set: set$9
|
|
1336
|
-
} = create$a(IconThemeWorker);
|
|
1337
|
-
|
|
1338
1458
|
const {
|
|
1339
1459
|
invoke: invoke$a,
|
|
1340
1460
|
set: set$8
|
|
1341
|
-
} = create$
|
|
1461
|
+
} = create$9(MarkdownWorker);
|
|
1342
1462
|
|
|
1343
1463
|
const SyntaxHighlightingWorker = {
|
|
1344
1464
|
__proto__: null,
|
|
@@ -1376,126 +1496,6 @@ const createLazyRpc = rpcId => {
|
|
|
1376
1496
|
};
|
|
1377
1497
|
};
|
|
1378
1498
|
|
|
1379
|
-
const toCommandId = key => {
|
|
1380
|
-
const dotIndex = key.indexOf('.');
|
|
1381
|
-
return key.slice(dotIndex + 1);
|
|
1382
|
-
};
|
|
1383
|
-
const create$9 = () => {
|
|
1384
|
-
const states = Object.create(null);
|
|
1385
|
-
const commandMapRef = {};
|
|
1386
|
-
return {
|
|
1387
|
-
clear() {
|
|
1388
|
-
for (const key of Object.keys(states)) {
|
|
1389
|
-
delete states[key];
|
|
1390
|
-
}
|
|
1391
|
-
},
|
|
1392
|
-
diff(uid, modules, numbers) {
|
|
1393
|
-
const {
|
|
1394
|
-
newState,
|
|
1395
|
-
oldState
|
|
1396
|
-
} = states[uid];
|
|
1397
|
-
const diffResult = [];
|
|
1398
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1399
|
-
const fn = modules[i];
|
|
1400
|
-
if (!fn(oldState, newState)) {
|
|
1401
|
-
diffResult.push(numbers[i]);
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
return diffResult;
|
|
1405
|
-
},
|
|
1406
|
-
dispose(uid) {
|
|
1407
|
-
delete states[uid];
|
|
1408
|
-
},
|
|
1409
|
-
get(uid) {
|
|
1410
|
-
return states[uid];
|
|
1411
|
-
},
|
|
1412
|
-
getCommandIds() {
|
|
1413
|
-
const keys = Object.keys(commandMapRef);
|
|
1414
|
-
const ids = keys.map(toCommandId);
|
|
1415
|
-
return ids;
|
|
1416
|
-
},
|
|
1417
|
-
getKeys() {
|
|
1418
|
-
return Object.keys(states).map(key => {
|
|
1419
|
-
return Number.parseFloat(key);
|
|
1420
|
-
});
|
|
1421
|
-
},
|
|
1422
|
-
registerCommands(commandMap) {
|
|
1423
|
-
Object.assign(commandMapRef, commandMap);
|
|
1424
|
-
},
|
|
1425
|
-
set(uid, oldState, newState) {
|
|
1426
|
-
states[uid] = {
|
|
1427
|
-
newState,
|
|
1428
|
-
oldState
|
|
1429
|
-
};
|
|
1430
|
-
},
|
|
1431
|
-
wrapCommand(fn) {
|
|
1432
|
-
const wrapped = async (uid, ...args) => {
|
|
1433
|
-
const {
|
|
1434
|
-
newState,
|
|
1435
|
-
oldState
|
|
1436
|
-
} = states[uid];
|
|
1437
|
-
const newerState = await fn(newState, ...args);
|
|
1438
|
-
if (oldState === newerState || newState === newerState) {
|
|
1439
|
-
return;
|
|
1440
|
-
}
|
|
1441
|
-
const latestOld = states[uid];
|
|
1442
|
-
const latestNew = {
|
|
1443
|
-
...latestOld.newState,
|
|
1444
|
-
...newerState
|
|
1445
|
-
};
|
|
1446
|
-
states[uid] = {
|
|
1447
|
-
newState: latestNew,
|
|
1448
|
-
oldState: latestOld.oldState
|
|
1449
|
-
};
|
|
1450
|
-
};
|
|
1451
|
-
return wrapped;
|
|
1452
|
-
},
|
|
1453
|
-
wrapGetter(fn) {
|
|
1454
|
-
const wrapped = (uid, ...args) => {
|
|
1455
|
-
const {
|
|
1456
|
-
newState
|
|
1457
|
-
} = states[uid];
|
|
1458
|
-
return fn(newState, ...args);
|
|
1459
|
-
};
|
|
1460
|
-
return wrapped;
|
|
1461
|
-
},
|
|
1462
|
-
wrapLoadContent(fn) {
|
|
1463
|
-
const wrapped = async (uid, ...args) => {
|
|
1464
|
-
const {
|
|
1465
|
-
newState,
|
|
1466
|
-
oldState
|
|
1467
|
-
} = states[uid];
|
|
1468
|
-
const result = await fn(newState, ...args);
|
|
1469
|
-
const {
|
|
1470
|
-
error,
|
|
1471
|
-
state
|
|
1472
|
-
} = result;
|
|
1473
|
-
if (oldState === state || newState === state) {
|
|
1474
|
-
return {
|
|
1475
|
-
error
|
|
1476
|
-
};
|
|
1477
|
-
}
|
|
1478
|
-
const latestOld = states[uid];
|
|
1479
|
-
const latestNew = {
|
|
1480
|
-
...latestOld.newState,
|
|
1481
|
-
...state
|
|
1482
|
-
};
|
|
1483
|
-
states[uid] = {
|
|
1484
|
-
newState: latestNew,
|
|
1485
|
-
oldState: latestOld.oldState
|
|
1486
|
-
};
|
|
1487
|
-
return {
|
|
1488
|
-
error
|
|
1489
|
-
};
|
|
1490
|
-
};
|
|
1491
|
-
return wrapped;
|
|
1492
|
-
}
|
|
1493
|
-
};
|
|
1494
|
-
};
|
|
1495
|
-
const terminate = () => {
|
|
1496
|
-
globalThis.close();
|
|
1497
|
-
};
|
|
1498
|
-
|
|
1499
1499
|
// TODO add tests for this
|
|
1500
1500
|
const activateByEvent = async (event, assetDir, platform) => {
|
|
1501
1501
|
string(event);
|
|
@@ -1512,7 +1512,7 @@ const codeGeneratorAccept = state => {
|
|
|
1512
1512
|
const ModuleWorkerAndWorkaroundForChromeDevtoolsBug = 6;
|
|
1513
1513
|
|
|
1514
1514
|
const launchWorker = async (name, url, intializeCommand) => {
|
|
1515
|
-
const rpc = await create$
|
|
1515
|
+
const rpc = await create$d({
|
|
1516
1516
|
commandMap: {},
|
|
1517
1517
|
isMessagePortOpen: true,
|
|
1518
1518
|
async send(port) {
|
|
@@ -1567,7 +1567,7 @@ const loadContent$3 = async (state, parentUid) => {
|
|
|
1567
1567
|
};
|
|
1568
1568
|
};
|
|
1569
1569
|
|
|
1570
|
-
const editorStates = create$
|
|
1570
|
+
const editorStates = create$j();
|
|
1571
1571
|
const {
|
|
1572
1572
|
getCommandIds,
|
|
1573
1573
|
registerCommands,
|
|
@@ -1936,10 +1936,11 @@ const {
|
|
|
1936
1936
|
|
|
1937
1937
|
const state$7 = {
|
|
1938
1938
|
pending: Object.create(null),
|
|
1939
|
+
tokenizePaths: Object.create(null),
|
|
1939
1940
|
tokenizers: Object.create(null)
|
|
1940
1941
|
};
|
|
1941
1942
|
const has = languageId => {
|
|
1942
|
-
return
|
|
1943
|
+
return Object.hasOwn(state$7.tokenizers, languageId);
|
|
1943
1944
|
};
|
|
1944
1945
|
const set$4 = (languageId, tokenizer) => {
|
|
1945
1946
|
state$7.tokenizers[languageId] = tokenizer;
|
|
@@ -1947,8 +1948,21 @@ const set$4 = (languageId, tokenizer) => {
|
|
|
1947
1948
|
const get$4 = languageId => {
|
|
1948
1949
|
return state$7.tokenizers[languageId];
|
|
1949
1950
|
};
|
|
1951
|
+
const setTokenizePath = (languageId, tokenizePath) => {
|
|
1952
|
+
state$7.tokenizePaths[languageId] = tokenizePath;
|
|
1953
|
+
};
|
|
1954
|
+
const getTokenizePath$1 = languageId => {
|
|
1955
|
+
return state$7.tokenizePaths[languageId] || '';
|
|
1956
|
+
};
|
|
1957
|
+
const setTokenizePaths = languages => {
|
|
1958
|
+
for (const language of languages) {
|
|
1959
|
+
if (language && language.id && language.tokenize) {
|
|
1960
|
+
setTokenizePath(language.id, language.tokenize);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
};
|
|
1950
1964
|
const isPending = languageId => {
|
|
1951
|
-
return
|
|
1965
|
+
return Object.hasOwn(state$7.pending, languageId);
|
|
1952
1966
|
};
|
|
1953
1967
|
|
|
1954
1968
|
const tokenMaps = Object.create(null);
|
|
@@ -1964,6 +1978,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
1964
1978
|
if (!tokenizePath) {
|
|
1965
1979
|
return;
|
|
1966
1980
|
}
|
|
1981
|
+
setTokenizePath(languageId, tokenizePath);
|
|
1967
1982
|
if (getEnabled$1()) {
|
|
1968
1983
|
// @ts-ignore
|
|
1969
1984
|
const tokenMap = await invoke$8('Tokenizer.load', languageId, tokenizePath);
|
|
@@ -2008,10 +2023,37 @@ const get$2 = id => {
|
|
|
2008
2023
|
return tokenizers[id] || TokenizePlainText;
|
|
2009
2024
|
};
|
|
2010
2025
|
|
|
2026
|
+
const getEmbeddedTokenization = (langageId, line, embeddedLanguage, embeddedLanguageStart, embeddedLanguageEnd, topContexts, tokenizersToLoad) => {
|
|
2027
|
+
const embeddedTokenizer = getTokenizer(embeddedLanguage);
|
|
2028
|
+
if (embeddedLanguageStart !== line.length && embeddedTokenizer && embeddedTokenizer !== TokenizePlainText) {
|
|
2029
|
+
const isFull = embeddedLanguageStart === 0 && embeddedLanguageEnd === line.length;
|
|
2030
|
+
const partialLine = line.slice(embeddedLanguageStart, embeddedLanguageEnd);
|
|
2031
|
+
const embedResult = safeTokenizeLine(langageId, embeddedTokenizer.tokenizeLine, partialLine, topContexts[embeddedLanguage] || getInitialLineState(embeddedTokenizer.initialLineState), embeddedTokenizer.hasArrayReturn);
|
|
2032
|
+
topContexts[embeddedLanguage] = embedResult;
|
|
2033
|
+
if (embedResult.embeddedLanguage) {
|
|
2034
|
+
const nested = getEmbeddedTokenization(langageId, partialLine, embedResult.embeddedLanguage, embedResult.embeddedLanguageStart, embedResult.embeddedLanguageEnd, topContexts, tokenizersToLoad);
|
|
2035
|
+
if (nested?.isFull) {
|
|
2036
|
+
return nested;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
return {
|
|
2040
|
+
isFull,
|
|
2041
|
+
result: embedResult,
|
|
2042
|
+
TokenMap: embeddedTokenizer.TokenMap
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
tokenizersToLoad.push(embeddedLanguage);
|
|
2046
|
+
topContexts[embeddedLanguage] = undefined;
|
|
2047
|
+
return {
|
|
2048
|
+
isFull: false,
|
|
2049
|
+
result: {},
|
|
2050
|
+
TokenMap: []
|
|
2051
|
+
};
|
|
2052
|
+
};
|
|
2011
2053
|
const getTokensViewportEmbedded = (langageId, lines, lineCache, linesWithEmbed) => {
|
|
2012
2054
|
const tokenizersToLoad = [];
|
|
2013
2055
|
const embeddedResults = [];
|
|
2014
|
-
|
|
2056
|
+
const topContexts = Object.create(null);
|
|
2015
2057
|
for (const index of linesWithEmbed) {
|
|
2016
2058
|
const result = lineCache[index + 1];
|
|
2017
2059
|
const line = lines[index];
|
|
@@ -2021,19 +2063,7 @@ const getTokensViewportEmbedded = (langageId, lines, lineCache, linesWithEmbed)
|
|
|
2021
2063
|
embeddedLanguageEnd,
|
|
2022
2064
|
embeddedLanguageStart
|
|
2023
2065
|
} = result;
|
|
2024
|
-
|
|
2025
|
-
if (embeddedLanguageStart !== line.length && embeddedTokenizer && embeddedTokenizer !== TokenizePlainText) {
|
|
2026
|
-
const isFull = embeddedLanguageStart === 0 && embeddedLanguageEnd === line.length;
|
|
2027
|
-
const partialLine = line.slice(embeddedLanguageStart, embeddedLanguageEnd);
|
|
2028
|
-
const embedResult = safeTokenizeLine(langageId, embeddedTokenizer.tokenizeLine, partialLine, topContext || getInitialLineState(embeddedTokenizer.initialLineState), embeddedTokenizer.hasArrayReturn);
|
|
2029
|
-
topContext = embedResult;
|
|
2030
|
-
result.embeddedResultIndex = embeddedResults.length;
|
|
2031
|
-
embeddedResults.push({
|
|
2032
|
-
isFull,
|
|
2033
|
-
result: embedResult,
|
|
2034
|
-
TokenMap: embeddedTokenizer.TokenMap
|
|
2035
|
-
});
|
|
2036
|
-
} else if (line.length === 0) {
|
|
2066
|
+
if (line.length === 0) {
|
|
2037
2067
|
const embedResult = {
|
|
2038
2068
|
tokens: []
|
|
2039
2069
|
};
|
|
@@ -2044,16 +2074,13 @@ const getTokensViewportEmbedded = (langageId, lines, lineCache, linesWithEmbed)
|
|
|
2044
2074
|
TokenMap: []
|
|
2045
2075
|
});
|
|
2046
2076
|
} else {
|
|
2047
|
-
|
|
2048
|
-
embeddedResults.push(
|
|
2049
|
-
isFull: false,
|
|
2050
|
-
result: {},
|
|
2051
|
-
TokenMap: []
|
|
2052
|
-
});
|
|
2053
|
-
topContext = undefined;
|
|
2077
|
+
result.embeddedResultIndex = embeddedResults.length;
|
|
2078
|
+
embeddedResults.push(getEmbeddedTokenization(langageId, line, embeddedLanguage, embeddedLanguageStart, embeddedLanguageEnd, topContexts, tokenizersToLoad));
|
|
2054
2079
|
}
|
|
2055
2080
|
} else {
|
|
2056
|
-
|
|
2081
|
+
for (const embeddedLanguage of Object.keys(topContexts)) {
|
|
2082
|
+
topContexts[embeddedLanguage] = undefined;
|
|
2083
|
+
}
|
|
2057
2084
|
}
|
|
2058
2085
|
}
|
|
2059
2086
|
return {
|
|
@@ -2155,8 +2182,8 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
|
|
|
2155
2182
|
|
|
2156
2183
|
const loadTokenizers = async languageIds => {
|
|
2157
2184
|
for (const languageId of languageIds) {
|
|
2158
|
-
|
|
2159
|
-
await loadTokenizer(languageId);
|
|
2185
|
+
const tokenizePath = getTokenizePath$1(languageId);
|
|
2186
|
+
await loadTokenizer(languageId, tokenizePath);
|
|
2160
2187
|
}
|
|
2161
2188
|
};
|
|
2162
2189
|
|
|
@@ -2169,7 +2196,7 @@ const Tab = '\t';
|
|
|
2169
2196
|
|
|
2170
2197
|
const normalizeText = (text, normalize, tabSize) => {
|
|
2171
2198
|
if (normalize) {
|
|
2172
|
-
return text.replaceAll(Tab, Space.repeat(tabSize));
|
|
2199
|
+
return text.replaceAll(Tab, () => Space.repeat(tabSize));
|
|
2173
2200
|
}
|
|
2174
2201
|
return text;
|
|
2175
2202
|
};
|
|
@@ -2232,11 +2259,9 @@ const applyEdits = (textDocument, changes) => {
|
|
|
2232
2259
|
const startColumnIndex = change.start.columnIndex;
|
|
2233
2260
|
const endColumnIndex = change.end.columnIndex;
|
|
2234
2261
|
const {
|
|
2262
|
+
deleted,
|
|
2235
2263
|
inserted
|
|
2236
2264
|
} = change;
|
|
2237
|
-
const {
|
|
2238
|
-
deleted
|
|
2239
|
-
} = change;
|
|
2240
2265
|
number(startRowIndex);
|
|
2241
2266
|
number(endRowIndex);
|
|
2242
2267
|
number(startColumnIndex);
|
|
@@ -2362,6 +2387,8 @@ const positionAt = (textDocument, offset) => {
|
|
|
2362
2387
|
};
|
|
2363
2388
|
};
|
|
2364
2389
|
|
|
2390
|
+
const maxTokenizerLoadPasses = 10;
|
|
2391
|
+
|
|
2365
2392
|
// const getTokensIncremental = (editor, min, max) => {
|
|
2366
2393
|
// const currentLength = editor.lineStateCache.length
|
|
2367
2394
|
// const tokens = []
|
|
@@ -2418,6 +2445,24 @@ const getStartDefaults = (tokens, minOffset) => {
|
|
|
2418
2445
|
startIndex
|
|
2419
2446
|
};
|
|
2420
2447
|
};
|
|
2448
|
+
const hasDecorationOverlap = (decorationMap, tokenStart, tokenEnd) => {
|
|
2449
|
+
for (const [decorationStart, {
|
|
2450
|
+
end: decorationEnd
|
|
2451
|
+
}] of decorationMap) {
|
|
2452
|
+
if (decorationStart < tokenEnd && decorationEnd > tokenStart) {
|
|
2453
|
+
return true;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
return false;
|
|
2457
|
+
};
|
|
2458
|
+
const getActiveDecoration = (decorationMap, currentPos) => {
|
|
2459
|
+
for (const [decorationStart, decoration] of decorationMap) {
|
|
2460
|
+
if (decorationStart <= currentPos && decoration.end > currentPos) {
|
|
2461
|
+
return decoration;
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
return undefined;
|
|
2465
|
+
};
|
|
2421
2466
|
const getLineInfoEmbeddedFull = (embeddedResults, tokenResults, line, decorations, lineOffset, normalize, tabSize, width, deltaX, averageCharWidth, minOffset, maxOffset) => {
|
|
2422
2467
|
const lineInfo = [];
|
|
2423
2468
|
|
|
@@ -2455,29 +2500,13 @@ const getLineInfoEmbeddedFull = (embeddedResults, tokenResults, line, decoration
|
|
|
2455
2500
|
const tokenType = embeddedTokens[i];
|
|
2456
2501
|
const tokenLength = embeddedTokens[i + 1];
|
|
2457
2502
|
const tokenEnd = start + tokenLength;
|
|
2458
|
-
|
|
2459
|
-
// Check if any decorations overlap with this token
|
|
2460
|
-
let hasOverlap = false;
|
|
2461
|
-
for (const [decorationStart, {
|
|
2462
|
-
end: decorationEnd
|
|
2463
|
-
}] of decorationMap) {
|
|
2464
|
-
if (decorationStart < tokenEnd && decorationEnd > start) {
|
|
2465
|
-
hasOverlap = true;
|
|
2466
|
-
break;
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2503
|
+
const hasOverlap = hasDecorationOverlap(decorationMap, start, tokenEnd);
|
|
2469
2504
|
if (hasOverlap) {
|
|
2470
2505
|
// Token has decoration overlap - split into parts
|
|
2471
2506
|
let currentPos = start;
|
|
2472
2507
|
while (currentPos < tokenEnd) {
|
|
2473
2508
|
// Find if current position is inside a decoration
|
|
2474
|
-
|
|
2475
|
-
for (const [decorationStart, decoration] of decorationMap) {
|
|
2476
|
-
if (decorationStart <= currentPos && decoration.end > currentPos) {
|
|
2477
|
-
activeDecoration = decoration;
|
|
2478
|
-
break;
|
|
2479
|
-
}
|
|
2480
|
-
}
|
|
2509
|
+
const activeDecoration = getActiveDecoration(decorationMap, currentPos);
|
|
2481
2510
|
if (activeDecoration) {
|
|
2482
2511
|
// Render decorated part
|
|
2483
2512
|
const partEnd = Math.min(tokenEnd, activeDecoration.end);
|
|
@@ -2525,7 +2554,7 @@ const getLineInfoEmbeddedFull = (embeddedResults, tokenResults, line, decoration
|
|
|
2525
2554
|
};
|
|
2526
2555
|
const getOffsets = (deltaX, width, averageCharWidth) => {
|
|
2527
2556
|
// TODO accurately measure char widths using offscreen canvas
|
|
2528
|
-
// and use fast measurements for monospace
|
|
2557
|
+
// and use fast measurements for monospace ASCII text
|
|
2529
2558
|
if (deltaX === 0) {
|
|
2530
2559
|
return {
|
|
2531
2560
|
maxOffset: Math.ceil(width / averageCharWidth),
|
|
@@ -2581,29 +2610,13 @@ const getLineInfoDefault = (line, tokenResults, embeddedResults, decorations, To
|
|
|
2581
2610
|
const tokenType = tokens[i];
|
|
2582
2611
|
const tokenLength = tokens[i + 1];
|
|
2583
2612
|
const tokenEnd = start + tokenLength;
|
|
2584
|
-
|
|
2585
|
-
// Check if any decorations overlap with this token
|
|
2586
|
-
let hasOverlap = false;
|
|
2587
|
-
for (const [decorationStart, {
|
|
2588
|
-
end: decorationEnd
|
|
2589
|
-
}] of decorationMap) {
|
|
2590
|
-
if (decorationStart < tokenEnd && decorationEnd > start) {
|
|
2591
|
-
hasOverlap = true;
|
|
2592
|
-
break;
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2613
|
+
const hasOverlap = hasDecorationOverlap(decorationMap, start, tokenEnd);
|
|
2595
2614
|
if (hasOverlap) {
|
|
2596
2615
|
// Token has decoration overlap - split into parts
|
|
2597
2616
|
let currentPos = start;
|
|
2598
2617
|
while (currentPos < tokenEnd) {
|
|
2599
2618
|
// Find if current position is inside a decoration
|
|
2600
|
-
|
|
2601
|
-
for (const [decorationStart, decoration] of decorationMap) {
|
|
2602
|
-
if (decorationStart <= currentPos && decoration.end > currentPos) {
|
|
2603
|
-
activeDecoration = decoration;
|
|
2604
|
-
break;
|
|
2605
|
-
}
|
|
2606
|
-
}
|
|
2619
|
+
const activeDecoration = getActiveDecoration(decorationMap, currentPos);
|
|
2607
2620
|
if (activeDecoration) {
|
|
2608
2621
|
// Render decorated part
|
|
2609
2622
|
const partEnd = Math.min(tokenEnd, activeDecoration.end);
|
|
@@ -2722,20 +2735,27 @@ const getVisible$1 = async (editor, syncIncremental) => {
|
|
|
2722
2735
|
} = editor;
|
|
2723
2736
|
const maxLineY = Math.min(minLineY + numberOfVisibleLines, lines.length);
|
|
2724
2737
|
// @ts-ignore
|
|
2725
|
-
|
|
2738
|
+
let {
|
|
2726
2739
|
embeddedResults,
|
|
2727
2740
|
tokenizersToLoad,
|
|
2728
2741
|
tokens
|
|
2729
2742
|
} = await getTokensViewport2(editor, minLineY, maxLineY, syncIncremental);
|
|
2743
|
+
for (let i = 0; tokenizersToLoad.length > 0 && i < maxTokenizerLoadPasses; i++) {
|
|
2744
|
+
await loadTokenizers(tokenizersToLoad);
|
|
2745
|
+
// @ts-ignore
|
|
2746
|
+
const refreshed = await getTokensViewport2(editor, minLineY, maxLineY, syncIncremental);
|
|
2747
|
+
({
|
|
2748
|
+
embeddedResults,
|
|
2749
|
+
tokenizersToLoad,
|
|
2750
|
+
tokens
|
|
2751
|
+
} = refreshed);
|
|
2752
|
+
}
|
|
2730
2753
|
const minLineOffset = await offsetAtSync(editor, minLineY, 0);
|
|
2731
2754
|
const averageCharWidth = charWidth;
|
|
2732
2755
|
const {
|
|
2733
2756
|
differences,
|
|
2734
2757
|
result
|
|
2735
2758
|
} = getLineInfosViewport(editor, tokens, embeddedResults, minLineY, maxLineY, minLineOffset, width, deltaX, averageCharWidth);
|
|
2736
|
-
if (tokenizersToLoad.length > 0) {
|
|
2737
|
-
loadTokenizers(tokenizersToLoad);
|
|
2738
|
-
}
|
|
2739
2759
|
return {
|
|
2740
2760
|
differences,
|
|
2741
2761
|
textInfos: result
|
|
@@ -2875,7 +2895,7 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
2875
2895
|
* @returns Array of regex matches
|
|
2876
2896
|
*/
|
|
2877
2897
|
const getRegexMatches = (text, regex) => {
|
|
2878
|
-
return
|
|
2898
|
+
return text.matchAll(regex).toArray();
|
|
2879
2899
|
};
|
|
2880
2900
|
|
|
2881
2901
|
// URL matching regex pattern - matches common URL schemes
|
|
@@ -2983,7 +3003,7 @@ const state$6 = Object.create(null);
|
|
|
2983
3003
|
const registerListener$1 = (listenerType, rpcId) => {
|
|
2984
3004
|
number(listenerType);
|
|
2985
3005
|
number(rpcId);
|
|
2986
|
-
if (!state$6
|
|
3006
|
+
if (!Object.hasOwn(state$6, listenerType)) {
|
|
2987
3007
|
state$6[listenerType] = [];
|
|
2988
3008
|
}
|
|
2989
3009
|
|
|
@@ -3001,7 +3021,7 @@ const registerListener$1 = (listenerType, rpcId) => {
|
|
|
3001
3021
|
const unregisterListener$1 = (listenerType, rpcId) => {
|
|
3002
3022
|
number(listenerType);
|
|
3003
3023
|
number(rpcId);
|
|
3004
|
-
if (state$6
|
|
3024
|
+
if (Object.hasOwn(state$6, listenerType)) {
|
|
3005
3025
|
const index = state$6[listenerType].indexOf(rpcId);
|
|
3006
3026
|
if (index !== -1) {
|
|
3007
3027
|
state$6[listenerType].splice(index, 1);
|
|
@@ -3126,13 +3146,13 @@ const measureTextWidthFast = async (text, charWidth) => {
|
|
|
3126
3146
|
};
|
|
3127
3147
|
|
|
3128
3148
|
const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
3129
|
-
const width = await invoke$
|
|
3149
|
+
const width = await invoke$c('TextMeasurement.measureTextWidth', text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
3130
3150
|
return width;
|
|
3131
3151
|
};
|
|
3132
3152
|
|
|
3133
3153
|
const measureTextWidth = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
3134
3154
|
// TODO maybe have a property for the whole text document
|
|
3135
|
-
// whether the document is
|
|
3155
|
+
// whether the document is ASCII or not
|
|
3136
3156
|
// so that it doesn't need to be checked on every cursor change
|
|
3137
3157
|
// or scroll position change
|
|
3138
3158
|
if (isMonoSpaceFont && isAscii(text)) {
|
|
@@ -3486,7 +3506,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
3486
3506
|
// invalidStartIndex, lineCache, etc. just for testing editorType
|
|
3487
3507
|
const invalidStartIndex = Math.min(editor.invalidStartIndex, changes[0].start.rowIndex);
|
|
3488
3508
|
|
|
3489
|
-
// TODO maybe put undostack into indexeddb so that there is no memory leak in
|
|
3509
|
+
// TODO maybe put undostack into indexeddb so that there is no memory leak in app
|
|
3490
3510
|
// then clear old undostack from indexeddb after 3 days
|
|
3491
3511
|
// TODO should push to undostack after rendering
|
|
3492
3512
|
const autoClosingRanges = applyAutoClosingRangesEdit(editor, changes);
|
|
@@ -3513,10 +3533,12 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
3513
3533
|
}
|
|
3514
3534
|
|
|
3515
3535
|
// Notify registered listeners about editor changes
|
|
3516
|
-
|
|
3536
|
+
try {
|
|
3537
|
+
await notifyListeners(EditorChange, 'handleEditorChanged', editor.uid, editor.uri, changes);
|
|
3538
|
+
} catch (error) {
|
|
3517
3539
|
// Silently ignore notification errors to not interrupt the edit flow
|
|
3518
3540
|
console.warn('Failed to notify editor change listeners:', error);
|
|
3519
|
-
}
|
|
3541
|
+
}
|
|
3520
3542
|
const incrementalEdits = await getIncrementalEdits(editor, newEditorWithDecorations);
|
|
3521
3543
|
const editorWithNewWidgets = await applyWidgetChanges(newEditorWithDecorations, changes);
|
|
3522
3544
|
const newEditor2 = {
|
|
@@ -3936,7 +3958,7 @@ const updateDiagnostics = async newState => {
|
|
|
3936
3958
|
};
|
|
3937
3959
|
set$7(newState.id, latest.oldState, newEditor);
|
|
3938
3960
|
// @ts-ignore
|
|
3939
|
-
await invoke$
|
|
3961
|
+
await invoke$b('Editor.rerender', newState.id);
|
|
3940
3962
|
return newEditor;
|
|
3941
3963
|
} catch (error) {
|
|
3942
3964
|
// @ts-ignore
|
|
@@ -4285,7 +4307,7 @@ const applyWorkspaceEdit = async (editor, changes) => {
|
|
|
4285
4307
|
return editor;
|
|
4286
4308
|
}
|
|
4287
4309
|
// TODO
|
|
4288
|
-
// for now only apply edits to single file, if it matches the
|
|
4310
|
+
// for now only apply edits to single file, if it matches the URI
|
|
4289
4311
|
//
|
|
4290
4312
|
// in the future:
|
|
4291
4313
|
// 1. if a change targets the current editor, apply an edit to this editor
|
|
@@ -4360,9 +4382,7 @@ const create$8 = () => {
|
|
|
4360
4382
|
const segments = segmenter.segment(line);
|
|
4361
4383
|
return segments.containing(index);
|
|
4362
4384
|
},
|
|
4363
|
-
getSegments(line)
|
|
4364
|
-
return segmenter.segment(line);
|
|
4365
|
-
},
|
|
4385
|
+
getSegments: line => segmenter.segment(line),
|
|
4366
4386
|
modelIndex(line, visualIndex) {
|
|
4367
4387
|
const segments = segmenter.segment(line);
|
|
4368
4388
|
let currentVisualIndex = 0;
|
|
@@ -4462,13 +4482,13 @@ const at = async (editor, eventX, eventY) => {
|
|
|
4462
4482
|
y
|
|
4463
4483
|
} = editor;
|
|
4464
4484
|
const rowIndex = Math.floor((eventY - y + deltaY) / rowHeight);
|
|
4465
|
-
const relativeX = eventX - x + deltaX;
|
|
4466
4485
|
if (rowIndex < 0) {
|
|
4467
4486
|
return {
|
|
4468
4487
|
columnIndex: 0,
|
|
4469
4488
|
rowIndex: 0
|
|
4470
4489
|
};
|
|
4471
4490
|
}
|
|
4491
|
+
const relativeX = eventX - x + deltaX;
|
|
4472
4492
|
const clampedRowIndex = clamp(rowIndex, 0, lines.length - 1);
|
|
4473
4493
|
const line = lines[clampedRowIndex];
|
|
4474
4494
|
const columnIndex = await getAccurateColumnIndex(line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, relativeX);
|
|
@@ -4479,7 +4499,7 @@ const at = async (editor, eventX, eventY) => {
|
|
|
4479
4499
|
};
|
|
4480
4500
|
|
|
4481
4501
|
/**
|
|
4482
|
-
* @deprecated this doesn't work for variable width characters (
|
|
4502
|
+
* @deprecated this doesn't work for variable width characters (Unicode/emoji).
|
|
4483
4503
|
* Use position computation in renderer process instead
|
|
4484
4504
|
*
|
|
4485
4505
|
* @param {object} editor
|
|
@@ -4527,7 +4547,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
4527
4547
|
const y$1 = y(editor, rowIndex);
|
|
4528
4548
|
const displayErrorMessage = message;
|
|
4529
4549
|
// @ts-ignore
|
|
4530
|
-
await invoke$
|
|
4550
|
+
await invoke$b('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
|
|
4531
4551
|
if (!isError) {
|
|
4532
4552
|
const handleTimeout = () => {
|
|
4533
4553
|
editorHideMessage(editor);
|
|
@@ -4562,9 +4582,7 @@ const editorHideMessage = async editor => {
|
|
|
4562
4582
|
};
|
|
4563
4583
|
|
|
4564
4584
|
// @ts-ignore
|
|
4565
|
-
const getErrorMessage$4 =
|
|
4566
|
-
return `${error}`;
|
|
4567
|
-
};
|
|
4585
|
+
const getErrorMessage$4 = String;
|
|
4568
4586
|
|
|
4569
4587
|
// @ts-ignore
|
|
4570
4588
|
const getMatchingClosingBrace$1 = brace => {
|
|
@@ -4584,7 +4602,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
4584
4602
|
// @ts-ignore
|
|
4585
4603
|
const offset = offsetAt(editor, editor.cursor);
|
|
4586
4604
|
// @ts-ignore
|
|
4587
|
-
const result = await invoke$
|
|
4605
|
+
const result = await invoke$b('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
4588
4606
|
if (result) {
|
|
4589
4607
|
const closingBrace = getMatchingClosingBrace$1(text);
|
|
4590
4608
|
const insertText = text + closingBrace;
|
|
@@ -5085,7 +5103,7 @@ const tryRegexArray = (partialLine, regexArray) => {
|
|
|
5085
5103
|
return 1;
|
|
5086
5104
|
};
|
|
5087
5105
|
const RE_WORD_LEFT_1 = /(?<![A-Z])[A-Z]+\s*$/;
|
|
5088
|
-
const RE_WORD_LEFT_2 = /[\
|
|
5106
|
+
const RE_WORD_LEFT_2 = /[\u{C0}-\u{17F}\w\-]+>?\s*$/u;
|
|
5089
5107
|
const RE_WORD_LEFT_3 = /[a-zA-Z]+[^a-zA-Z\d]+\s*$/;
|
|
5090
5108
|
const RE_WORD_LEFT_4 = /\s+$/;
|
|
5091
5109
|
const RE_WORD_LEFT_5 = /[^a-zA-Z\d]+\s*$/;
|
|
@@ -5096,7 +5114,7 @@ const wordLeft = (line, columnIndex) => {
|
|
|
5096
5114
|
const partialLine = line.slice(0, columnIndex);
|
|
5097
5115
|
return tryRegexArray(partialLine, RE_WORD_LEFT);
|
|
5098
5116
|
};
|
|
5099
|
-
const RE_WORD_RIGHT_1 = /^\s*[\
|
|
5117
|
+
const RE_WORD_RIGHT_1 = /^\s*[\u{C0}-\u{17F}\w]+/iu;
|
|
5100
5118
|
const RE_WORD_RIGHT_2 = /^[^a-zA-Z\d]+\w*/;
|
|
5101
5119
|
const RE_WORD_RIGHT = [RE_WORD_RIGHT_1, RE_WORD_RIGHT_2];
|
|
5102
5120
|
const wordRight = (line, columnIndex) => {
|
|
@@ -5517,7 +5535,7 @@ const deleteWordRight = editor => {
|
|
|
5517
5535
|
|
|
5518
5536
|
const findAllReferences$1 = async editor => {
|
|
5519
5537
|
// @ts-ignore
|
|
5520
|
-
await invoke$
|
|
5538
|
+
await invoke$b('SideBar.show', 'References', /* focus */true);
|
|
5521
5539
|
return editor;
|
|
5522
5540
|
};
|
|
5523
5541
|
|
|
@@ -5554,7 +5572,7 @@ const format = async editor => {
|
|
|
5554
5572
|
console.error(error);
|
|
5555
5573
|
|
|
5556
5574
|
// TODO configure editor message as widget
|
|
5557
|
-
const displayErrorMessage =
|
|
5575
|
+
const displayErrorMessage = String(error);
|
|
5558
5576
|
await editorShowMessage(editor, 0, 0, displayErrorMessage, true);
|
|
5559
5577
|
return editor;
|
|
5560
5578
|
}
|
|
@@ -5605,7 +5623,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
|
|
|
5605
5623
|
// @ts-ignore
|
|
5606
5624
|
const getDefinition = async (editor, offset) => {
|
|
5607
5625
|
// @ts-ignore
|
|
5608
|
-
const definition = await invoke$
|
|
5626
|
+
const definition = await invoke$b('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
|
|
5609
5627
|
return definition;
|
|
5610
5628
|
};
|
|
5611
5629
|
|
|
@@ -5838,7 +5856,7 @@ const goTo = async ({
|
|
|
5838
5856
|
// TODO possible to do this with events/state machine instead of promises -> enables canceling operations / concurrent calls
|
|
5839
5857
|
|
|
5840
5858
|
// TODO there are still race conditions in this function:
|
|
5841
|
-
// - when open is called twice, previous
|
|
5859
|
+
// - when open is called twice, previous DOM nodes can either be reused or the previous DOM nodes must be disposed
|
|
5842
5860
|
|
|
5843
5861
|
// @ts-ignore
|
|
5844
5862
|
const getLocation$1 = async (editor, rowIndex, columnIndex) => {
|
|
@@ -5854,18 +5872,7 @@ const getNoLocationFoundMessage$1 = info => {
|
|
|
5854
5872
|
}
|
|
5855
5873
|
return noDefinitionFound();
|
|
5856
5874
|
};
|
|
5857
|
-
|
|
5858
|
-
// @ts-ignore
|
|
5859
|
-
const getErrorMessage$3 = error => {
|
|
5860
|
-
// if (
|
|
5861
|
-
// error &&
|
|
5862
|
-
// error.message &&
|
|
5863
|
-
// error.message.startsWith('Failed to execute definition provider: ')
|
|
5864
|
-
// ) {
|
|
5865
|
-
// return error.message.replace('Failed to execute definition provider: ', '')
|
|
5866
|
-
// }
|
|
5867
|
-
return `${error}`;
|
|
5868
|
-
};
|
|
5875
|
+
const getErrorMessage$3 = String;
|
|
5869
5876
|
|
|
5870
5877
|
// @ts-ignore
|
|
5871
5878
|
const isNoProviderFoundError$1 = error => {
|
|
@@ -5890,7 +5897,7 @@ const getNoLocationFoundMessage = info => {
|
|
|
5890
5897
|
|
|
5891
5898
|
const getTypeDefinition = async (editor, offset) => {
|
|
5892
5899
|
// @ts-ignore
|
|
5893
|
-
const definition = await invoke$
|
|
5900
|
+
const definition = await invoke$b('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
|
|
5894
5901
|
return definition;
|
|
5895
5902
|
};
|
|
5896
5903
|
|
|
@@ -5899,21 +5906,7 @@ const getLocation = async (editor, rowIndex, columnIndex) => {
|
|
|
5899
5906
|
const definition = await getTypeDefinition(editor, offset);
|
|
5900
5907
|
return definition;
|
|
5901
5908
|
};
|
|
5902
|
-
|
|
5903
|
-
// @ts-ignore
|
|
5904
|
-
const getErrorMessage$2 = error => {
|
|
5905
|
-
// if (
|
|
5906
|
-
// error &&
|
|
5907
|
-
// error.message &&
|
|
5908
|
-
// error.message.startsWith('Failed to execute type definition provider: ')
|
|
5909
|
-
// ) {
|
|
5910
|
-
// return error.message.replace(
|
|
5911
|
-
// 'Failed to execute type definition provider: ',
|
|
5912
|
-
// ''
|
|
5913
|
-
// )
|
|
5914
|
-
// }
|
|
5915
|
-
return `${error}`;
|
|
5916
|
-
};
|
|
5909
|
+
const getErrorMessage$2 = String;
|
|
5917
5910
|
const isNoProviderFoundError = error => {
|
|
5918
5911
|
return error?.message?.startsWith('Failed to execute type definition provider: No type definition provider found');
|
|
5919
5912
|
};
|
|
@@ -6073,8 +6066,8 @@ const handleContextMenu = async (editor, button, x, y) => {
|
|
|
6073
6066
|
// @ts-ignore
|
|
6074
6067
|
|
|
6075
6068
|
// match all words, including umlauts, see https://stackoverflow.com/questions/5436824/matching-accented-characters-with-javascript-regexes/#answer-11550799
|
|
6076
|
-
const RE_WORD_START = /^[a-
|
|
6077
|
-
const RE_WORD_END = /[a-
|
|
6069
|
+
const RE_WORD_START = /^[a-zA-Z\u{C0}-\u{17F}\d]+/u;
|
|
6070
|
+
const RE_WORD_END = /[a-zA-Z\u{C0}-\u{17F}\d]+$/u;
|
|
6078
6071
|
|
|
6079
6072
|
// @ts-ignore
|
|
6080
6073
|
const getNewSelections$7 = (line, rowIndex, columnIndex) => {
|
|
@@ -6336,6 +6329,7 @@ const state$1 = {
|
|
|
6336
6329
|
*/
|
|
6337
6330
|
currentEditor: undefined,
|
|
6338
6331
|
hasListener: false,
|
|
6332
|
+
isSelecting: false,
|
|
6339
6333
|
position: {
|
|
6340
6334
|
columnIndex: 0,
|
|
6341
6335
|
rowIndex: 0
|
|
@@ -6350,6 +6344,13 @@ const setEditor = editor => {
|
|
|
6350
6344
|
const clearEditor = () => {
|
|
6351
6345
|
state$1.currentEditor = undefined;
|
|
6352
6346
|
state$1.hasListener = false;
|
|
6347
|
+
state$1.isSelecting = false;
|
|
6348
|
+
};
|
|
6349
|
+
const startSelecting = () => {
|
|
6350
|
+
state$1.isSelecting = true;
|
|
6351
|
+
};
|
|
6352
|
+
const isSelecting = () => {
|
|
6353
|
+
return state$1.isSelecting;
|
|
6353
6354
|
};
|
|
6354
6355
|
|
|
6355
6356
|
// @ts-ignore
|
|
@@ -6373,6 +6374,7 @@ const handlePointerCaptureLost = editor => {
|
|
|
6373
6374
|
};
|
|
6374
6375
|
|
|
6375
6376
|
const handlePointerDown$1 = (state, button, altKey, ctrlKey, x, y, detail) => {
|
|
6377
|
+
startSelecting();
|
|
6376
6378
|
return handleMouseDown(state, button, altKey, ctrlKey, x, y, detail);
|
|
6377
6379
|
};
|
|
6378
6380
|
|
|
@@ -6554,6 +6556,9 @@ const moveSelectionPx = async (editor, x, y) => {
|
|
|
6554
6556
|
};
|
|
6555
6557
|
|
|
6556
6558
|
const handlePointerMove = async (editor, x, y, altKey) => {
|
|
6559
|
+
if (!isSelecting()) {
|
|
6560
|
+
return editor;
|
|
6561
|
+
}
|
|
6557
6562
|
if (altKey) {
|
|
6558
6563
|
return moveRectangleSelectionPx(editor, x, y);
|
|
6559
6564
|
}
|
|
@@ -6592,8 +6597,6 @@ const handleScrollBarHorizontalMove = (state, eventX) => {
|
|
|
6592
6597
|
width,
|
|
6593
6598
|
x
|
|
6594
6599
|
} = state;
|
|
6595
|
-
const spaceRight = 20; // TODO make this configurable
|
|
6596
|
-
const normalizedEventX = clamp(eventX, x, x + width);
|
|
6597
6600
|
if (width > longestLineWidth) {
|
|
6598
6601
|
return {
|
|
6599
6602
|
...state,
|
|
@@ -6601,6 +6604,8 @@ const handleScrollBarHorizontalMove = (state, eventX) => {
|
|
|
6601
6604
|
scrollBarWidth: 0
|
|
6602
6605
|
};
|
|
6603
6606
|
}
|
|
6607
|
+
const spaceRight = 20; // TODO make this configurable
|
|
6608
|
+
const normalizedEventX = clamp(eventX, x, x + width);
|
|
6604
6609
|
const relativeX = normalizedEventX - x - handleOffsetX;
|
|
6605
6610
|
const scrollBarWidth = getScrollBarWidth(width, longestLineWidth);
|
|
6606
6611
|
const finalDeltaX = longestLineWidth - width + spaceRight;
|
|
@@ -6779,7 +6784,7 @@ const setDelta = (editor, deltaMode, eventDeltaX, eventDeltaY) => {
|
|
|
6779
6784
|
if (eventDeltaX === 0) {
|
|
6780
6785
|
return setDeltaY(editor, eventDeltaY);
|
|
6781
6786
|
}
|
|
6782
|
-
const newDeltaX = clamp(deltaX + eventDeltaX, 0,
|
|
6787
|
+
const newDeltaX = clamp(deltaX + eventDeltaX, 0, Infinity);
|
|
6783
6788
|
return {
|
|
6784
6789
|
...setDeltaY(editor, eventDeltaY),
|
|
6785
6790
|
deltaX: newDeltaX
|
|
@@ -6850,22 +6855,19 @@ const getChanges$1 = selections => {
|
|
|
6850
6855
|
rowsToIndent.push(i);
|
|
6851
6856
|
}
|
|
6852
6857
|
}
|
|
6853
|
-
const changes =
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
}
|
|
6867
|
-
});
|
|
6868
|
-
}
|
|
6858
|
+
const changes = Array.from(rowsToIndent, rowToIndent => ({
|
|
6859
|
+
deleted: [''],
|
|
6860
|
+
end: {
|
|
6861
|
+
columnIndex: 0,
|
|
6862
|
+
rowIndex: rowToIndent
|
|
6863
|
+
},
|
|
6864
|
+
inserted: [' '],
|
|
6865
|
+
origin: IndentMore,
|
|
6866
|
+
start: {
|
|
6867
|
+
columnIndex: 0,
|
|
6868
|
+
rowIndex: rowToIndent
|
|
6869
|
+
}
|
|
6870
|
+
}));
|
|
6869
6871
|
return changes;
|
|
6870
6872
|
};
|
|
6871
6873
|
const indentMore = editor => {
|
|
@@ -6878,7 +6880,7 @@ const indentMore = editor => {
|
|
|
6878
6880
|
|
|
6879
6881
|
const getLanguageConfiguration = async editor => {
|
|
6880
6882
|
// @ts-ignore
|
|
6881
|
-
return invoke$
|
|
6883
|
+
return invoke$b('Languages.getLanguageConfiguration', {
|
|
6882
6884
|
languageId: editor.languageId,
|
|
6883
6885
|
uri: editor.uri
|
|
6884
6886
|
});
|
|
@@ -7385,12 +7387,12 @@ const print = error => {
|
|
|
7385
7387
|
return `${error.type}: ${error.message}\n${error.stack}`;
|
|
7386
7388
|
}
|
|
7387
7389
|
if (error && error.stack) {
|
|
7388
|
-
return
|
|
7390
|
+
return error.stack;
|
|
7389
7391
|
}
|
|
7390
7392
|
if (error === null) {
|
|
7391
7393
|
return null;
|
|
7392
7394
|
}
|
|
7393
|
-
return
|
|
7395
|
+
return String(error);
|
|
7394
7396
|
};
|
|
7395
7397
|
|
|
7396
7398
|
// @ts-nocheck
|
|
@@ -7420,7 +7422,7 @@ const isUntitledFile = uri => {
|
|
|
7420
7422
|
};
|
|
7421
7423
|
|
|
7422
7424
|
const saveNormalFile = async (uri, content) => {
|
|
7423
|
-
await invoke$
|
|
7425
|
+
await invoke$b('FileSystem.writeFile', uri, content);
|
|
7424
7426
|
};
|
|
7425
7427
|
|
|
7426
7428
|
const showFilePicker = async platform => {
|
|
@@ -7440,9 +7442,9 @@ const saveUntitledFile = async (uri, content, platform) => {
|
|
|
7440
7442
|
if (!filePath) {
|
|
7441
7443
|
return;
|
|
7442
7444
|
}
|
|
7443
|
-
await invoke$
|
|
7445
|
+
await invoke$b('FileSystem.writeFile', filePath, content);
|
|
7444
7446
|
await handleWorkspaceRefresh();
|
|
7445
|
-
await invoke$
|
|
7447
|
+
await invoke$b('Main.handleUriChange', uri, filePath);
|
|
7446
7448
|
return filePath;
|
|
7447
7449
|
};
|
|
7448
7450
|
|
|
@@ -7464,9 +7466,8 @@ const save = async editor => {
|
|
|
7464
7466
|
};
|
|
7465
7467
|
}
|
|
7466
7468
|
return newEditor;
|
|
7467
|
-
} else {
|
|
7468
|
-
await saveNormalFile(uri, content);
|
|
7469
7469
|
}
|
|
7470
|
+
await saveNormalFile(uri, content);
|
|
7470
7471
|
return {
|
|
7471
7472
|
...newEditor,
|
|
7472
7473
|
modified: false
|
|
@@ -7774,7 +7775,7 @@ const selectInsideString = editor => {
|
|
|
7774
7775
|
|
|
7775
7776
|
const getNewSelections = async (editor, selections) => {
|
|
7776
7777
|
// @ts-ignore
|
|
7777
|
-
const newSelections = await invoke$
|
|
7778
|
+
const newSelections = await invoke$b('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
7778
7779
|
if (newSelections.length === 0) {
|
|
7779
7780
|
return selections;
|
|
7780
7781
|
}
|
|
@@ -7802,7 +7803,7 @@ const selectionGrow = async editor => {
|
|
|
7802
7803
|
// ccc
|
|
7803
7804
|
|
|
7804
7805
|
// when clicking first at position 4 and then position 2,
|
|
7805
|
-
// -
|
|
7806
|
+
// - VS Code selects next position 3 and refuses to select position 1
|
|
7806
7807
|
// - atom also selects next position 3 and refuses to select position 1
|
|
7807
7808
|
// - WebStorm also selects next position 3 and refuses to select position 1
|
|
7808
7809
|
// - brackets (codemirror) selects position 3 and then selects position 1
|
|
@@ -7863,25 +7864,25 @@ const getSelectionEditsSingleLineWord = (lines, selections) => {
|
|
|
7863
7864
|
startRowIndex = selections[selectionIndex];
|
|
7864
7865
|
const startColumnIndex = selections[selectionIndex + 1];
|
|
7865
7866
|
const endColumnIndex = selections[selectionIndex + 3];
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7867
|
+
const isSelected = startRowIndex === i && startColumnIndex <= columnIndex && columnIndex <= endColumnIndex;
|
|
7868
|
+
if (!isSelected) {
|
|
7869
|
+
if (startRowIndex > i) {
|
|
7870
|
+
selectionIndex -= 4;
|
|
7871
|
+
}
|
|
7872
|
+
const columnEndIndex = columnIndex + word.length;
|
|
7873
|
+
selectionIndex += 4;
|
|
7874
|
+
const newSelections = new Uint32Array(selections.length + 4);
|
|
7875
|
+
newSelections.set(selections.subarray(0, selectionIndex), 0);
|
|
7876
|
+
newSelections[selectionIndex] = i;
|
|
7877
|
+
newSelections[selectionIndex + 1] = columnIndex;
|
|
7878
|
+
newSelections[selectionIndex + 2] = i;
|
|
7879
|
+
newSelections[selectionIndex + 3] = columnEndIndex;
|
|
7880
|
+
newSelections.set(selections.subarray(selectionIndex), selectionIndex + 4);
|
|
7881
|
+
return {
|
|
7882
|
+
revealRange: newSelections.length - 4,
|
|
7883
|
+
selectionEdits: newSelections
|
|
7884
|
+
};
|
|
7871
7885
|
}
|
|
7872
|
-
const columnEndIndex = columnIndex + word.length;
|
|
7873
|
-
selectionIndex += 4;
|
|
7874
|
-
const newSelections = new Uint32Array(selections.length + 4);
|
|
7875
|
-
newSelections.set(selections.subarray(0, selectionIndex), 0);
|
|
7876
|
-
newSelections[selectionIndex] = i;
|
|
7877
|
-
newSelections[selectionIndex + 1] = columnIndex;
|
|
7878
|
-
newSelections[selectionIndex + 2] = i;
|
|
7879
|
-
newSelections[selectionIndex + 3] = columnEndIndex;
|
|
7880
|
-
newSelections.set(selections.subarray(selectionIndex), selectionIndex + 4);
|
|
7881
|
-
return {
|
|
7882
|
-
revealRange: newSelections.length - 4,
|
|
7883
|
-
selectionEdits: newSelections
|
|
7884
|
-
};
|
|
7885
7886
|
}
|
|
7886
7887
|
}
|
|
7887
7888
|
return undefined;
|
|
@@ -7936,13 +7937,13 @@ const getSelectNextOccurrenceResult = editor => {
|
|
|
7936
7937
|
// ccc
|
|
7937
7938
|
|
|
7938
7939
|
// when clicking first at position 4 and then position 2,
|
|
7939
|
-
// -
|
|
7940
|
+
// - VS Code selects next position 3 and refuses to select position 1
|
|
7940
7941
|
// - atom also selects next position 3 and refuses to select position 1
|
|
7941
7942
|
// - WebStorm also selects next position 3 and refuses to select position 1
|
|
7942
7943
|
// - brackets (codemirror) selects position 3 and then selects position 1
|
|
7943
7944
|
// - sublime selects next position 1, then next position 3
|
|
7944
7945
|
|
|
7945
|
-
const
|
|
7946
|
+
const isRangeInViewport = (minLineY, maxLineY, startRowIndex, endRowIndex) => {
|
|
7946
7947
|
return startRowIndex >= minLineY && endRowIndex <= maxLineY;
|
|
7947
7948
|
};
|
|
7948
7949
|
|
|
@@ -7953,14 +7954,12 @@ const selectNextOccurrence = editor => {
|
|
|
7953
7954
|
return editor;
|
|
7954
7955
|
}
|
|
7955
7956
|
const {
|
|
7956
|
-
revealRange
|
|
7957
|
-
} = result;
|
|
7958
|
-
const {
|
|
7957
|
+
revealRange,
|
|
7959
7958
|
selectionEdits
|
|
7960
7959
|
} = result;
|
|
7961
7960
|
const revealRangeStartRowIndex = selectionEdits[revealRange];
|
|
7962
7961
|
const revealRangeEndRowIndex = selectionEdits[revealRange + 2];
|
|
7963
|
-
if (
|
|
7962
|
+
if (isRangeInViewport(editor.minLineY, editor.maxLineY, revealRangeStartRowIndex, revealRangeEndRowIndex)) {
|
|
7964
7963
|
return scheduleSelections(editor, selectionEdits);
|
|
7965
7964
|
}
|
|
7966
7965
|
// TODO what is this magic number 5?
|
|
@@ -8025,6 +8024,7 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
|
8025
8024
|
const {
|
|
8026
8025
|
tokenizerId
|
|
8027
8026
|
} = editor;
|
|
8027
|
+
setTokenizePath(languageId, tokenizePath);
|
|
8028
8028
|
// TODO move tokenizer to syntax highlighting worker
|
|
8029
8029
|
// TODO only load tokenizer if not already loaded
|
|
8030
8030
|
// if already loaded just set tokenizer and rerender text
|
|
@@ -8207,7 +8207,7 @@ const showHover3 = async editor => {
|
|
|
8207
8207
|
|
|
8208
8208
|
const EditorHover = 'EditorHover';
|
|
8209
8209
|
const showHover = async state => {
|
|
8210
|
-
await invoke$
|
|
8210
|
+
await invoke$b('Viewlet.openWidget', EditorHover);
|
|
8211
8211
|
return state;
|
|
8212
8212
|
};
|
|
8213
8213
|
|
|
@@ -8470,9 +8470,7 @@ const editorSnippet = (editor, snippet) => {
|
|
|
8470
8470
|
return scheduleDocumentAndCursorsSelections(editor, changes, selectionChanges);
|
|
8471
8471
|
};
|
|
8472
8472
|
|
|
8473
|
-
const getErrorMessage =
|
|
8474
|
-
return `${error}`;
|
|
8475
|
-
};
|
|
8473
|
+
const getErrorMessage = String;
|
|
8476
8474
|
const tabCompletion = async editor => {
|
|
8477
8475
|
try {
|
|
8478
8476
|
// TODO race condition
|
|
@@ -8498,7 +8496,7 @@ const getBlockComment = async (editor, offset) => {
|
|
|
8498
8496
|
} = editor;
|
|
8499
8497
|
// TODO ask extension host worker,
|
|
8500
8498
|
// execute block comment provider with
|
|
8501
|
-
//
|
|
8499
|
+
// URI, language id, offset
|
|
8502
8500
|
// and the extension returns a matching block comment or undefined
|
|
8503
8501
|
try {
|
|
8504
8502
|
await activateByEvent(`onLanguage:${editor.languageId}`, assetDir, platform);
|
|
@@ -8760,7 +8758,7 @@ const toggleComment = async editor => {
|
|
|
8760
8758
|
} catch (error$1) {
|
|
8761
8759
|
error(error$1);
|
|
8762
8760
|
// TODO use correct position
|
|
8763
|
-
await editorShowMessage(/* editor */editor, /* rowIndex */0, /* columnIndex */0, /* message
|
|
8761
|
+
await editorShowMessage(/* editor */editor, /* rowIndex */0, /* columnIndex */0, /* message */String(error$1), /* isError */true);
|
|
8764
8762
|
return editor;
|
|
8765
8763
|
}
|
|
8766
8764
|
};
|
|
@@ -8853,7 +8851,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
8853
8851
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
8854
8852
|
const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
8855
8853
|
// @ts-ignore
|
|
8856
|
-
const result = await invoke$
|
|
8854
|
+
const result = await invoke$b('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
|
|
8857
8855
|
if (!result) {
|
|
8858
8856
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
8859
8857
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
@@ -9105,7 +9103,7 @@ const addWidget$1 = (widget, id, render) => {
|
|
|
9105
9103
|
// 1. renderDom
|
|
9106
9104
|
// 2. renderAriaAnnouncement
|
|
9107
9105
|
// 3. renderFocus
|
|
9108
|
-
// to ensure that focus is always after the element is added to the
|
|
9106
|
+
// to ensure that focus is always after the element is added to the DOM
|
|
9109
9107
|
if (focusCommandIndex !== -1) {
|
|
9110
9108
|
const command = allCommands[focusCommandIndex];
|
|
9111
9109
|
allCommands.splice(focusCommandIndex, 1);
|
|
@@ -9212,6 +9210,7 @@ const renderFull$4 = (oldState, newState) => {
|
|
|
9212
9210
|
return commands;
|
|
9213
9211
|
};
|
|
9214
9212
|
|
|
9213
|
+
const commandsToForward$5 = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
9215
9214
|
const render$b = widget => {
|
|
9216
9215
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
9217
9216
|
const wrappedCommands = [];
|
|
@@ -9219,7 +9218,7 @@ const render$b = widget => {
|
|
|
9219
9218
|
uid
|
|
9220
9219
|
} = widget.newState;
|
|
9221
9220
|
for (const command of commands) {
|
|
9222
|
-
if (command[0]
|
|
9221
|
+
if (commandsToForward$5.includes(command[0])) {
|
|
9223
9222
|
wrappedCommands.push(command);
|
|
9224
9223
|
} else {
|
|
9225
9224
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
@@ -9284,6 +9283,7 @@ const renderFull$3 = (oldState, newState) => {
|
|
|
9284
9283
|
return commands;
|
|
9285
9284
|
};
|
|
9286
9285
|
|
|
9286
|
+
const commandsToForward$4 = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
9287
9287
|
const render$a = widget => {
|
|
9288
9288
|
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
9289
9289
|
const wrappedCommands = [];
|
|
@@ -9291,7 +9291,7 @@ const render$a = widget => {
|
|
|
9291
9291
|
uid
|
|
9292
9292
|
} = widget.newState;
|
|
9293
9293
|
for (const command of commands) {
|
|
9294
|
-
if (command[0]
|
|
9294
|
+
if (commandsToForward$4.includes(command[0])) {
|
|
9295
9295
|
wrappedCommands.push(command);
|
|
9296
9296
|
} else {
|
|
9297
9297
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
@@ -9715,9 +9715,7 @@ const renderHoverDom = {
|
|
|
9715
9715
|
const dom = getHoverVirtualDom(newState.lineInfos, newState.documentation, newState.diagnostics);
|
|
9716
9716
|
return [/* method */SetDom2, dom];
|
|
9717
9717
|
},
|
|
9718
|
-
isEqual(oldState, newState)
|
|
9719
|
-
return oldState.lineInfos === newState.lineInfos && oldState.documentation === newState.documentation && oldState.diagnostics === newState.diagnostics;
|
|
9720
|
-
}
|
|
9718
|
+
isEqual: (oldState, newState) => oldState.lineInfos === newState.lineInfos && oldState.documentation === newState.documentation && oldState.diagnostics === newState.diagnostics
|
|
9721
9719
|
};
|
|
9722
9720
|
const renderBounds$2 = {
|
|
9723
9721
|
apply(oldState, newState) {
|
|
@@ -9729,9 +9727,7 @@ const renderBounds$2 = {
|
|
|
9729
9727
|
} = newState;
|
|
9730
9728
|
return [SetBounds, x, y, width, height];
|
|
9731
9729
|
},
|
|
9732
|
-
isEqual(oldState, newState)
|
|
9733
|
-
return oldState.x === newState.x && oldState.y === newState.y;
|
|
9734
|
-
}
|
|
9730
|
+
isEqual: (oldState, newState) => oldState.x === newState.x && oldState.y === newState.y
|
|
9735
9731
|
};
|
|
9736
9732
|
const render$9 = [renderHoverDom, renderBounds$2];
|
|
9737
9733
|
const renderHover = (oldState, newState) => {
|
|
@@ -9744,6 +9740,7 @@ const renderHover = (oldState, newState) => {
|
|
|
9744
9740
|
return commands;
|
|
9745
9741
|
};
|
|
9746
9742
|
|
|
9743
|
+
const commandsToForward$3 = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
9747
9744
|
const render$8 = widget => {
|
|
9748
9745
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
9749
9746
|
const wrappedCommands = [];
|
|
@@ -9751,7 +9748,7 @@ const render$8 = widget => {
|
|
|
9751
9748
|
uid
|
|
9752
9749
|
} = widget.newState;
|
|
9753
9750
|
for (const command of commands) {
|
|
9754
|
-
if (command[0]
|
|
9751
|
+
if (commandsToForward$3.includes(command[0])) {
|
|
9755
9752
|
wrappedCommands.push(command);
|
|
9756
9753
|
} else {
|
|
9757
9754
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
@@ -9804,6 +9801,7 @@ const removeWidget$1 = widget => {
|
|
|
9804
9801
|
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
9805
9802
|
};
|
|
9806
9803
|
|
|
9804
|
+
const commandsToForward$2 = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
9807
9805
|
const render$7 = widget => {
|
|
9808
9806
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
9809
9807
|
const wrappedCommands = [];
|
|
@@ -9811,7 +9809,7 @@ const render$7 = widget => {
|
|
|
9811
9809
|
uid
|
|
9812
9810
|
} = widget.newState;
|
|
9813
9811
|
for (const command of commands) {
|
|
9814
|
-
if (command[0]
|
|
9812
|
+
if (commandsToForward$2.includes(command[0])) {
|
|
9815
9813
|
wrappedCommands.push(command);
|
|
9816
9814
|
} else {
|
|
9817
9815
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
@@ -9908,7 +9906,7 @@ const getEditorSourceActions = async editorId => {
|
|
|
9908
9906
|
languageId
|
|
9909
9907
|
} = newState;
|
|
9910
9908
|
// @ts-ignore
|
|
9911
|
-
const allActions = await invoke$
|
|
9909
|
+
const allActions = await invoke$b('GetEditorSourceActions.getEditorSourceActions');
|
|
9912
9910
|
const filtered = filterActions(allActions, languageId);
|
|
9913
9911
|
return filtered;
|
|
9914
9912
|
};
|
|
@@ -9931,14 +9929,14 @@ const getWordAtOffset = editor => {
|
|
|
9931
9929
|
};
|
|
9932
9930
|
|
|
9933
9931
|
const setFocus = async focusKey => {
|
|
9934
|
-
await invoke$
|
|
9932
|
+
await invoke$b('Focus.setFocus', focusKey);
|
|
9935
9933
|
};
|
|
9936
9934
|
const unsetAdditionalFocus = async focusKey => {
|
|
9937
9935
|
if (!focusKey) {
|
|
9938
9936
|
return;
|
|
9939
9937
|
}
|
|
9940
9938
|
// @ts-ignore
|
|
9941
|
-
await invoke$
|
|
9939
|
+
await invoke$b('Focus.removeAdditionalFocus', focusKey);
|
|
9942
9940
|
};
|
|
9943
9941
|
|
|
9944
9942
|
const shouldUpdateSelectionData = (oldState, newState) => {
|
|
@@ -10094,7 +10092,7 @@ const getDiagnostics$1 = async editorUid => {
|
|
|
10094
10092
|
};
|
|
10095
10093
|
|
|
10096
10094
|
const ensure = async (fontName, fontUrl) => {
|
|
10097
|
-
await invoke$
|
|
10095
|
+
await invoke$c('TextMeasurement.ensureFont', fontName, fontUrl);
|
|
10098
10096
|
};
|
|
10099
10097
|
|
|
10100
10098
|
const getKeyBindings = () => {
|
|
@@ -10652,7 +10650,7 @@ const handleBeforeInput = (editor, inputType, data) => {
|
|
|
10652
10650
|
};
|
|
10653
10651
|
|
|
10654
10652
|
const handleMessagePort = async (port, rpcId) => {
|
|
10655
|
-
const rpc = await create$
|
|
10653
|
+
const rpc = await create$b({
|
|
10656
10654
|
commandMap: {},
|
|
10657
10655
|
messagePort: port
|
|
10658
10656
|
});
|
|
@@ -10761,73 +10759,10 @@ const hotReload = async () => {
|
|
|
10761
10759
|
|
|
10762
10760
|
// TODO ask renderer worker to rerender all editors
|
|
10763
10761
|
// @ts-ignore
|
|
10764
|
-
await invoke$
|
|
10762
|
+
await invoke$b(`Editor.rerender`);
|
|
10765
10763
|
isReloading = false;
|
|
10766
10764
|
};
|
|
10767
10765
|
|
|
10768
|
-
const sendMessagePortToExtensionHostWorker2 = async (port, initialCommand, rpcId) => {
|
|
10769
|
-
await sendMessagePortToExtensionHostWorker(port, rpcId);
|
|
10770
|
-
};
|
|
10771
|
-
|
|
10772
|
-
const createExtensionHostRpc = async () => {
|
|
10773
|
-
try {
|
|
10774
|
-
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
10775
|
-
const rpc = await create$e({
|
|
10776
|
-
commandMap: {},
|
|
10777
|
-
async send(port) {
|
|
10778
|
-
await sendMessagePortToExtensionHostWorker2(port, initialCommand, EditorWorker);
|
|
10779
|
-
}
|
|
10780
|
-
});
|
|
10781
|
-
return rpc;
|
|
10782
|
-
} catch (error) {
|
|
10783
|
-
throw new VError(error, `Failed to create extension host rpc`);
|
|
10784
|
-
}
|
|
10785
|
-
};
|
|
10786
|
-
|
|
10787
|
-
const initializeExtensionHost = async () => {
|
|
10788
|
-
const extensionHostRpc = await createExtensionHostRpc();
|
|
10789
|
-
set$1(extensionHostRpc);
|
|
10790
|
-
};
|
|
10791
|
-
|
|
10792
|
-
const createExtensionManagementWorkerRpc = async () => {
|
|
10793
|
-
try {
|
|
10794
|
-
const rpc = await create$e({
|
|
10795
|
-
commandMap: {},
|
|
10796
|
-
async send(port) {
|
|
10797
|
-
await sendMessagePortToExtensionManagementWorker$1(port, EditorWorker);
|
|
10798
|
-
}
|
|
10799
|
-
});
|
|
10800
|
-
return rpc;
|
|
10801
|
-
} catch (error) {
|
|
10802
|
-
throw new VError(error, `Failed to create extension management worker rpc`);
|
|
10803
|
-
}
|
|
10804
|
-
};
|
|
10805
|
-
|
|
10806
|
-
const initializeExtensionManagementWorker = async () => {
|
|
10807
|
-
try {
|
|
10808
|
-
const rpc = await createExtensionManagementWorkerRpc();
|
|
10809
|
-
set$c(rpc);
|
|
10810
|
-
} catch {
|
|
10811
|
-
// ignore
|
|
10812
|
-
}
|
|
10813
|
-
};
|
|
10814
|
-
|
|
10815
|
-
const send$1 = port => {
|
|
10816
|
-
// @ts-ignore
|
|
10817
|
-
return sendMessagePortToOpenerWorker(port);
|
|
10818
|
-
};
|
|
10819
|
-
const initializeOpenerWorker = async () => {
|
|
10820
|
-
try {
|
|
10821
|
-
const rpc = await create$d({
|
|
10822
|
-
commandMap: {},
|
|
10823
|
-
send: send$1
|
|
10824
|
-
});
|
|
10825
|
-
set$b(rpc);
|
|
10826
|
-
} catch {
|
|
10827
|
-
// ignore
|
|
10828
|
-
}
|
|
10829
|
-
};
|
|
10830
|
-
|
|
10831
10766
|
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
10832
10767
|
try {
|
|
10833
10768
|
await sendMessagePortToSyntaxHighlightingWorker$1(port);
|
|
@@ -10841,7 +10776,7 @@ const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
|
10841
10776
|
|
|
10842
10777
|
const createSyntaxHighlightingWorkerRpc = async () => {
|
|
10843
10778
|
try {
|
|
10844
|
-
const rpc = await create$
|
|
10779
|
+
const rpc = await create$d({
|
|
10845
10780
|
commandMap: {},
|
|
10846
10781
|
send: sendMessagePortToSyntaxHighlightingWorker
|
|
10847
10782
|
});
|
|
@@ -10862,17 +10797,6 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
10862
10797
|
}
|
|
10863
10798
|
};
|
|
10864
10799
|
|
|
10865
|
-
const send = port => {
|
|
10866
|
-
return sendMessagePortToTextMeasurementWorker(port);
|
|
10867
|
-
};
|
|
10868
|
-
const initializeTextMeasurementWorker = async () => {
|
|
10869
|
-
const rpc = await create$d({
|
|
10870
|
-
commandMap: {},
|
|
10871
|
-
send
|
|
10872
|
-
});
|
|
10873
|
-
set$9(rpc);
|
|
10874
|
-
};
|
|
10875
|
-
|
|
10876
10800
|
const launchCompletionWorker = async () => {
|
|
10877
10801
|
const name = 'Completion Worker';
|
|
10878
10802
|
const url = 'completionWorkerMain.js';
|
|
@@ -10883,7 +10807,7 @@ const launchCompletionWorker = async () => {
|
|
|
10883
10807
|
|
|
10884
10808
|
const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
10885
10809
|
setFactory(launchCompletionWorker);
|
|
10886
|
-
await
|
|
10810
|
+
await initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental);
|
|
10887
10811
|
};
|
|
10888
10812
|
|
|
10889
10813
|
const kLineHeight = 'editor.lineHeight';
|
|
@@ -10996,6 +10920,7 @@ const loadContent = async (state, savedState) => {
|
|
|
10996
10920
|
// TODO support overwriting language id by setting it explicitly or via settings
|
|
10997
10921
|
const charWidth = await measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
|
|
10998
10922
|
const languages = await getLanguages(platform, assetDir);
|
|
10923
|
+
setTokenizePaths(languages);
|
|
10999
10924
|
const computedLanguageId = getLanguageId$1(uri, languages);
|
|
11000
10925
|
const tokenizePath = getTokenizePath(languages, computedLanguageId);
|
|
11001
10926
|
await loadTokenizer(computedLanguageId, tokenizePath);
|
|
@@ -11067,8 +10992,8 @@ const loadContent = async (state, savedState) => {
|
|
|
11067
10992
|
};
|
|
11068
10993
|
|
|
11069
10994
|
// TODO move cursor
|
|
11070
|
-
// TODO multiple cursors ->
|
|
11071
|
-
// TODO with selection ->
|
|
10995
|
+
// TODO multiple cursors -> VS Code removes multiple cursors
|
|
10996
|
+
// TODO with selection -> VS Code moves whole selection
|
|
11072
10997
|
const moveLineDown = editor => {
|
|
11073
10998
|
// const rowIndex = editor.cursor.rowIndex
|
|
11074
10999
|
// if (rowIndex === editor.lines.length - 1) {
|
|
@@ -11243,12 +11168,12 @@ const getChildrenWithCount = (nodes, startIndex, childCount) => {
|
|
|
11243
11168
|
};
|
|
11244
11169
|
|
|
11245
11170
|
const compareNodes = (oldNode, newNode) => {
|
|
11246
|
-
const patches = [];
|
|
11247
11171
|
// Check if node type changed - return null to signal incompatible nodes
|
|
11248
11172
|
// (caller should handle this with a Replace operation)
|
|
11249
11173
|
if (oldNode.type !== newNode.type) {
|
|
11250
11174
|
return null;
|
|
11251
11175
|
}
|
|
11176
|
+
const patches = [];
|
|
11252
11177
|
// Handle reference nodes - special handling for uid changes
|
|
11253
11178
|
if (oldNode.type === Reference) {
|
|
11254
11179
|
if (oldNode.uid !== newNode.uid) {
|
|
@@ -11284,7 +11209,7 @@ const compareNodes = (oldNode, newNode) => {
|
|
|
11284
11209
|
}
|
|
11285
11210
|
// Check for removed attributes
|
|
11286
11211
|
for (const key of oldKeys) {
|
|
11287
|
-
if (!(key
|
|
11212
|
+
if (!Object.hasOwn(newNode, key)) {
|
|
11288
11213
|
patches.push({
|
|
11289
11214
|
type: RemoveAttribute,
|
|
11290
11215
|
key
|
|
@@ -11460,15 +11385,12 @@ const getEditorInputVirtualDom = () => {
|
|
|
11460
11385
|
};
|
|
11461
11386
|
|
|
11462
11387
|
const getCursorsVirtualDom = cursors => {
|
|
11463
|
-
const dom =
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
type: Div
|
|
11470
|
-
});
|
|
11471
|
-
}
|
|
11388
|
+
const dom = Array.from(cursors, translate => ({
|
|
11389
|
+
childCount: 0,
|
|
11390
|
+
className: EditorCursor,
|
|
11391
|
+
translate,
|
|
11392
|
+
type: Div
|
|
11393
|
+
}));
|
|
11472
11394
|
return dom;
|
|
11473
11395
|
};
|
|
11474
11396
|
|
|
@@ -11822,9 +11744,7 @@ const renderLines = {
|
|
|
11822
11744
|
const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, relativeLine);
|
|
11823
11745
|
return [/* method */'setText', dom];
|
|
11824
11746
|
},
|
|
11825
|
-
isEqual(oldState, newState)
|
|
11826
|
-
return oldState.lines === newState.lines && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.deltaX === newState.deltaX && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.debugEnabled === newState.debugEnabled;
|
|
11827
|
-
}
|
|
11747
|
+
isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.deltaX === newState.deltaX && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.debugEnabled === newState.debugEnabled
|
|
11828
11748
|
};
|
|
11829
11749
|
const renderSelections = {
|
|
11830
11750
|
apply: (oldState, newState) => {
|
|
@@ -11836,9 +11756,7 @@ const renderSelections = {
|
|
|
11836
11756
|
const selectionsDom = getSelectionsVirtualDom(selectionInfos);
|
|
11837
11757
|
return [/* method */'setSelections', cursorsDom, selectionsDom];
|
|
11838
11758
|
},
|
|
11839
|
-
isEqual(oldState, newState)
|
|
11840
|
-
return oldState.cursorInfos === newState.cursorInfos && oldState.selectionInfos === newState.selectionInfos;
|
|
11841
|
-
}
|
|
11759
|
+
isEqual: (oldState, newState) => oldState.cursorInfos === newState.cursorInfos && oldState.selectionInfos === newState.selectionInfos
|
|
11842
11760
|
};
|
|
11843
11761
|
const renderScrollBarY = {
|
|
11844
11762
|
apply(oldState, newState) {
|
|
@@ -11847,9 +11765,7 @@ const renderScrollBarY = {
|
|
|
11847
11765
|
const heightPx = `${newState.scrollBarHeight}px`;
|
|
11848
11766
|
return [/* method */'setScrollBar', translate, heightPx];
|
|
11849
11767
|
},
|
|
11850
|
-
isEqual(oldState, newState)
|
|
11851
|
-
return oldState.deltaY === newState.deltaY && oldState.scrollBarHeight === newState.scrollBarHeight;
|
|
11852
|
-
}
|
|
11768
|
+
isEqual: (oldState, newState) => oldState.deltaY === newState.deltaY && oldState.scrollBarHeight === newState.scrollBarHeight
|
|
11853
11769
|
};
|
|
11854
11770
|
const renderScrollBarX = {
|
|
11855
11771
|
apply(oldState, newState) {
|
|
@@ -11857,25 +11773,15 @@ const renderScrollBarX = {
|
|
|
11857
11773
|
const scrollBarX = newState.deltaX / newState.longestLineWidth * newState.width;
|
|
11858
11774
|
return [/* method */'setScrollBarHorizontal', /* scrollBarX */scrollBarX, /* scrollBarWidth */scrollBarWidth, /* deltaX */newState.deltaX];
|
|
11859
11775
|
},
|
|
11860
|
-
isEqual(oldState, newState)
|
|
11861
|
-
return oldState.longestLineWidth === newState.longestLineWidth && oldState.deltaX === newState.deltaX;
|
|
11862
|
-
}
|
|
11776
|
+
isEqual: (oldState, newState) => oldState.longestLineWidth === newState.longestLineWidth && oldState.deltaX === newState.deltaX
|
|
11863
11777
|
};
|
|
11864
11778
|
const renderFocus$1 = {
|
|
11865
|
-
apply(oldState, newState)
|
|
11866
|
-
|
|
11867
|
-
},
|
|
11868
|
-
isEqual(oldState, newState) {
|
|
11869
|
-
return oldState.focused === newState.focused;
|
|
11870
|
-
}
|
|
11779
|
+
apply: (oldState, newState) => [/* method */'setFocused', newState.focused],
|
|
11780
|
+
isEqual: (oldState, newState) => oldState.focused === newState.focused
|
|
11871
11781
|
};
|
|
11872
11782
|
const renderFocusContext = {
|
|
11873
|
-
apply(oldState, newState)
|
|
11874
|
-
|
|
11875
|
-
},
|
|
11876
|
-
isEqual(oldState, newState) {
|
|
11877
|
-
return oldState.focus === newState.focus;
|
|
11878
|
-
}
|
|
11783
|
+
apply: (oldState, newState) => [SetFocusContext$1, newState.uid, newState.focus, 0, newState.uid, 'Editor'],
|
|
11784
|
+
isEqual: (oldState, newState) => oldState.focus === newState.focus
|
|
11879
11785
|
};
|
|
11880
11786
|
const renderAdditionalFocusContext = {
|
|
11881
11787
|
apply(oldState, newState) {
|
|
@@ -11884,18 +11790,14 @@ const renderAdditionalFocusContext = {
|
|
|
11884
11790
|
}
|
|
11885
11791
|
return ['viewlet.unsetAdditionalFocus', newState.uid, newState.additionalFocus];
|
|
11886
11792
|
},
|
|
11887
|
-
isEqual(oldState, newState)
|
|
11888
|
-
return oldState.additionalFocus === newState.additionalFocus;
|
|
11889
|
-
}
|
|
11793
|
+
isEqual: (oldState, newState) => oldState.additionalFocus === newState.additionalFocus
|
|
11890
11794
|
};
|
|
11891
11795
|
const renderDecorations = {
|
|
11892
11796
|
apply(oldState, newState) {
|
|
11893
11797
|
const dom = getDiagnosticsVirtualDom(newState.visualDecorations || []);
|
|
11894
11798
|
return ['setDecorationsDom', dom];
|
|
11895
11799
|
},
|
|
11896
|
-
isEqual(oldState, newState)
|
|
11897
|
-
return oldState.visualDecorations === newState.visualDecorations;
|
|
11898
|
-
}
|
|
11800
|
+
isEqual: (oldState, newState) => oldState.visualDecorations === newState.visualDecorations
|
|
11899
11801
|
};
|
|
11900
11802
|
const renderGutterInfo = {
|
|
11901
11803
|
apply(oldState, newState) {
|
|
@@ -11913,9 +11815,7 @@ const renderGutterInfo = {
|
|
|
11913
11815
|
const dom = getEditorGutterVirtualDom$1(gutterInfos);
|
|
11914
11816
|
return ['renderGutter', dom];
|
|
11915
11817
|
},
|
|
11916
|
-
isEqual(oldState, newState)
|
|
11917
|
-
return oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY;
|
|
11918
|
-
}
|
|
11818
|
+
isEqual: (oldState, newState) => oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
11919
11819
|
};
|
|
11920
11820
|
const renderWidgets = {
|
|
11921
11821
|
apply(oldState, newState) {
|
|
@@ -11933,14 +11833,14 @@ const renderWidgets = {
|
|
|
11933
11833
|
newWidgetMap[newWidget.id] = newWidget;
|
|
11934
11834
|
}
|
|
11935
11835
|
for (const oldWidget of oldWidgets) {
|
|
11936
|
-
if (oldWidget.id
|
|
11836
|
+
if (Object.hasOwn(newWidgetMap, oldWidget.id)) {
|
|
11937
11837
|
changedWidgets.push(newWidgetMap[oldWidget.id]);
|
|
11938
11838
|
} else {
|
|
11939
11839
|
removedWidgets.push(oldWidget);
|
|
11940
11840
|
}
|
|
11941
11841
|
}
|
|
11942
11842
|
for (const newWidget of newWidgets) {
|
|
11943
|
-
if (newWidget.id
|
|
11843
|
+
if (Object.hasOwn(oldWidgetMap, newWidget.id)) ; else {
|
|
11944
11844
|
addedWidgets.push(newWidget);
|
|
11945
11845
|
}
|
|
11946
11846
|
}
|
|
@@ -11969,9 +11869,7 @@ const renderWidgets = {
|
|
|
11969
11869
|
const filteredCommands = allCommands.filter(item => item[0] !== 'Viewlet.setFocusContext');
|
|
11970
11870
|
return filteredCommands;
|
|
11971
11871
|
},
|
|
11972
|
-
isEqual(oldState, newState)
|
|
11973
|
-
return oldState.widgets === newState.widgets;
|
|
11974
|
-
},
|
|
11872
|
+
isEqual: (oldState, newState) => oldState.widgets === newState.widgets,
|
|
11975
11873
|
multiple: true
|
|
11976
11874
|
};
|
|
11977
11875
|
const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
@@ -12085,6 +11983,10 @@ const saveState = (state, savedState) => {
|
|
|
12085
11983
|
};
|
|
12086
11984
|
};
|
|
12087
11985
|
|
|
11986
|
+
const sendMessagePortToExtensionHostWorker2 = async (port, initialCommand, rpcId) => {
|
|
11987
|
+
await sendMessagePortToExtensionHostWorker(port, rpcId);
|
|
11988
|
+
};
|
|
11989
|
+
|
|
12088
11990
|
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
12089
11991
|
await sendMessagePortToExtensionManagementWorker$1(port, rpcId);
|
|
12090
11992
|
};
|
|
@@ -12135,7 +12037,7 @@ const updateDebugInfo = async debugId => {
|
|
|
12135
12037
|
};
|
|
12136
12038
|
set$7(key, oldState, newEditor);
|
|
12137
12039
|
// @ts-ignore
|
|
12138
|
-
await invoke$
|
|
12040
|
+
await invoke$b('Editor.rerender', key);
|
|
12139
12041
|
};
|
|
12140
12042
|
|
|
12141
12043
|
// TODO wrap commands globally, not per editor
|
|
@@ -12422,14 +12324,76 @@ for (const [key, value] of Object.entries(commandMap)) {
|
|
|
12422
12324
|
}
|
|
12423
12325
|
}
|
|
12424
12326
|
|
|
12425
|
-
const
|
|
12426
|
-
|
|
12427
|
-
const rpc = await create$
|
|
12327
|
+
const createExtensionHostRpc = async () => {
|
|
12328
|
+
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
12329
|
+
const rpc = await create$c({
|
|
12330
|
+
commandMap: {},
|
|
12331
|
+
async send(port) {
|
|
12332
|
+
await sendMessagePortToExtensionHostWorker2(port, initialCommand, EditorWorker);
|
|
12333
|
+
}
|
|
12334
|
+
});
|
|
12335
|
+
return rpc;
|
|
12336
|
+
};
|
|
12337
|
+
|
|
12338
|
+
const initializeExtensionHost = async () => {
|
|
12339
|
+
const extensionHostRpc = await createExtensionHostRpc();
|
|
12340
|
+
set$1(extensionHostRpc);
|
|
12341
|
+
};
|
|
12342
|
+
|
|
12343
|
+
const createExtensionManagementWorkerRpc = async () => {
|
|
12344
|
+
const rpc = await create$c({
|
|
12345
|
+
commandMap: {},
|
|
12346
|
+
async send(port) {
|
|
12347
|
+
await sendMessagePortToExtensionManagementWorker$1(port, EditorWorker);
|
|
12348
|
+
}
|
|
12349
|
+
});
|
|
12350
|
+
return rpc;
|
|
12351
|
+
};
|
|
12352
|
+
|
|
12353
|
+
const initializeExtensionManagementWorker = async () => {
|
|
12354
|
+
try {
|
|
12355
|
+
const rpc = await createExtensionManagementWorkerRpc();
|
|
12356
|
+
set$c(rpc);
|
|
12357
|
+
} catch {
|
|
12358
|
+
// ignore
|
|
12359
|
+
}
|
|
12360
|
+
};
|
|
12361
|
+
|
|
12362
|
+
const send$1 = port => {
|
|
12363
|
+
// @ts-ignore
|
|
12364
|
+
return sendMessagePortToOpenerWorker(port);
|
|
12365
|
+
};
|
|
12366
|
+
const initializeOpenerWorker = async () => {
|
|
12367
|
+
const rpc = await create$c({
|
|
12368
|
+
commandMap: {},
|
|
12369
|
+
send: send$1
|
|
12370
|
+
});
|
|
12371
|
+
set$b(rpc);
|
|
12372
|
+
};
|
|
12373
|
+
|
|
12374
|
+
const initializeRendererWorker = async () => {
|
|
12375
|
+
const rpc = await create$a({
|
|
12428
12376
|
commandMap: commandMap
|
|
12429
12377
|
});
|
|
12378
|
+
set$9(rpc);
|
|
12379
|
+
};
|
|
12380
|
+
|
|
12381
|
+
const send = port => {
|
|
12382
|
+
return sendMessagePortToTextMeasurementWorker(port);
|
|
12383
|
+
};
|
|
12384
|
+
const initializeTextMeasurementWorker = async () => {
|
|
12385
|
+
const rpc = await create$c({
|
|
12386
|
+
commandMap: {},
|
|
12387
|
+
send
|
|
12388
|
+
});
|
|
12430
12389
|
set$a(rpc);
|
|
12431
12390
|
};
|
|
12432
12391
|
|
|
12392
|
+
const listen = async () => {
|
|
12393
|
+
registerCommands(commandMap);
|
|
12394
|
+
await Promise.all([initializeRendererWorker(), initializeExtensionHost(), initializeExtensionManagementWorker(), initializeTextMeasurementWorker(), initializeOpenerWorker()]);
|
|
12395
|
+
};
|
|
12396
|
+
|
|
12433
12397
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
12434
12398
|
|
|
12435
12399
|
const getCodeGeneratorVirtualDom = state => {
|
|
@@ -12457,9 +12421,7 @@ const renderContent$1 = {
|
|
|
12457
12421
|
const dom = getCodeGeneratorVirtualDom();
|
|
12458
12422
|
return [SetDom2, newState.uid, dom];
|
|
12459
12423
|
},
|
|
12460
|
-
isEqual(oldState, newState)
|
|
12461
|
-
return oldState.questions === newState.questions;
|
|
12462
|
-
}
|
|
12424
|
+
isEqual: (oldState, newState) => oldState.questions === newState.questions
|
|
12463
12425
|
};
|
|
12464
12426
|
const renderBounds$1 = {
|
|
12465
12427
|
apply(oldState, newState) {
|
|
@@ -12471,17 +12433,11 @@ const renderBounds$1 = {
|
|
|
12471
12433
|
} = newState;
|
|
12472
12434
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
12473
12435
|
},
|
|
12474
|
-
isEqual(oldState, newState)
|
|
12475
|
-
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
12476
|
-
}
|
|
12436
|
+
isEqual: (oldState, newState) => oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height
|
|
12477
12437
|
};
|
|
12478
12438
|
const renderFocus = {
|
|
12479
|
-
apply(oldState, newState)
|
|
12480
|
-
|
|
12481
|
-
},
|
|
12482
|
-
isEqual(oldState, newState) {
|
|
12483
|
-
return oldState.focused === newState.focused && oldState.focusSource === newState.focusSource;
|
|
12484
|
-
}
|
|
12439
|
+
apply: (oldState, newState) => [Focus, '.CodeGeneratorInput', newState.focusSource],
|
|
12440
|
+
isEqual: (oldState, newState) => oldState.focused === newState.focused && oldState.focusSource === newState.focusSource
|
|
12485
12441
|
};
|
|
12486
12442
|
const render$5 = [renderContent$1, renderBounds$1, renderFocus];
|
|
12487
12443
|
const renderFull$2 = (oldState, newState) => {
|
|
@@ -12529,6 +12485,7 @@ const renderFull$1 = (oldState, newState) => {
|
|
|
12529
12485
|
return commands;
|
|
12530
12486
|
};
|
|
12531
12487
|
|
|
12488
|
+
const commandsToForward$1 = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetUid];
|
|
12532
12489
|
const render$3 = widget => {
|
|
12533
12490
|
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
12534
12491
|
const wrappedCommands = [];
|
|
@@ -12536,7 +12493,7 @@ const render$3 = widget => {
|
|
|
12536
12493
|
uid
|
|
12537
12494
|
} = widget.newState;
|
|
12538
12495
|
for (const command of commands) {
|
|
12539
|
-
if (command[0]
|
|
12496
|
+
if (commandsToForward$1.includes(command[0])) {
|
|
12540
12497
|
wrappedCommands.push(command);
|
|
12541
12498
|
} else {
|
|
12542
12499
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
@@ -12595,9 +12552,7 @@ const renderContent = {
|
|
|
12595
12552
|
const dom = getCompletionDetailVirtualDom(newState.content);
|
|
12596
12553
|
return [SetDom2, newState.uid, dom];
|
|
12597
12554
|
},
|
|
12598
|
-
isEqual(oldState, newState)
|
|
12599
|
-
return oldState.content === newState.content;
|
|
12600
|
-
}
|
|
12555
|
+
isEqual: (oldState, newState) => oldState.content === newState.content
|
|
12601
12556
|
};
|
|
12602
12557
|
const renderBounds = {
|
|
12603
12558
|
apply(oldState, newState) {
|
|
@@ -12609,9 +12564,7 @@ const renderBounds = {
|
|
|
12609
12564
|
} = newState;
|
|
12610
12565
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
12611
12566
|
},
|
|
12612
|
-
isEqual(oldState, newState)
|
|
12613
|
-
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
12614
|
-
}
|
|
12567
|
+
isEqual: (oldState, newState) => oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height
|
|
12615
12568
|
};
|
|
12616
12569
|
const render$2 = [renderContent, renderBounds];
|
|
12617
12570
|
const renderFull = (oldState, newState) => {
|
|
@@ -12683,6 +12636,7 @@ const EditorCompletionDetailWidget = {
|
|
|
12683
12636
|
render: render$1
|
|
12684
12637
|
};
|
|
12685
12638
|
|
|
12639
|
+
const commandsToForward = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
12686
12640
|
const render = widget => {
|
|
12687
12641
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
12688
12642
|
const wrappedCommands = [];
|
|
@@ -12690,7 +12644,7 @@ const render = widget => {
|
|
|
12690
12644
|
uid
|
|
12691
12645
|
} = widget.newState;
|
|
12692
12646
|
for (const command of commands) {
|
|
12693
|
-
if (command[0]
|
|
12647
|
+
if (commandsToForward.includes(command[0])) {
|
|
12694
12648
|
wrappedCommands.push(command);
|
|
12695
12649
|
} else {
|
|
12696
12650
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|