@lvce-editor/editor-worker 19.17.4 → 19.18.1
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 +961 -614
- package/package.json +1 -1
- package/dist/editorWorkerMain.min.js +0 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -3,10 +3,67 @@ const toCommandId = key => {
|
|
|
3
3
|
return key.slice(dotIndex + 1);
|
|
4
4
|
};
|
|
5
5
|
const create$j = () => {
|
|
6
|
+
const commandQueues = new Map();
|
|
7
|
+
const generations = Object.create(null);
|
|
6
8
|
const states = Object.create(null);
|
|
7
9
|
const commandMapRef = {};
|
|
10
|
+
const getGeneration = uid => generations[uid] || 0;
|
|
11
|
+
const isCurrentGeneration = (uid, generation) => {
|
|
12
|
+
return states[uid] !== undefined && getGeneration(uid) === generation;
|
|
13
|
+
};
|
|
14
|
+
const updateState = (uid, generation, fallbackState, updater) => {
|
|
15
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
16
|
+
return Promise.resolve(fallbackState);
|
|
17
|
+
}
|
|
18
|
+
const current = states[uid];
|
|
19
|
+
const updatedState = updater(current.newState);
|
|
20
|
+
if (updatedState !== current.newState) {
|
|
21
|
+
states[uid] = {
|
|
22
|
+
newState: updatedState,
|
|
23
|
+
oldState: current.oldState,
|
|
24
|
+
scheduledState: updatedState
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return Promise.resolve(updatedState);
|
|
28
|
+
};
|
|
29
|
+
const createAsyncCommandContext = (uid, generation) => {
|
|
30
|
+
let latestState = states[uid].newState;
|
|
31
|
+
return {
|
|
32
|
+
getState: () => {
|
|
33
|
+
if (isCurrentGeneration(uid, generation)) {
|
|
34
|
+
latestState = states[uid].newState;
|
|
35
|
+
}
|
|
36
|
+
return latestState;
|
|
37
|
+
},
|
|
38
|
+
updateState: async updater => {
|
|
39
|
+
latestState = await updateState(uid, generation, latestState, updater);
|
|
40
|
+
return latestState;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const enqueueCommand = async (uid, command) => {
|
|
45
|
+
const previous = commandQueues.get(uid) || Promise.resolve();
|
|
46
|
+
const run = async () => {
|
|
47
|
+
try {
|
|
48
|
+
await previous;
|
|
49
|
+
} catch {
|
|
50
|
+
// The previous caller receives its error; later commands must still run.
|
|
51
|
+
}
|
|
52
|
+
await command();
|
|
53
|
+
};
|
|
54
|
+
const current = run();
|
|
55
|
+
commandQueues.set(uid, current);
|
|
56
|
+
try {
|
|
57
|
+
await current;
|
|
58
|
+
} finally {
|
|
59
|
+
if (commandQueues.get(uid) === current) {
|
|
60
|
+
commandQueues.delete(uid);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
8
64
|
return {
|
|
9
65
|
clear() {
|
|
66
|
+
commandQueues.clear();
|
|
10
67
|
for (const key of Object.keys(states)) {
|
|
11
68
|
delete states[key];
|
|
12
69
|
}
|
|
@@ -26,6 +83,7 @@ const create$j = () => {
|
|
|
26
83
|
return diffResult;
|
|
27
84
|
},
|
|
28
85
|
dispose(uid) {
|
|
86
|
+
commandQueues.delete(uid);
|
|
29
87
|
delete states[uid];
|
|
30
88
|
},
|
|
31
89
|
get(uid) {
|
|
@@ -43,14 +101,27 @@ const create$j = () => {
|
|
|
43
101
|
Object.assign(commandMapRef, commandMap);
|
|
44
102
|
},
|
|
45
103
|
set(uid, oldState, newState, scheduledState) {
|
|
104
|
+
const current = states[uid];
|
|
105
|
+
if (!current || oldState === newState && newState !== current.newState) {
|
|
106
|
+
generations[uid] = getGeneration(uid) + 1;
|
|
107
|
+
}
|
|
46
108
|
states[uid] = {
|
|
47
109
|
newState,
|
|
48
110
|
oldState,
|
|
49
111
|
scheduledState: scheduledState ?? newState
|
|
50
112
|
};
|
|
51
113
|
},
|
|
114
|
+
wrapAsyncCommand(fn) {
|
|
115
|
+
const wrapped = async (uid, ...args) => {
|
|
116
|
+
const generation = getGeneration(uid);
|
|
117
|
+
const context = createAsyncCommandContext(uid, generation);
|
|
118
|
+
await fn(context, ...args);
|
|
119
|
+
};
|
|
120
|
+
return wrapped;
|
|
121
|
+
},
|
|
52
122
|
wrapCommand(fn) {
|
|
53
123
|
const wrapped = async (uid, ...args) => {
|
|
124
|
+
const generation = getGeneration(uid);
|
|
54
125
|
const {
|
|
55
126
|
newState,
|
|
56
127
|
oldState
|
|
@@ -59,6 +130,9 @@ const create$j = () => {
|
|
|
59
130
|
if (oldState === newerState || newState === newerState) {
|
|
60
131
|
return;
|
|
61
132
|
}
|
|
133
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
62
136
|
const latestOld = states[uid];
|
|
63
137
|
const latestNew = {
|
|
64
138
|
...latestOld.newState,
|
|
@@ -83,6 +157,7 @@ const create$j = () => {
|
|
|
83
157
|
},
|
|
84
158
|
wrapLoadContent(fn) {
|
|
85
159
|
const wrapped = async (uid, ...args) => {
|
|
160
|
+
const generation = getGeneration(uid);
|
|
86
161
|
const {
|
|
87
162
|
newState,
|
|
88
163
|
oldState
|
|
@@ -97,6 +172,11 @@ const create$j = () => {
|
|
|
97
172
|
error
|
|
98
173
|
};
|
|
99
174
|
}
|
|
175
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
176
|
+
return {
|
|
177
|
+
error
|
|
178
|
+
};
|
|
179
|
+
}
|
|
100
180
|
const latestOld = states[uid];
|
|
101
181
|
const latestNew = {
|
|
102
182
|
...latestOld.newState,
|
|
@@ -112,6 +192,51 @@ const create$j = () => {
|
|
|
112
192
|
};
|
|
113
193
|
};
|
|
114
194
|
return wrapped;
|
|
195
|
+
},
|
|
196
|
+
wrapSerialAsyncCommand(fn) {
|
|
197
|
+
const wrapped = async (uid, ...args) => {
|
|
198
|
+
await enqueueCommand(uid, async () => {
|
|
199
|
+
if (!states[uid]) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const generation = getGeneration(uid);
|
|
203
|
+
const context = createAsyncCommandContext(uid, generation);
|
|
204
|
+
await fn(context, ...args);
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
return wrapped;
|
|
208
|
+
},
|
|
209
|
+
wrapSerialCommand(fn) {
|
|
210
|
+
const wrapped = async (uid, ...args) => {
|
|
211
|
+
await enqueueCommand(uid, async () => {
|
|
212
|
+
if (!states[uid]) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const generation = getGeneration(uid);
|
|
216
|
+
const {
|
|
217
|
+
newState,
|
|
218
|
+
oldState
|
|
219
|
+
} = states[uid];
|
|
220
|
+
const newerState = await fn(newState, ...args);
|
|
221
|
+
if (oldState === newerState || newState === newerState) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (!isCurrentGeneration(uid, generation)) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const latestOld = states[uid];
|
|
228
|
+
const latestNew = {
|
|
229
|
+
...latestOld.newState,
|
|
230
|
+
...newerState
|
|
231
|
+
};
|
|
232
|
+
states[uid] = {
|
|
233
|
+
newState: latestNew,
|
|
234
|
+
oldState: latestOld.oldState,
|
|
235
|
+
scheduledState: latestNew
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
return wrapped;
|
|
115
240
|
}
|
|
116
241
|
};
|
|
117
242
|
};
|
|
@@ -284,7 +409,6 @@ const walkValue = (value, transferrables, isTransferrable) => {
|
|
|
284
409
|
for (const property of Object.values(value)) {
|
|
285
410
|
walkValue(property, transferrables, isTransferrable);
|
|
286
411
|
}
|
|
287
|
-
return;
|
|
288
412
|
}
|
|
289
413
|
};
|
|
290
414
|
const getTransferrables = value => {
|
|
@@ -438,7 +562,14 @@ class IpcError extends VError {
|
|
|
438
562
|
const cause = new Error(message);
|
|
439
563
|
// @ts-ignore
|
|
440
564
|
cause.code = code;
|
|
441
|
-
|
|
565
|
+
if (stack) {
|
|
566
|
+
Object.defineProperty(cause, 'stack', {
|
|
567
|
+
configurable: true,
|
|
568
|
+
enumerable: false,
|
|
569
|
+
value: stack,
|
|
570
|
+
writable: true
|
|
571
|
+
});
|
|
572
|
+
}
|
|
442
573
|
super(cause, betterMessage);
|
|
443
574
|
} else {
|
|
444
575
|
super(betterMessage);
|
|
@@ -725,7 +856,10 @@ const constructError = (message, type, name) => {
|
|
|
725
856
|
if (ErrorConstructor === Error) {
|
|
726
857
|
const error = new Error(message);
|
|
727
858
|
if (name && name !== 'VError') {
|
|
728
|
-
error
|
|
859
|
+
Object.defineProperty(error, 'name', {
|
|
860
|
+
configurable: true,
|
|
861
|
+
value: name
|
|
862
|
+
});
|
|
729
863
|
}
|
|
730
864
|
return error;
|
|
731
865
|
}
|
|
@@ -742,8 +876,10 @@ const getCurrentStack = () => {
|
|
|
742
876
|
const currentStack = joinLines$1(splitLines$1(new Error().stack || '').slice(stackLinesToSkip));
|
|
743
877
|
return currentStack;
|
|
744
878
|
};
|
|
745
|
-
const getNewLineIndex = (string, startIndex
|
|
746
|
-
|
|
879
|
+
const getNewLineIndex = (string, startIndex) => {
|
|
880
|
+
{
|
|
881
|
+
return string.indexOf(NewLine$1);
|
|
882
|
+
}
|
|
747
883
|
};
|
|
748
884
|
const getParentStack = error => {
|
|
749
885
|
let parentStack = error.stack || error.data || error.message || '';
|
|
@@ -754,55 +890,91 @@ const getParentStack = error => {
|
|
|
754
890
|
};
|
|
755
891
|
const MethodNotFound = -32601;
|
|
756
892
|
const Custom = -32001;
|
|
893
|
+
const setStack = (error, stack) => {
|
|
894
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
|
|
895
|
+
if (descriptor) {
|
|
896
|
+
if (!descriptor.configurable && !descriptor.writable) {
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
if (!descriptor.configurable && descriptor.writable) {
|
|
900
|
+
error.stack = stack;
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
Object.defineProperty(error, 'stack', {
|
|
905
|
+
configurable: true,
|
|
906
|
+
value: stack,
|
|
907
|
+
writable: true
|
|
908
|
+
});
|
|
909
|
+
};
|
|
910
|
+
const restoreExistingError = (error, currentStack) => {
|
|
911
|
+
if (typeof error.stack === 'string') {
|
|
912
|
+
setStack(error, `${error.stack}${NewLine$1}${currentStack}`);
|
|
913
|
+
}
|
|
914
|
+
return error;
|
|
915
|
+
};
|
|
916
|
+
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
917
|
+
const restoredError = new JsonRpcError(error.message);
|
|
918
|
+
const parentStack = getParentStack(error);
|
|
919
|
+
setStack(restoredError, `${parentStack}${NewLine$1}${currentStack}`);
|
|
920
|
+
return restoredError;
|
|
921
|
+
};
|
|
922
|
+
const restoreStackFromData = (restoredError, error, currentStack) => {
|
|
923
|
+
if (error.data.stack && error.data.type && error.message) {
|
|
924
|
+
setStack(restoredError, `${error.data.type}: ${error.message}${NewLine$1}${error.data.stack}${NewLine$1}${currentStack}`);
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
if (error.data.stack) {
|
|
928
|
+
setStack(restoredError, error.data.stack);
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
const applyDataProperties = (restoredError, error) => {
|
|
932
|
+
restoreStackFromData(restoredError, error, getCurrentStack());
|
|
933
|
+
if (error.data.codeFrame) {
|
|
934
|
+
// @ts-ignore
|
|
935
|
+
restoredError.codeFrame = error.data.codeFrame;
|
|
936
|
+
}
|
|
937
|
+
if (error.data.code) {
|
|
938
|
+
// @ts-ignore
|
|
939
|
+
restoredError.code = error.data.code;
|
|
940
|
+
}
|
|
941
|
+
if (error.data.type) {
|
|
942
|
+
// @ts-ignore
|
|
943
|
+
restoredError.name = error.data.type;
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
const applyDirectProperties = (restoredError, error) => {
|
|
947
|
+
if (error.stack) {
|
|
948
|
+
const lowerStack = restoredError.stack || '';
|
|
949
|
+
const indexNewLine = getNewLineIndex(lowerStack);
|
|
950
|
+
const parentStack = getParentStack(error);
|
|
951
|
+
// @ts-ignore
|
|
952
|
+
setStack(restoredError, `${parentStack}${lowerStack.slice(indexNewLine)}`);
|
|
953
|
+
}
|
|
954
|
+
if (error.codeFrame) {
|
|
955
|
+
// @ts-ignore
|
|
956
|
+
restoredError.codeFrame = error.codeFrame;
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
const restoreMessageError = (error, _currentStack) => {
|
|
960
|
+
const restoredError = constructError(error.message, error.type, error.name);
|
|
961
|
+
if (error.data) {
|
|
962
|
+
applyDataProperties(restoredError, error);
|
|
963
|
+
} else {
|
|
964
|
+
applyDirectProperties(restoredError, error);
|
|
965
|
+
}
|
|
966
|
+
return restoredError;
|
|
967
|
+
};
|
|
757
968
|
const restoreJsonRpcError = error => {
|
|
758
969
|
const currentStack = getCurrentStack();
|
|
759
970
|
if (error && error instanceof Error) {
|
|
760
|
-
|
|
761
|
-
error.stack = error.stack + NewLine$1 + currentStack;
|
|
762
|
-
}
|
|
763
|
-
return error;
|
|
971
|
+
return restoreExistingError(error, currentStack);
|
|
764
972
|
}
|
|
765
973
|
if (error && error.code && error.code === MethodNotFound) {
|
|
766
|
-
|
|
767
|
-
const parentStack = getParentStack(error);
|
|
768
|
-
restoredError.stack = parentStack + NewLine$1 + currentStack;
|
|
769
|
-
return restoredError;
|
|
974
|
+
return restoreMethodNotFoundError(error, currentStack);
|
|
770
975
|
}
|
|
771
976
|
if (error && error.message) {
|
|
772
|
-
|
|
773
|
-
if (error.data) {
|
|
774
|
-
if (error.data.stack && error.data.type && error.message) {
|
|
775
|
-
restoredError.stack = error.data.type + ': ' + error.message + NewLine$1 + error.data.stack + NewLine$1 + currentStack;
|
|
776
|
-
} else if (error.data.stack) {
|
|
777
|
-
restoredError.stack = error.data.stack;
|
|
778
|
-
}
|
|
779
|
-
if (error.data.codeFrame) {
|
|
780
|
-
// @ts-ignore
|
|
781
|
-
restoredError.codeFrame = error.data.codeFrame;
|
|
782
|
-
}
|
|
783
|
-
if (error.data.code) {
|
|
784
|
-
// @ts-ignore
|
|
785
|
-
restoredError.code = error.data.code;
|
|
786
|
-
}
|
|
787
|
-
if (error.data.type) {
|
|
788
|
-
// @ts-ignore
|
|
789
|
-
restoredError.name = error.data.type;
|
|
790
|
-
}
|
|
791
|
-
} else {
|
|
792
|
-
if (error.stack) {
|
|
793
|
-
const lowerStack = restoredError.stack || '';
|
|
794
|
-
// @ts-ignore
|
|
795
|
-
const indexNewLine = getNewLineIndex(lowerStack);
|
|
796
|
-
const parentStack = getParentStack(error);
|
|
797
|
-
// @ts-ignore
|
|
798
|
-
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
799
|
-
}
|
|
800
|
-
if (error.codeFrame) {
|
|
801
|
-
// @ts-ignore
|
|
802
|
-
restoredError.codeFrame = error.codeFrame;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
return restoredError;
|
|
977
|
+
return restoreMessageError(error);
|
|
806
978
|
}
|
|
807
979
|
if (typeof error === 'string') {
|
|
808
980
|
return new Error(`JsonRpc Error: ${error}`);
|
|
@@ -1225,7 +1397,7 @@ const createMockRpc = ({
|
|
|
1225
1397
|
};
|
|
1226
1398
|
|
|
1227
1399
|
const rpcs = Object.create(null);
|
|
1228
|
-
const set$
|
|
1400
|
+
const set$h = (id, rpc) => {
|
|
1229
1401
|
rpcs[id] = rpc;
|
|
1230
1402
|
};
|
|
1231
1403
|
const get$8 = id => {
|
|
@@ -1258,7 +1430,7 @@ const create$9 = rpcId => {
|
|
|
1258
1430
|
const mockRpc = createMockRpc({
|
|
1259
1431
|
commandMap
|
|
1260
1432
|
});
|
|
1261
|
-
set$
|
|
1433
|
+
set$h(rpcId, mockRpc);
|
|
1262
1434
|
// @ts-ignore
|
|
1263
1435
|
mockRpc[Symbol.dispose] = () => {
|
|
1264
1436
|
remove$8(rpcId);
|
|
@@ -1267,20 +1439,187 @@ const create$9 = rpcId => {
|
|
|
1267
1439
|
return mockRpc;
|
|
1268
1440
|
},
|
|
1269
1441
|
set(rpc) {
|
|
1270
|
-
set$
|
|
1442
|
+
set$h(rpcId, rpc);
|
|
1271
1443
|
}
|
|
1272
1444
|
};
|
|
1273
1445
|
};
|
|
1274
1446
|
|
|
1447
|
+
const Audio = 0;
|
|
1448
|
+
const Button$1 = 1;
|
|
1449
|
+
const Col = 2;
|
|
1450
|
+
const ColGroup = 3;
|
|
1451
|
+
const Div$1 = 4;
|
|
1452
|
+
const H1 = 5;
|
|
1453
|
+
const Input$1 = 6;
|
|
1454
|
+
const Kbd = 7;
|
|
1455
|
+
const Span$1 = 8;
|
|
1456
|
+
const Table = 9;
|
|
1457
|
+
const TBody = 10;
|
|
1458
|
+
const Td = 11;
|
|
1275
1459
|
const Text$1 = 12;
|
|
1460
|
+
const Th = 13;
|
|
1461
|
+
const THead = 14;
|
|
1462
|
+
const Tr = 15;
|
|
1463
|
+
const I = 16;
|
|
1464
|
+
const Img = 17;
|
|
1465
|
+
const Root = 0;
|
|
1466
|
+
const Ins = 20;
|
|
1467
|
+
const Del = 21;
|
|
1468
|
+
const H2 = 22;
|
|
1469
|
+
const H3 = 23;
|
|
1470
|
+
const H4 = 24;
|
|
1471
|
+
const H5 = 25;
|
|
1472
|
+
const H6 = 26;
|
|
1473
|
+
const Article = 27;
|
|
1474
|
+
const Aside = 28;
|
|
1475
|
+
const Footer = 29;
|
|
1476
|
+
const Header = 30;
|
|
1477
|
+
const Nav = 40;
|
|
1478
|
+
const Section = 41;
|
|
1479
|
+
const Search = 42;
|
|
1480
|
+
const Dd = 43;
|
|
1481
|
+
const Dl = 44;
|
|
1482
|
+
const Figcaption = 45;
|
|
1483
|
+
const Figure = 46;
|
|
1484
|
+
const Hr = 47;
|
|
1485
|
+
const Li = 48;
|
|
1486
|
+
const Ol = 49;
|
|
1487
|
+
const P = 50;
|
|
1488
|
+
const Pre = 51;
|
|
1489
|
+
const A = 53;
|
|
1490
|
+
const Abbr = 54;
|
|
1491
|
+
const Br = 55;
|
|
1492
|
+
const Cite = 56;
|
|
1493
|
+
const Data = 57;
|
|
1494
|
+
const Time = 58;
|
|
1495
|
+
const Tfoot = 59;
|
|
1496
|
+
const Ul = 60;
|
|
1497
|
+
const Video = 61;
|
|
1498
|
+
const TextArea$1 = 62;
|
|
1499
|
+
const Select = 63;
|
|
1500
|
+
const Option = 64;
|
|
1501
|
+
const Code = 65;
|
|
1502
|
+
const Label = 66;
|
|
1503
|
+
const Dt = 67;
|
|
1504
|
+
const Iframe = 68;
|
|
1505
|
+
const Main = 69;
|
|
1506
|
+
const Strong = 70;
|
|
1507
|
+
const Em = 71;
|
|
1508
|
+
const Style = 72;
|
|
1509
|
+
const Html = 73;
|
|
1510
|
+
const Head = 74;
|
|
1511
|
+
const Title = 75;
|
|
1512
|
+
const Meta = 76;
|
|
1513
|
+
const Canvas = 77;
|
|
1514
|
+
const Form = 78;
|
|
1515
|
+
const BlockQuote = 79;
|
|
1516
|
+
const Quote = 80;
|
|
1517
|
+
const Circle = 81;
|
|
1518
|
+
const Defs = 82;
|
|
1519
|
+
const Ellipse = 83;
|
|
1520
|
+
const G = 84;
|
|
1521
|
+
const Line = 85;
|
|
1522
|
+
const Path = 86;
|
|
1523
|
+
const Polygon = 87;
|
|
1524
|
+
const Polyline = 88;
|
|
1525
|
+
const Rect = 89;
|
|
1526
|
+
const Svg = 90;
|
|
1527
|
+
const Use = 91;
|
|
1276
1528
|
const Reference = 100;
|
|
1277
1529
|
|
|
1530
|
+
const VirtualDomElements = {
|
|
1531
|
+
__proto__: null,
|
|
1532
|
+
A,
|
|
1533
|
+
Abbr,
|
|
1534
|
+
Article,
|
|
1535
|
+
Aside,
|
|
1536
|
+
Audio,
|
|
1537
|
+
BlockQuote,
|
|
1538
|
+
Br,
|
|
1539
|
+
Button: Button$1,
|
|
1540
|
+
Canvas,
|
|
1541
|
+
Circle,
|
|
1542
|
+
Cite,
|
|
1543
|
+
Code,
|
|
1544
|
+
Col,
|
|
1545
|
+
ColGroup,
|
|
1546
|
+
Data,
|
|
1547
|
+
Dd,
|
|
1548
|
+
Defs,
|
|
1549
|
+
Del,
|
|
1550
|
+
Div: Div$1,
|
|
1551
|
+
Dl,
|
|
1552
|
+
Dt,
|
|
1553
|
+
Ellipse,
|
|
1554
|
+
Em,
|
|
1555
|
+
Figcaption,
|
|
1556
|
+
Figure,
|
|
1557
|
+
Footer,
|
|
1558
|
+
Form,
|
|
1559
|
+
G,
|
|
1560
|
+
H1,
|
|
1561
|
+
H2,
|
|
1562
|
+
H3,
|
|
1563
|
+
H4,
|
|
1564
|
+
H5,
|
|
1565
|
+
H6,
|
|
1566
|
+
Head,
|
|
1567
|
+
Header,
|
|
1568
|
+
Hr,
|
|
1569
|
+
Html,
|
|
1570
|
+
I,
|
|
1571
|
+
Iframe,
|
|
1572
|
+
Img,
|
|
1573
|
+
Input: Input$1,
|
|
1574
|
+
Ins,
|
|
1575
|
+
Kbd,
|
|
1576
|
+
Label,
|
|
1577
|
+
Li,
|
|
1578
|
+
Line,
|
|
1579
|
+
Main,
|
|
1580
|
+
Meta,
|
|
1581
|
+
Nav,
|
|
1582
|
+
Ol,
|
|
1583
|
+
Option,
|
|
1584
|
+
P,
|
|
1585
|
+
Path,
|
|
1586
|
+
Polygon,
|
|
1587
|
+
Polyline,
|
|
1588
|
+
Pre,
|
|
1589
|
+
Quote,
|
|
1590
|
+
Rect,
|
|
1591
|
+
Reference,
|
|
1592
|
+
Root,
|
|
1593
|
+
Search,
|
|
1594
|
+
Section,
|
|
1595
|
+
Select,
|
|
1596
|
+
Span: Span$1,
|
|
1597
|
+
Strong,
|
|
1598
|
+
Style,
|
|
1599
|
+
Svg,
|
|
1600
|
+
TBody,
|
|
1601
|
+
THead,
|
|
1602
|
+
Table,
|
|
1603
|
+
Td,
|
|
1604
|
+
Text: Text$1,
|
|
1605
|
+
TextArea: TextArea$1,
|
|
1606
|
+
Tfoot,
|
|
1607
|
+
Th,
|
|
1608
|
+
Time,
|
|
1609
|
+
Title,
|
|
1610
|
+
Tr,
|
|
1611
|
+
Ul,
|
|
1612
|
+
Use,
|
|
1613
|
+
Video
|
|
1614
|
+
};
|
|
1615
|
+
|
|
1278
1616
|
const AltKey = 'event.altKey';
|
|
1279
1617
|
const Button = 'event.button';
|
|
1280
1618
|
const ClientX = 'event.clientX';
|
|
1281
1619
|
const ClientY = 'event.clientY';
|
|
1282
1620
|
const DeltaMode = 'event.deltaMode';
|
|
1283
1621
|
const DeltaY = 'event.deltaY';
|
|
1622
|
+
const Key = 'event.key';
|
|
1284
1623
|
|
|
1285
1624
|
const Backspace = 1;
|
|
1286
1625
|
const Tab$1 = 2;
|
|
@@ -1339,6 +1678,7 @@ const Electron = 2;
|
|
|
1339
1678
|
const CompletionWorker = 301;
|
|
1340
1679
|
const DebugWorker = 55;
|
|
1341
1680
|
const EditorWorker = 99;
|
|
1681
|
+
const ErrorWorker = 3308;
|
|
1342
1682
|
const ExtensionHostWorker = 44;
|
|
1343
1683
|
const ExtensionManagementWorker = 9006;
|
|
1344
1684
|
const IconThemeWorker = 7009;
|
|
@@ -1346,27 +1686,32 @@ const MarkdownWorker = 300;
|
|
|
1346
1686
|
const OpenerWorker = 4561;
|
|
1347
1687
|
const RendererWorker$1 = 1;
|
|
1348
1688
|
|
|
1349
|
-
const FocusSelector = 'Viewlet.focusSelector';
|
|
1689
|
+
const FocusSelector$1 = 'Viewlet.focusSelector';
|
|
1350
1690
|
const SetCss$1 = 'Viewlet.setCss';
|
|
1351
1691
|
const SetFocusContext$1 = 'Viewlet.setFocusContext';
|
|
1352
1692
|
const SetPatches = 'Viewlet.setPatches';
|
|
1353
1693
|
|
|
1354
1694
|
const FocusEditorText$1 = 12;
|
|
1355
1695
|
|
|
1696
|
+
const {
|
|
1697
|
+
invoke: invoke$g,
|
|
1698
|
+
set: set$g
|
|
1699
|
+
} = create$9(ErrorWorker);
|
|
1700
|
+
|
|
1356
1701
|
const {
|
|
1357
1702
|
invoke: invoke$f,
|
|
1358
|
-
set: set$
|
|
1703
|
+
set: set$f
|
|
1359
1704
|
} = create$9(ExtensionHostWorker);
|
|
1360
1705
|
|
|
1361
1706
|
const ExtensionHost = {
|
|
1362
1707
|
__proto__: null,
|
|
1363
1708
|
invoke: invoke$f,
|
|
1364
|
-
set: set$
|
|
1709
|
+
set: set$f
|
|
1365
1710
|
};
|
|
1366
1711
|
|
|
1367
1712
|
const {
|
|
1368
1713
|
invoke: invoke$e,
|
|
1369
|
-
set: set$
|
|
1714
|
+
set: set$e
|
|
1370
1715
|
} = create$9(ExtensionManagementWorker);
|
|
1371
1716
|
const getLanguages$1 = (platform, assetDir) => {
|
|
1372
1717
|
return invoke$e('Extensions.getLanguages', platform, assetDir);
|
|
@@ -1374,7 +1719,7 @@ const getLanguages$1 = (platform, assetDir) => {
|
|
|
1374
1719
|
|
|
1375
1720
|
const {
|
|
1376
1721
|
invoke: invoke$d,
|
|
1377
|
-
set: set$
|
|
1722
|
+
set: set$d
|
|
1378
1723
|
} = create$9(OpenerWorker);
|
|
1379
1724
|
const openUrl = async (url, platform) => {
|
|
1380
1725
|
return invoke$d('Open.openUrl', url, platform);
|
|
@@ -1382,13 +1727,13 @@ const openUrl = async (url, platform) => {
|
|
|
1382
1727
|
|
|
1383
1728
|
const {
|
|
1384
1729
|
invoke: invoke$c,
|
|
1385
|
-
set: set$
|
|
1730
|
+
set: set$c
|
|
1386
1731
|
} = create$9(IconThemeWorker);
|
|
1387
1732
|
|
|
1388
1733
|
const {
|
|
1389
1734
|
invoke: invoke$b,
|
|
1390
1735
|
invokeAndTransfer,
|
|
1391
|
-
set: set$
|
|
1736
|
+
set: set$b
|
|
1392
1737
|
} = create$9(RendererWorker$1);
|
|
1393
1738
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1394
1739
|
number(uid);
|
|
@@ -1401,6 +1746,10 @@ const sendMessagePortToOpenerWorker = async (port, rpcId) => {
|
|
|
1401
1746
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1402
1747
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
|
|
1403
1748
|
};
|
|
1749
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1750
|
+
const command = 'Errors.handleMessagePort';
|
|
1751
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1752
|
+
};
|
|
1404
1753
|
const readFile = async uri => {
|
|
1405
1754
|
return invoke$b('FileSystem.readFile', uri);
|
|
1406
1755
|
};
|
|
@@ -1448,25 +1797,26 @@ const RendererWorker = {
|
|
|
1448
1797
|
openUri,
|
|
1449
1798
|
readClipBoardText,
|
|
1450
1799
|
readFile,
|
|
1800
|
+
sendMessagePortToErrorWorker,
|
|
1451
1801
|
sendMessagePortToExtensionHostWorker,
|
|
1452
1802
|
sendMessagePortToExtensionManagementWorker: sendMessagePortToExtensionManagementWorker$1,
|
|
1453
1803
|
sendMessagePortToOpenerWorker,
|
|
1454
1804
|
sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
|
|
1455
1805
|
sendMessagePortToTextMeasurementWorker,
|
|
1456
|
-
set: set$
|
|
1806
|
+
set: set$b,
|
|
1457
1807
|
showContextMenu2,
|
|
1458
1808
|
writeClipBoardText
|
|
1459
1809
|
};
|
|
1460
1810
|
|
|
1461
1811
|
const {
|
|
1462
1812
|
invoke: invoke$a,
|
|
1463
|
-
set: set$
|
|
1813
|
+
set: set$a
|
|
1464
1814
|
} = create$9(MarkdownWorker);
|
|
1465
1815
|
|
|
1466
1816
|
const SyntaxHighlightingWorker = {
|
|
1467
1817
|
__proto__: null,
|
|
1468
1818
|
invoke: invoke$a,
|
|
1469
|
-
set: set$
|
|
1819
|
+
set: set$a
|
|
1470
1820
|
};
|
|
1471
1821
|
|
|
1472
1822
|
const createLazyRpc = rpcId => {
|
|
@@ -1474,7 +1824,7 @@ const createLazyRpc = rpcId => {
|
|
|
1474
1824
|
let factory;
|
|
1475
1825
|
const createRpc = async () => {
|
|
1476
1826
|
const rpc = await factory();
|
|
1477
|
-
set$
|
|
1827
|
+
set$h(rpcId, rpc);
|
|
1478
1828
|
};
|
|
1479
1829
|
const ensureRpc = async () => {
|
|
1480
1830
|
if (!rpcPromise) {
|
|
@@ -1584,7 +1934,7 @@ const getKeys$2 = () => {
|
|
|
1584
1934
|
const keys = editorStates.getKeys();
|
|
1585
1935
|
return keys.map(String);
|
|
1586
1936
|
};
|
|
1587
|
-
const set$
|
|
1937
|
+
const set$9 = (id, oldEditor, newEditor) => {
|
|
1588
1938
|
editorStates.set(id, oldEditor, newEditor);
|
|
1589
1939
|
};
|
|
1590
1940
|
|
|
@@ -1685,7 +2035,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1685
2035
|
x,
|
|
1686
2036
|
y
|
|
1687
2037
|
};
|
|
1688
|
-
set$
|
|
2038
|
+
set$9(id, editor, editor);
|
|
1689
2039
|
};
|
|
1690
2040
|
|
|
1691
2041
|
// TODO use numeric enum
|
|
@@ -1708,7 +2058,7 @@ const Rename = 'rename';
|
|
|
1708
2058
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1709
2059
|
|
|
1710
2060
|
const map$1 = Object.create(null);
|
|
1711
|
-
const set$
|
|
2061
|
+
const set$8 = (id, widget) => {
|
|
1712
2062
|
map$1[id] = widget;
|
|
1713
2063
|
};
|
|
1714
2064
|
const get$6 = id => {
|
|
@@ -1756,6 +2106,7 @@ const clamp = (num, min, max) => {
|
|
|
1756
2106
|
};
|
|
1757
2107
|
|
|
1758
2108
|
const Link$1 = 'Link';
|
|
2109
|
+
const EditorGoToDefinitionLink = 'EditorGoToDefinitionLink';
|
|
1759
2110
|
const Function = 'Function';
|
|
1760
2111
|
const Parameter = 'Parameter';
|
|
1761
2112
|
const Type = 'Type';
|
|
@@ -1763,6 +2114,7 @@ const VariableName = 'VariableName';
|
|
|
1763
2114
|
const Class = 'Class';
|
|
1764
2115
|
|
|
1765
2116
|
const Link = 1;
|
|
2117
|
+
const DefinitionLink = 2;
|
|
1766
2118
|
const Ts2816 = 2816;
|
|
1767
2119
|
const Ts2817 = 2817;
|
|
1768
2120
|
const Ts2824 = 2824;
|
|
@@ -1803,6 +2155,10 @@ const Ts272 = 272;
|
|
|
1803
2155
|
|
|
1804
2156
|
const getDecorationClassName = type => {
|
|
1805
2157
|
switch (type) {
|
|
2158
|
+
case 3:
|
|
2159
|
+
return 'R';
|
|
2160
|
+
case DefinitionLink:
|
|
2161
|
+
return EditorGoToDefinitionLink;
|
|
1806
2162
|
case Link:
|
|
1807
2163
|
return Link$1;
|
|
1808
2164
|
case Ts1024:
|
|
@@ -1948,7 +2304,7 @@ const getEnabled$1 = () => {
|
|
|
1948
2304
|
|
|
1949
2305
|
const {
|
|
1950
2306
|
invoke: invoke$8,
|
|
1951
|
-
set: set$
|
|
2307
|
+
set: set$7
|
|
1952
2308
|
} = SyntaxHighlightingWorker;
|
|
1953
2309
|
|
|
1954
2310
|
const state$9 = {
|
|
@@ -1959,7 +2315,7 @@ const state$9 = {
|
|
|
1959
2315
|
const has = languageId => {
|
|
1960
2316
|
return Object.hasOwn(state$9.tokenizers, languageId);
|
|
1961
2317
|
};
|
|
1962
|
-
const set$
|
|
2318
|
+
const set$6 = (languageId, tokenizer) => {
|
|
1963
2319
|
state$9.tokenizers[languageId] = tokenizer;
|
|
1964
2320
|
};
|
|
1965
2321
|
const get$5 = languageId => {
|
|
@@ -1983,7 +2339,7 @@ const isPending = languageId => {
|
|
|
1983
2339
|
};
|
|
1984
2340
|
|
|
1985
2341
|
const tokenMaps = Object.create(null);
|
|
1986
|
-
const set$
|
|
2342
|
+
const set$5 = (languageId, tokenMap) => {
|
|
1987
2343
|
tokenMaps[languageId] = tokenMap;
|
|
1988
2344
|
};
|
|
1989
2345
|
const get$4 = languageId => {
|
|
@@ -1999,7 +2355,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
1999
2355
|
if (getEnabled$1()) {
|
|
2000
2356
|
// @ts-ignore
|
|
2001
2357
|
const tokenMap = await invoke$8('Tokenizer.load', languageId, tokenizePath);
|
|
2002
|
-
set$
|
|
2358
|
+
set$5(languageId, tokenMap);
|
|
2003
2359
|
return;
|
|
2004
2360
|
}
|
|
2005
2361
|
try {
|
|
@@ -2015,8 +2371,8 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2015
2371
|
console.warn(`tokenizer.TokenMap should be an object in "${tokenizePath}"`);
|
|
2016
2372
|
return;
|
|
2017
2373
|
}
|
|
2018
|
-
set$
|
|
2019
|
-
set$
|
|
2374
|
+
set$5(languageId, tokenizer.TokenMap);
|
|
2375
|
+
set$6(languageId, tokenizer);
|
|
2020
2376
|
} catch (error) {
|
|
2021
2377
|
// TODO better error handling
|
|
2022
2378
|
console.error(error);
|
|
@@ -2033,7 +2389,7 @@ const getTokenizer = languageId => {
|
|
|
2033
2389
|
};
|
|
2034
2390
|
|
|
2035
2391
|
const tokenizers = Object.create(null);
|
|
2036
|
-
const set$
|
|
2392
|
+
const set$4 = (id, value) => {
|
|
2037
2393
|
tokenizers[id] = value;
|
|
2038
2394
|
};
|
|
2039
2395
|
const get$3 = id => {
|
|
@@ -3151,9 +3507,9 @@ const splitLines = lines => {
|
|
|
3151
3507
|
const {
|
|
3152
3508
|
invoke: invoke$7} = RendererWorker;
|
|
3153
3509
|
|
|
3154
|
-
const notifyTabModifiedStatusChange = async uri => {
|
|
3510
|
+
const notifyTabModifiedStatusChange = async (uri, modified) => {
|
|
3155
3511
|
try {
|
|
3156
|
-
await invoke$7('Main.handleModifiedStatusChange', uri,
|
|
3512
|
+
await invoke$7('Main.handleModifiedStatusChange', uri, modified);
|
|
3157
3513
|
} catch {
|
|
3158
3514
|
// ignore
|
|
3159
3515
|
}
|
|
@@ -3557,11 +3913,11 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
3557
3913
|
...newEditor,
|
|
3558
3914
|
decorations: linkDecorations
|
|
3559
3915
|
};
|
|
3560
|
-
set$
|
|
3916
|
+
set$9(editor.uid, editor, newEditorWithDecorations);
|
|
3561
3917
|
|
|
3562
3918
|
// Notify main-area-worker about modified status change
|
|
3563
3919
|
if (!editor.modified) {
|
|
3564
|
-
await notifyTabModifiedStatusChange(editor.uri);
|
|
3920
|
+
await notifyTabModifiedStatusChange(editor.uri, true);
|
|
3565
3921
|
}
|
|
3566
3922
|
|
|
3567
3923
|
// Notify registered listeners about editor changes
|
|
@@ -3773,7 +4129,7 @@ const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
|
3773
4129
|
|
|
3774
4130
|
const {
|
|
3775
4131
|
invoke: invoke$6,
|
|
3776
|
-
set: set$
|
|
4132
|
+
set: set$3
|
|
3777
4133
|
} = ExtensionHost;
|
|
3778
4134
|
|
|
3779
4135
|
const getFileExtensionIndex = file => {
|
|
@@ -3844,6 +4200,26 @@ const get$2 = async key => {
|
|
|
3844
4200
|
return value;
|
|
3845
4201
|
};
|
|
3846
4202
|
|
|
4203
|
+
const logError = async (error, prefix) => {
|
|
4204
|
+
const prettyError = await invoke$g('Errors.prepare', error);
|
|
4205
|
+
await invoke$g('Errors.print', prettyError, prefix);
|
|
4206
|
+
};
|
|
4207
|
+
const logFallback = (error, prefix) => {
|
|
4208
|
+
if (prefix) {
|
|
4209
|
+
console.error(prefix, error);
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
console.error(error);
|
|
4213
|
+
};
|
|
4214
|
+
const handleError$1 = async (error, prefix = '') => {
|
|
4215
|
+
try {
|
|
4216
|
+
await logError(error, prefix);
|
|
4217
|
+
} catch (otherError) {
|
|
4218
|
+
console.warn('ErrorHandling error', otherError);
|
|
4219
|
+
logFallback(error, prefix);
|
|
4220
|
+
}
|
|
4221
|
+
};
|
|
4222
|
+
|
|
3847
4223
|
const OnDiagnostic = 'onDiagnostic';
|
|
3848
4224
|
const OnHover = 'onHover';
|
|
3849
4225
|
const OnTabCompletion = 'onTabCompletion';
|
|
@@ -3986,11 +4362,11 @@ const addDiagnostics = async (editor, diagnostics) => {
|
|
|
3986
4362
|
visualDecorations
|
|
3987
4363
|
};
|
|
3988
4364
|
};
|
|
3989
|
-
const handleError
|
|
4365
|
+
const handleError = async (error, editor) => {
|
|
3990
4366
|
if (error instanceof Error && error.message.includes('No diagnostic provider found')) {
|
|
3991
4367
|
return editor;
|
|
3992
4368
|
}
|
|
3993
|
-
|
|
4369
|
+
await handleError$1(error, 'Failed to update diagnostics: ');
|
|
3994
4370
|
return editor;
|
|
3995
4371
|
};
|
|
3996
4372
|
const getEditorWithDiagnostics = async editor => {
|
|
@@ -4001,7 +4377,7 @@ const getEditorWithDiagnostics = async editor => {
|
|
|
4001
4377
|
}
|
|
4002
4378
|
return addDiagnostics(editor, diagnostics);
|
|
4003
4379
|
} catch (error) {
|
|
4004
|
-
return handleError
|
|
4380
|
+
return handleError(error, editor);
|
|
4005
4381
|
}
|
|
4006
4382
|
};
|
|
4007
4383
|
const updateDiagnostics = async editor => {
|
|
@@ -4012,12 +4388,12 @@ const updateDiagnostics = async editor => {
|
|
|
4012
4388
|
return editor;
|
|
4013
4389
|
}
|
|
4014
4390
|
const newEditor = await addDiagnostics(latest.newState, diagnostics);
|
|
4015
|
-
set$
|
|
4391
|
+
set$9(editor.id, latest.oldState, newEditor);
|
|
4016
4392
|
// @ts-ignore
|
|
4017
4393
|
await invoke$b('Editor.rerender', editor.id);
|
|
4018
4394
|
return newEditor;
|
|
4019
4395
|
} catch (error) {
|
|
4020
|
-
return handleError
|
|
4396
|
+
return handleError(error, editor);
|
|
4021
4397
|
}
|
|
4022
4398
|
};
|
|
4023
4399
|
|
|
@@ -4170,7 +4546,7 @@ const createEditor = async ({
|
|
|
4170
4546
|
focused: true,
|
|
4171
4547
|
textInfos
|
|
4172
4548
|
};
|
|
4173
|
-
set$
|
|
4549
|
+
set$9(id, emptyEditor, newEditor4);
|
|
4174
4550
|
|
|
4175
4551
|
// TODO only sync when needed
|
|
4176
4552
|
// e.g. it might not always be necessary to send text to extension host worker
|
|
@@ -4179,7 +4555,7 @@ const createEditor = async ({
|
|
|
4179
4555
|
const editorWithDiagnostics = diagnosticsEnabled ? await updateDiagnostics(newEditor4) : newEditor4;
|
|
4180
4556
|
const completionsOnTypeRaw = await get$2('editor.completionsOnType');
|
|
4181
4557
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
4182
|
-
set$
|
|
4558
|
+
set$9(id, emptyEditor, {
|
|
4183
4559
|
...editorWithDiagnostics,
|
|
4184
4560
|
completionsOnType
|
|
4185
4561
|
});
|
|
@@ -4190,13 +4566,16 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
4190
4566
|
};
|
|
4191
4567
|
|
|
4192
4568
|
const isEqual$2 = (oldState, newState) => {
|
|
4569
|
+
if (oldState.focus !== newState.focus) {
|
|
4570
|
+
return false;
|
|
4571
|
+
}
|
|
4193
4572
|
if (!newState.focused) {
|
|
4194
4573
|
return true;
|
|
4195
4574
|
}
|
|
4196
4575
|
if (!oldState.isSelecting && newState.isSelecting) {
|
|
4197
4576
|
return false;
|
|
4198
4577
|
}
|
|
4199
|
-
return oldState.focused === newState.focused
|
|
4578
|
+
return oldState.focused === newState.focused;
|
|
4200
4579
|
};
|
|
4201
4580
|
|
|
4202
4581
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -4474,50 +4853,20 @@ const applyWorkspaceEdit = async (editor, changes) => {
|
|
|
4474
4853
|
return scheduleDocumentAndCursorsSelections(editor, textChanges);
|
|
4475
4854
|
};
|
|
4476
4855
|
|
|
4477
|
-
const
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
focused: false
|
|
4856
|
+
const getFormattingEdits = async editor => {
|
|
4857
|
+
const textDocument = {
|
|
4858
|
+
documentId: editor.id || editor.uid,
|
|
4859
|
+
languageId: editor.languageId,
|
|
4860
|
+
text: getText$1(editor),
|
|
4861
|
+
uri: editor.uri
|
|
4484
4862
|
};
|
|
4485
|
-
return
|
|
4486
|
-
};
|
|
4487
|
-
|
|
4488
|
-
const replaceRange = (editor, ranges, replacement, origin) => {
|
|
4489
|
-
const changes = [];
|
|
4490
|
-
const rangesLength = ranges.length;
|
|
4491
|
-
for (let i = 0; i < rangesLength; i += 4) {
|
|
4492
|
-
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn] = getSelectionPairs(ranges, i);
|
|
4493
|
-
const start = {
|
|
4494
|
-
columnIndex: selectionStartColumn,
|
|
4495
|
-
rowIndex: selectionStartRow
|
|
4496
|
-
};
|
|
4497
|
-
const end = {
|
|
4498
|
-
columnIndex: selectionEndColumn,
|
|
4499
|
-
rowIndex: selectionEndRow
|
|
4500
|
-
};
|
|
4501
|
-
const selection = {
|
|
4502
|
-
end,
|
|
4503
|
-
start
|
|
4504
|
-
};
|
|
4505
|
-
changes.push({
|
|
4506
|
-
deleted: getSelectionText(editor, selection),
|
|
4507
|
-
end: end,
|
|
4508
|
-
inserted: replacement,
|
|
4509
|
-
origin,
|
|
4510
|
-
start: start
|
|
4511
|
-
});
|
|
4512
|
-
}
|
|
4513
|
-
return changes;
|
|
4863
|
+
return invoke$e('Extensions.executeFormattingProvider', textDocument);
|
|
4514
4864
|
};
|
|
4515
4865
|
|
|
4516
|
-
const
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
return replaceRange(editor, selections, replacement, origin);
|
|
4866
|
+
const expectedErrorMessage$1 = 'Failed to execute formatting provider: FormattingError:';
|
|
4867
|
+
const isFormattingError = error => {
|
|
4868
|
+
// @ts-ignore
|
|
4869
|
+
return error && error instanceof Error && error.message.startsWith(expectedErrorMessage$1);
|
|
4521
4870
|
};
|
|
4522
4871
|
|
|
4523
4872
|
const create$8 = () => {
|
|
@@ -4737,77 +5086,259 @@ const showErrorMessage = (editor, rowIndex, columnIndex, message) => {
|
|
|
4737
5086
|
return editorShowMessage(editor, rowIndex, columnIndex, message);
|
|
4738
5087
|
};
|
|
4739
5088
|
|
|
4740
|
-
|
|
4741
|
-
const getErrorMessage$5 = String;
|
|
5089
|
+
const expectedErrorMessage = 'Failed to execute formatting provider: FormattingError:';
|
|
4742
5090
|
|
|
4743
|
-
//
|
|
4744
|
-
const
|
|
4745
|
-
switch (brace) {
|
|
4746
|
-
case '(':
|
|
4747
|
-
return ')';
|
|
4748
|
-
case '[':
|
|
4749
|
-
return ']';
|
|
4750
|
-
case '{':
|
|
4751
|
-
return '}';
|
|
4752
|
-
default:
|
|
4753
|
-
return '???';
|
|
4754
|
-
}
|
|
4755
|
-
};
|
|
4756
|
-
const braceCompletion = async (editor, text) => {
|
|
5091
|
+
// TODO also format with cursor
|
|
5092
|
+
const format = async editor => {
|
|
4757
5093
|
try {
|
|
4758
|
-
const
|
|
4759
|
-
|
|
4760
|
-
const result = await invoke$b('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
4761
|
-
if (result) {
|
|
4762
|
-
const closingBrace = getMatchingClosingBrace$1(text);
|
|
4763
|
-
const insertText = text + closingBrace;
|
|
4764
|
-
const changes = editorReplaceSelections(editor, [insertText], EditorType);
|
|
4765
|
-
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
4766
|
-
}
|
|
4767
|
-
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
4768
|
-
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
5094
|
+
const edits = await getFormattingEdits(editor);
|
|
5095
|
+
return applyDocumentEdits(editor, edits);
|
|
4769
5096
|
} catch (error) {
|
|
5097
|
+
if (isFormattingError(error)) {
|
|
5098
|
+
console.error('Formatting Error:',
|
|
5099
|
+
// @ts-ignore
|
|
5100
|
+
error.message.slice(expectedErrorMessage.length));
|
|
5101
|
+
return editor;
|
|
5102
|
+
}
|
|
4770
5103
|
console.error(error);
|
|
4771
|
-
// TODO cursor should always be of type object
|
|
4772
|
-
const position = Array.isArray(editor.cursor) ? editor.cursor[0] : editor.cursor;
|
|
4773
|
-
// @ts-ignore
|
|
4774
|
-
return showErrorMessage(editor, position, getErrorMessage$5(error));
|
|
4775
|
-
}
|
|
4776
|
-
};
|
|
4777
|
-
const getCursorOffset = editor => {
|
|
4778
|
-
return offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
4779
|
-
};
|
|
4780
5104
|
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
} = editor;
|
|
4785
|
-
if (selections.length === 4 && selections[0] === selections[2] && selections[1] === selections[3]) {
|
|
5105
|
+
// TODO configure editor message as widget
|
|
5106
|
+
const displayErrorMessage = String(error);
|
|
5107
|
+
await editorShowMessage(editor, 0, 0, displayErrorMessage);
|
|
4786
5108
|
return editor;
|
|
4787
5109
|
}
|
|
4788
|
-
const newSelections = alloc(4);
|
|
4789
|
-
moveRangeToPosition$1(newSelections, 0, selections[0], selections[1]);
|
|
4790
|
-
return scheduleSelections(editor, newSelections);
|
|
4791
5110
|
};
|
|
4792
5111
|
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
return i;
|
|
4797
|
-
}
|
|
4798
|
-
}
|
|
4799
|
-
return -1;
|
|
4800
|
-
};
|
|
4801
|
-
const removeEditorWidget = (widgets, id) => {
|
|
4802
|
-
const index = getIndex(widgets, id);
|
|
4803
|
-
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
4804
|
-
return newWidgets;
|
|
5112
|
+
// @ts-ignore
|
|
5113
|
+
const getNewEditor$1 = async editor => {
|
|
5114
|
+
return editor;
|
|
4805
5115
|
};
|
|
4806
5116
|
|
|
4807
|
-
const
|
|
4808
|
-
return
|
|
5117
|
+
const isUntitledFile = uri => {
|
|
5118
|
+
return uri.startsWith('untitled:');
|
|
4809
5119
|
};
|
|
4810
|
-
|
|
5120
|
+
|
|
5121
|
+
const saveNormalFile = async (uri, content) => {
|
|
5122
|
+
await invoke$b('FileSystem.writeFile', uri, content);
|
|
5123
|
+
};
|
|
5124
|
+
|
|
5125
|
+
const showFilePicker = async platform => {
|
|
5126
|
+
const dialogTitle = 'Save File'; // TODO use i18n string
|
|
5127
|
+
const {
|
|
5128
|
+
canceled,
|
|
5129
|
+
filePath
|
|
5130
|
+
} = await invoke$d('Open.showSaveDialog', dialogTitle, [], platform);
|
|
5131
|
+
if (canceled) {
|
|
5132
|
+
return '';
|
|
5133
|
+
}
|
|
5134
|
+
return filePath;
|
|
5135
|
+
};
|
|
5136
|
+
|
|
5137
|
+
const saveUntitledFile = async (uri, content, platform) => {
|
|
5138
|
+
const filePath = await showFilePicker(platform);
|
|
5139
|
+
if (!filePath) {
|
|
5140
|
+
return;
|
|
5141
|
+
}
|
|
5142
|
+
await invoke$b('FileSystem.writeFile', filePath, content);
|
|
5143
|
+
await handleWorkspaceRefresh();
|
|
5144
|
+
await invoke$b('Main.handleUriChange', uri, filePath);
|
|
5145
|
+
return filePath;
|
|
5146
|
+
};
|
|
5147
|
+
|
|
5148
|
+
const isPermissionDeniedError = error => {
|
|
5149
|
+
const errorCode = 'code' in error ? error.code : undefined;
|
|
5150
|
+
return errorCode === 'EACCES' || error.message.includes('EACCES:');
|
|
5151
|
+
};
|
|
5152
|
+
const showSaveErrorDialog = async error => {
|
|
5153
|
+
if (isPermissionDeniedError(error)) {
|
|
5154
|
+
await invoke$b('ElectronDialog.showMessageBox', {
|
|
5155
|
+
buttons: ['OK'],
|
|
5156
|
+
defaultId: 0,
|
|
5157
|
+
message: "You don't have permission to save changes to this file.",
|
|
5158
|
+
title: 'Unable to Save File',
|
|
5159
|
+
type: 'error'
|
|
5160
|
+
});
|
|
5161
|
+
return;
|
|
5162
|
+
}
|
|
5163
|
+
await invoke$b('ElectronDialog.showMessageBox', {
|
|
5164
|
+
buttons: ['OK'],
|
|
5165
|
+
defaultId: 0,
|
|
5166
|
+
detail: error.message,
|
|
5167
|
+
message: 'Saving the file failed.',
|
|
5168
|
+
title: 'Failed to Save File',
|
|
5169
|
+
type: 'error'
|
|
5170
|
+
});
|
|
5171
|
+
};
|
|
5172
|
+
|
|
5173
|
+
const save = async editor => {
|
|
5174
|
+
try {
|
|
5175
|
+
const {
|
|
5176
|
+
platform,
|
|
5177
|
+
uri
|
|
5178
|
+
} = editor;
|
|
5179
|
+
const newEditor = await getNewEditor$1(editor);
|
|
5180
|
+
const content = getText$1(newEditor);
|
|
5181
|
+
if (isUntitledFile(uri)) {
|
|
5182
|
+
const pickedFilePath = await saveUntitledFile(uri, content, platform);
|
|
5183
|
+
if (pickedFilePath) {
|
|
5184
|
+
if (editor.modified) {
|
|
5185
|
+
await notifyTabModifiedStatusChange(uri, false);
|
|
5186
|
+
}
|
|
5187
|
+
return {
|
|
5188
|
+
...newEditor,
|
|
5189
|
+
modified: false,
|
|
5190
|
+
uri: pickedFilePath
|
|
5191
|
+
};
|
|
5192
|
+
}
|
|
5193
|
+
return newEditor;
|
|
5194
|
+
}
|
|
5195
|
+
await saveNormalFile(uri, content);
|
|
5196
|
+
if (editor.modified) {
|
|
5197
|
+
await notifyTabModifiedStatusChange(uri, false);
|
|
5198
|
+
}
|
|
5199
|
+
return {
|
|
5200
|
+
...newEditor,
|
|
5201
|
+
modified: false
|
|
5202
|
+
};
|
|
5203
|
+
} catch (error) {
|
|
5204
|
+
// @ts-ignore
|
|
5205
|
+
const betterError = new VError(error, `Failed to save file "${editor.uri}"`);
|
|
5206
|
+
await handleError$1(betterError);
|
|
5207
|
+
if (editor.platform === Electron) {
|
|
5208
|
+
try {
|
|
5209
|
+
await showSaveErrorDialog(betterError);
|
|
5210
|
+
} catch (dialogError) {
|
|
5211
|
+
await handleError$1(dialogError);
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5214
|
+
return editor;
|
|
5215
|
+
}
|
|
5216
|
+
};
|
|
5217
|
+
|
|
5218
|
+
const handleBlur$1 = async editor => {
|
|
5219
|
+
if (!editor.focused) {
|
|
5220
|
+
return editor;
|
|
5221
|
+
}
|
|
5222
|
+
const newEditor = {
|
|
5223
|
+
...editor,
|
|
5224
|
+
focused: false
|
|
5225
|
+
};
|
|
5226
|
+
if (!editor.modified) {
|
|
5227
|
+
return newEditor;
|
|
5228
|
+
}
|
|
5229
|
+
const autoSave = await get$2('files.autoSave');
|
|
5230
|
+
if (autoSave === 'off') {
|
|
5231
|
+
return newEditor;
|
|
5232
|
+
}
|
|
5233
|
+
return save(newEditor);
|
|
5234
|
+
};
|
|
5235
|
+
|
|
5236
|
+
const replaceRange = (editor, ranges, replacement, origin) => {
|
|
5237
|
+
const changes = [];
|
|
5238
|
+
const rangesLength = ranges.length;
|
|
5239
|
+
for (let i = 0; i < rangesLength; i += 4) {
|
|
5240
|
+
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn] = getSelectionPairs(ranges, i);
|
|
5241
|
+
const start = {
|
|
5242
|
+
columnIndex: selectionStartColumn,
|
|
5243
|
+
rowIndex: selectionStartRow
|
|
5244
|
+
};
|
|
5245
|
+
const end = {
|
|
5246
|
+
columnIndex: selectionEndColumn,
|
|
5247
|
+
rowIndex: selectionEndRow
|
|
5248
|
+
};
|
|
5249
|
+
const selection = {
|
|
5250
|
+
end,
|
|
5251
|
+
start
|
|
5252
|
+
};
|
|
5253
|
+
changes.push({
|
|
5254
|
+
deleted: getSelectionText(editor, selection),
|
|
5255
|
+
end: end,
|
|
5256
|
+
inserted: replacement,
|
|
5257
|
+
origin,
|
|
5258
|
+
start: start
|
|
5259
|
+
});
|
|
5260
|
+
}
|
|
5261
|
+
return changes;
|
|
5262
|
+
};
|
|
5263
|
+
|
|
5264
|
+
const editorReplaceSelections = (editor, replacement, origin) => {
|
|
5265
|
+
const {
|
|
5266
|
+
selections
|
|
5267
|
+
} = editor;
|
|
5268
|
+
return replaceRange(editor, selections, replacement, origin);
|
|
5269
|
+
};
|
|
5270
|
+
|
|
5271
|
+
// @ts-ignore
|
|
5272
|
+
const getErrorMessage$4 = String;
|
|
5273
|
+
|
|
5274
|
+
// @ts-ignore
|
|
5275
|
+
const getMatchingClosingBrace$1 = brace => {
|
|
5276
|
+
switch (brace) {
|
|
5277
|
+
case '(':
|
|
5278
|
+
return ')';
|
|
5279
|
+
case '[':
|
|
5280
|
+
return ']';
|
|
5281
|
+
case '{':
|
|
5282
|
+
return '}';
|
|
5283
|
+
default:
|
|
5284
|
+
return '???';
|
|
5285
|
+
}
|
|
5286
|
+
};
|
|
5287
|
+
const braceCompletion = async (editor, text) => {
|
|
5288
|
+
try {
|
|
5289
|
+
const offset = getCursorOffset(editor);
|
|
5290
|
+
// @ts-ignore
|
|
5291
|
+
const result = await invoke$b('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
5292
|
+
if (result) {
|
|
5293
|
+
const closingBrace = getMatchingClosingBrace$1(text);
|
|
5294
|
+
const insertText = text + closingBrace;
|
|
5295
|
+
const changes = editorReplaceSelections(editor, [insertText], EditorType);
|
|
5296
|
+
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
5297
|
+
}
|
|
5298
|
+
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
5299
|
+
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
5300
|
+
} catch (error) {
|
|
5301
|
+
console.error(error);
|
|
5302
|
+
// TODO cursor should always be of type object
|
|
5303
|
+
const position = Array.isArray(editor.cursor) ? editor.cursor[0] : editor.cursor;
|
|
5304
|
+
// @ts-ignore
|
|
5305
|
+
return showErrorMessage(editor, position, getErrorMessage$4(error));
|
|
5306
|
+
}
|
|
5307
|
+
};
|
|
5308
|
+
const getCursorOffset = editor => {
|
|
5309
|
+
return offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
5310
|
+
};
|
|
5311
|
+
|
|
5312
|
+
const cancelSelection = editor => {
|
|
5313
|
+
const {
|
|
5314
|
+
selections
|
|
5315
|
+
} = editor;
|
|
5316
|
+
if (selections.length === 4 && selections[0] === selections[2] && selections[1] === selections[3]) {
|
|
5317
|
+
return editor;
|
|
5318
|
+
}
|
|
5319
|
+
const newSelections = alloc(4);
|
|
5320
|
+
moveRangeToPosition$1(newSelections, 0, selections[0], selections[1]);
|
|
5321
|
+
return scheduleSelections(editor, newSelections);
|
|
5322
|
+
};
|
|
5323
|
+
|
|
5324
|
+
const getIndex = (widgets, id) => {
|
|
5325
|
+
for (const [i, widget] of widgets.entries()) {
|
|
5326
|
+
if (widget.id === id) {
|
|
5327
|
+
return i;
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5330
|
+
return -1;
|
|
5331
|
+
};
|
|
5332
|
+
const removeEditorWidget = (widgets, id) => {
|
|
5333
|
+
const index = getIndex(widgets, id);
|
|
5334
|
+
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
5335
|
+
return newWidgets;
|
|
5336
|
+
};
|
|
5337
|
+
|
|
5338
|
+
const isMatchingWidget$2 = widget => {
|
|
5339
|
+
return widget.id === CodeGenerator;
|
|
5340
|
+
};
|
|
5341
|
+
const closeCodeGenerator = editor => {
|
|
4811
5342
|
const {
|
|
4812
5343
|
widgets
|
|
4813
5344
|
} = editor;
|
|
@@ -4968,7 +5499,23 @@ const newStateGenerator$6 = (state, parentUid) => {
|
|
|
4968
5499
|
return loadContent$3(state, parentUid);
|
|
4969
5500
|
};
|
|
4970
5501
|
const openColorPicker = async editor => {
|
|
4971
|
-
|
|
5502
|
+
const fullFocus = true;
|
|
5503
|
+
return addWidgetToEditor(ColorPicker$1, ColorPicker, editor, create$6, newStateGenerator$6, fullFocus);
|
|
5504
|
+
};
|
|
5505
|
+
const closeColorPicker = editor => {
|
|
5506
|
+
const {
|
|
5507
|
+
widgets
|
|
5508
|
+
} = editor;
|
|
5509
|
+
if (widgets.every(widget => widget.id !== ColorPicker$1)) {
|
|
5510
|
+
return editor;
|
|
5511
|
+
}
|
|
5512
|
+
return {
|
|
5513
|
+
...editor,
|
|
5514
|
+
additionalFocus: 0,
|
|
5515
|
+
focus: FocusEditorText$1,
|
|
5516
|
+
focused: true,
|
|
5517
|
+
widgets: removeEditorWidget(widgets, ColorPicker$1)
|
|
5518
|
+
};
|
|
4972
5519
|
};
|
|
4973
5520
|
|
|
4974
5521
|
const state$5 = {
|
|
@@ -5729,45 +6276,6 @@ const findAllReferences$1 = async editor => {
|
|
|
5729
6276
|
return editor;
|
|
5730
6277
|
};
|
|
5731
6278
|
|
|
5732
|
-
const getFormattingEdits = async editor => {
|
|
5733
|
-
const textDocument = {
|
|
5734
|
-
documentId: editor.id || editor.uid,
|
|
5735
|
-
languageId: editor.languageId,
|
|
5736
|
-
text: getText$1(editor),
|
|
5737
|
-
uri: editor.uri
|
|
5738
|
-
};
|
|
5739
|
-
return invoke$e('Extensions.executeFormattingProvider', textDocument);
|
|
5740
|
-
};
|
|
5741
|
-
|
|
5742
|
-
const expectedErrorMessage$1 = 'Failed to execute formatting provider: FormattingError:';
|
|
5743
|
-
const isFormattingError = error => {
|
|
5744
|
-
// @ts-ignore
|
|
5745
|
-
return error && error instanceof Error && error.message.startsWith(expectedErrorMessage$1);
|
|
5746
|
-
};
|
|
5747
|
-
|
|
5748
|
-
const expectedErrorMessage = 'Failed to execute formatting provider: FormattingError:';
|
|
5749
|
-
|
|
5750
|
-
// TODO also format with cursor
|
|
5751
|
-
const format = async editor => {
|
|
5752
|
-
try {
|
|
5753
|
-
const edits = await getFormattingEdits(editor);
|
|
5754
|
-
return applyDocumentEdits(editor, edits);
|
|
5755
|
-
} catch (error) {
|
|
5756
|
-
if (isFormattingError(error)) {
|
|
5757
|
-
console.error('Formatting Error:',
|
|
5758
|
-
// @ts-ignore
|
|
5759
|
-
error.message.slice(expectedErrorMessage.length));
|
|
5760
|
-
return editor;
|
|
5761
|
-
}
|
|
5762
|
-
console.error(error);
|
|
5763
|
-
|
|
5764
|
-
// TODO configure editor message as widget
|
|
5765
|
-
const displayErrorMessage = String(error);
|
|
5766
|
-
await editorShowMessage(editor, 0, 0, displayErrorMessage);
|
|
5767
|
-
return editor;
|
|
5768
|
-
}
|
|
5769
|
-
};
|
|
5770
|
-
|
|
5771
6279
|
/* eslint-disable sonarjs/super-linear-regex */
|
|
5772
6280
|
|
|
5773
6281
|
const RE_WORD_START$1 = /^[\w\-]+/;
|
|
@@ -5820,15 +6328,15 @@ const getDefinition = async (editor, offset) => {
|
|
|
5820
6328
|
};
|
|
5821
6329
|
|
|
5822
6330
|
const emptyObject = {};
|
|
5823
|
-
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
5824
6331
|
const i18nString = (key, placeholders = emptyObject) => {
|
|
5825
6332
|
if (placeholders === emptyObject) {
|
|
5826
6333
|
return key;
|
|
5827
6334
|
}
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
6335
|
+
let result = key;
|
|
6336
|
+
for (const [placeholder, replacement] of Object.entries(placeholders)) {
|
|
6337
|
+
result = result.split(`{${placeholder}}`).join(String(replacement));
|
|
6338
|
+
}
|
|
6339
|
+
return result;
|
|
5832
6340
|
};
|
|
5833
6341
|
|
|
5834
6342
|
const Copy = 'Copy';
|
|
@@ -6064,7 +6572,7 @@ const getNoLocationFoundMessage$1 = info => {
|
|
|
6064
6572
|
}
|
|
6065
6573
|
return noDefinitionFound();
|
|
6066
6574
|
};
|
|
6067
|
-
const getErrorMessage$
|
|
6575
|
+
const getErrorMessage$3 = String;
|
|
6068
6576
|
|
|
6069
6577
|
// @ts-ignore
|
|
6070
6578
|
const isNoProviderFoundError$1 = error => {
|
|
@@ -6073,7 +6581,7 @@ const isNoProviderFoundError$1 = error => {
|
|
|
6073
6581
|
const goToDefinition = async editor => {
|
|
6074
6582
|
return goTo({
|
|
6075
6583
|
editor,
|
|
6076
|
-
getErrorMessage: getErrorMessage$
|
|
6584
|
+
getErrorMessage: getErrorMessage$3,
|
|
6077
6585
|
getLocation: getLocation$1,
|
|
6078
6586
|
getNoLocationFoundMessage: getNoLocationFoundMessage$1,
|
|
6079
6587
|
isNoProviderFoundError: isNoProviderFoundError$1
|
|
@@ -6098,14 +6606,14 @@ const getLocation = async (editor, rowIndex, columnIndex) => {
|
|
|
6098
6606
|
const definition = await getTypeDefinition(editor, offset);
|
|
6099
6607
|
return definition;
|
|
6100
6608
|
};
|
|
6101
|
-
const getErrorMessage$
|
|
6609
|
+
const getErrorMessage$2 = String;
|
|
6102
6610
|
const isNoProviderFoundError = error => {
|
|
6103
6611
|
return error?.message?.startsWith('Failed to execute type definition provider: No type definition provider found');
|
|
6104
6612
|
};
|
|
6105
6613
|
const goToTypeDefinition = async (editor, explicit = true) => {
|
|
6106
6614
|
return goTo({
|
|
6107
6615
|
editor,
|
|
6108
|
-
getErrorMessage: getErrorMessage$
|
|
6616
|
+
getErrorMessage: getErrorMessage$2,
|
|
6109
6617
|
getLocation,
|
|
6110
6618
|
getNoLocationFoundMessage: getNoLocationFoundMessage,
|
|
6111
6619
|
isNoProviderFoundError
|
|
@@ -6283,6 +6791,58 @@ const handleFocus$1 = editor => {
|
|
|
6283
6791
|
};
|
|
6284
6792
|
};
|
|
6285
6793
|
|
|
6794
|
+
const stride = 4;
|
|
6795
|
+
const isDefinitionLink = (decorations, index) => {
|
|
6796
|
+
return decorations[index + 2] === DefinitionLink;
|
|
6797
|
+
};
|
|
6798
|
+
const matches = (editor, offset, length) => {
|
|
6799
|
+
const {
|
|
6800
|
+
decorations
|
|
6801
|
+
} = editor;
|
|
6802
|
+
for (let i = 0; i < decorations.length; i += stride) {
|
|
6803
|
+
if (isDefinitionLink(decorations, i)) {
|
|
6804
|
+
return decorations[i] === offset && decorations[i + 1] === length;
|
|
6805
|
+
}
|
|
6806
|
+
}
|
|
6807
|
+
return false;
|
|
6808
|
+
};
|
|
6809
|
+
const clear = editor => {
|
|
6810
|
+
const {
|
|
6811
|
+
decorations
|
|
6812
|
+
} = editor;
|
|
6813
|
+
const filtered = [];
|
|
6814
|
+
for (let i = 0; i < decorations.length; i += stride) {
|
|
6815
|
+
if (!isDefinitionLink(decorations, i)) {
|
|
6816
|
+
filtered.push(decorations[i], decorations[i + 1], decorations[i + 2], decorations[i + 3]);
|
|
6817
|
+
}
|
|
6818
|
+
}
|
|
6819
|
+
if (filtered.length === decorations.length) {
|
|
6820
|
+
return editor;
|
|
6821
|
+
}
|
|
6822
|
+
return {
|
|
6823
|
+
...editor,
|
|
6824
|
+
decorations: filtered
|
|
6825
|
+
};
|
|
6826
|
+
};
|
|
6827
|
+
const set$2 = (editor, offset, length) => {
|
|
6828
|
+
if (matches(editor, offset, length)) {
|
|
6829
|
+
return editor;
|
|
6830
|
+
}
|
|
6831
|
+
const editorWithoutDefinitionLink = clear(editor);
|
|
6832
|
+
return {
|
|
6833
|
+
...editorWithoutDefinitionLink,
|
|
6834
|
+
decorations: [...editorWithoutDefinitionLink.decorations, offset, length, DefinitionLink, 0]
|
|
6835
|
+
};
|
|
6836
|
+
};
|
|
6837
|
+
|
|
6838
|
+
const altKey = 'Alt';
|
|
6839
|
+
const handleKeyUp = (editor, key) => {
|
|
6840
|
+
if (key !== altKey) {
|
|
6841
|
+
return editor;
|
|
6842
|
+
}
|
|
6843
|
+
return clear(editor);
|
|
6844
|
+
};
|
|
6845
|
+
|
|
6286
6846
|
const Single = 1;
|
|
6287
6847
|
const Double = 2;
|
|
6288
6848
|
const Triple = 3;
|
|
@@ -6376,56 +6936,44 @@ const set$1 = (editor, timeout, x, y) => {
|
|
|
6376
6936
|
state$4.y = y;
|
|
6377
6937
|
};
|
|
6378
6938
|
|
|
6379
|
-
const
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
// await Viewlet.openWidget(ViewletModuleId.EditorHover, position)
|
|
6939
|
+
const RE_ALPHA_NUMERIC = /[a-zA-Z\d]/;
|
|
6940
|
+
const isAlphaNumeric = char => {
|
|
6941
|
+
return RE_ALPHA_NUMERIC.test(char);
|
|
6383
6942
|
};
|
|
6384
6943
|
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
// 2. show hover info
|
|
6388
|
-
// 3. selection moves
|
|
6389
|
-
// 4. highlight go to definition
|
|
6390
|
-
// 5. show color picker
|
|
6391
|
-
// 6. show error info
|
|
6392
|
-
|
|
6393
|
-
const onHoverIdle = async () => {
|
|
6394
|
-
const {
|
|
6395
|
-
editor,
|
|
6396
|
-
x,
|
|
6397
|
-
y
|
|
6398
|
-
} = get$1();
|
|
6399
|
-
await at(editor, x, y);
|
|
6400
|
-
await showHover$1();
|
|
6944
|
+
const isWordChar = char => {
|
|
6945
|
+
return isAlphaNumeric(char) || char === '_';
|
|
6401
6946
|
};
|
|
6402
|
-
const
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
return editor;
|
|
6408
|
-
}
|
|
6409
|
-
const oldState = get$1();
|
|
6410
|
-
if (oldState.timeout !== -1) {
|
|
6411
|
-
clearTimeout(oldState.timeout);
|
|
6947
|
+
const getWordStartIndex = (line, index) => {
|
|
6948
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
6949
|
+
if (!isWordChar(line[i])) {
|
|
6950
|
+
return i + 1;
|
|
6951
|
+
}
|
|
6412
6952
|
}
|
|
6413
|
-
|
|
6414
|
-
set$1(editor, timeout, x, y);
|
|
6415
|
-
return editor;
|
|
6953
|
+
return 0;
|
|
6416
6954
|
};
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
let currentOffset = 0;
|
|
6421
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
6422
|
-
const token = tokens[i];
|
|
6423
|
-
currentOffset += token.length;
|
|
6424
|
-
if (currentOffset >= offset) {
|
|
6955
|
+
const getWordEndIndex = (line, index) => {
|
|
6956
|
+
for (let i = index; i < line.length; i++) {
|
|
6957
|
+
if (!isWordChar(line[i])) {
|
|
6425
6958
|
return i;
|
|
6426
6959
|
}
|
|
6427
6960
|
}
|
|
6428
|
-
return
|
|
6961
|
+
return line.length;
|
|
6962
|
+
};
|
|
6963
|
+
const getWordMatchAtPosition = (lines, rowIndex, columnIndex) => {
|
|
6964
|
+
const line = lines[rowIndex];
|
|
6965
|
+
const start = getWordStartIndex(line, columnIndex);
|
|
6966
|
+
const end = getWordEndIndex(line, columnIndex);
|
|
6967
|
+
const word = line.slice(start, end);
|
|
6968
|
+
return {
|
|
6969
|
+
end,
|
|
6970
|
+
start,
|
|
6971
|
+
word
|
|
6972
|
+
};
|
|
6973
|
+
};
|
|
6974
|
+
|
|
6975
|
+
const isNoDefinitionProviderFoundError = error => {
|
|
6976
|
+
return error instanceof Error && error.message.startsWith('Failed to execute definition provider: No definition provider found');
|
|
6429
6977
|
};
|
|
6430
6978
|
|
|
6431
6979
|
// @ts-ignore
|
|
@@ -6434,45 +6982,71 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
|
6434
6982
|
number(x);
|
|
6435
6983
|
number(y);
|
|
6436
6984
|
const position = await at(editor, x, y);
|
|
6985
|
+
const wordMatch = getWordMatchAtPosition(editor.lines, position.rowIndex, position.columnIndex);
|
|
6986
|
+
if (!wordMatch.word) {
|
|
6987
|
+
return clear(editor);
|
|
6988
|
+
}
|
|
6989
|
+
const wordOffset = offsetAt(editor, position.rowIndex, wordMatch.start);
|
|
6990
|
+
const wordLength = wordMatch.end - wordMatch.start;
|
|
6991
|
+
if (matches(editor, wordOffset, wordLength)) {
|
|
6992
|
+
return editor;
|
|
6993
|
+
}
|
|
6437
6994
|
const documentOffset = offsetAt(editor, position.rowIndex, position.columnIndex);
|
|
6438
6995
|
try {
|
|
6439
6996
|
const definition = await getDefinition(editor, documentOffset);
|
|
6440
6997
|
if (!definition) {
|
|
6441
|
-
return editor;
|
|
6442
|
-
}
|
|
6443
|
-
|
|
6444
|
-
// TODO make sure that editor is not disposed
|
|
6445
|
-
|
|
6446
|
-
const definitionStartPosition = positionAt(editor, definition.startOffset);
|
|
6447
|
-
positionAt(editor, definition.endOffset);
|
|
6448
|
-
// const definitionRelativeY = definitionStartPosition.rowIndex - editor.minLineY
|
|
6449
|
-
|
|
6450
|
-
const lineTokenMap = editor.lineCache[definitionStartPosition.rowIndex + 1];
|
|
6451
|
-
if (!lineTokenMap) {
|
|
6452
|
-
return editor;
|
|
6998
|
+
return clear(editor);
|
|
6453
6999
|
}
|
|
6454
|
-
|
|
6455
|
-
if (tokenIndex === -1) {
|
|
6456
|
-
return editor;
|
|
6457
|
-
}
|
|
6458
|
-
// .tokens
|
|
6459
|
-
// await RendererProcess.invoke(
|
|
6460
|
-
// /* Viewlet.invoke */ 'Viewlet.send',
|
|
6461
|
-
// /* id */ ViewletModuleId.EditorText,
|
|
6462
|
-
// /* method */ 'highlightAsLink',
|
|
6463
|
-
// /* relativeY */ definitionRelativeY,
|
|
6464
|
-
// /* tokenIndex */ tokenIndex,
|
|
6465
|
-
// )
|
|
6466
|
-
return editor;
|
|
7000
|
+
return set$2(editor, wordOffset, wordLength);
|
|
6467
7001
|
} catch (error) {
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
return editor;
|
|
7002
|
+
if (isNoDefinitionProviderFoundError(error)) {
|
|
7003
|
+
return clear(editor);
|
|
6471
7004
|
}
|
|
6472
7005
|
throw error;
|
|
6473
7006
|
}
|
|
6474
7007
|
};
|
|
6475
7008
|
|
|
7009
|
+
const showHover$1 = async (editor, position) => {
|
|
7010
|
+
// TODO race condition
|
|
7011
|
+
// await Viewlet.closeWidget(ViewletModuleId.EditorHover)
|
|
7012
|
+
// await Viewlet.openWidget(ViewletModuleId.EditorHover, position)
|
|
7013
|
+
};
|
|
7014
|
+
|
|
7015
|
+
// TODO several things can happen:
|
|
7016
|
+
// 1. highlight link when alt key is pressed
|
|
7017
|
+
// 2. show hover info
|
|
7018
|
+
// 3. selection moves
|
|
7019
|
+
// 4. highlight go to definition
|
|
7020
|
+
// 5. show color picker
|
|
7021
|
+
// 6. show error info
|
|
7022
|
+
|
|
7023
|
+
const onHoverIdle = async () => {
|
|
7024
|
+
const {
|
|
7025
|
+
editor,
|
|
7026
|
+
x,
|
|
7027
|
+
y
|
|
7028
|
+
} = get$1();
|
|
7029
|
+
await at(editor, x, y);
|
|
7030
|
+
await showHover$1();
|
|
7031
|
+
};
|
|
7032
|
+
const hoverDelay = 300;
|
|
7033
|
+
const handleMouseMove = async (editor, x, y, altKey) => {
|
|
7034
|
+
if (altKey) {
|
|
7035
|
+
return handleMouseMoveWithAltKey(editor, x, y);
|
|
7036
|
+
}
|
|
7037
|
+
const editorWithoutDefinitionLink = clear(editor);
|
|
7038
|
+
if (!editorWithoutDefinitionLink.hoverEnabled) {
|
|
7039
|
+
return editorWithoutDefinitionLink;
|
|
7040
|
+
}
|
|
7041
|
+
const oldState = get$1();
|
|
7042
|
+
if (oldState.timeout !== -1) {
|
|
7043
|
+
clearTimeout(oldState.timeout);
|
|
7044
|
+
}
|
|
7045
|
+
const timeout = setTimeout(onHoverIdle, hoverDelay);
|
|
7046
|
+
set$1(editorWithoutDefinitionLink, timeout, x, y);
|
|
7047
|
+
return editorWithoutDefinitionLink;
|
|
7048
|
+
};
|
|
7049
|
+
|
|
6476
7050
|
// TODO adjust relative position
|
|
6477
7051
|
// @ts-ignore
|
|
6478
7052
|
const getSelectionFromNativeRange = (editor, range) => {
|
|
@@ -6665,7 +7239,7 @@ const editorMoveSelection = (editor, position) => {
|
|
|
6665
7239
|
};
|
|
6666
7240
|
|
|
6667
7241
|
// @ts-ignore
|
|
6668
|
-
const getNewEditor
|
|
7242
|
+
const getNewEditor = (editor, position) => {
|
|
6669
7243
|
const {
|
|
6670
7244
|
maxLineY,
|
|
6671
7245
|
minLineY,
|
|
@@ -6713,7 +7287,7 @@ const continueScrollingAndMovingSelection = async editorUid => {
|
|
|
6713
7287
|
if (position.rowIndex === 0) {
|
|
6714
7288
|
return;
|
|
6715
7289
|
}
|
|
6716
|
-
const newEditor = getNewEditor
|
|
7290
|
+
const newEditor = getNewEditor(editor, position);
|
|
6717
7291
|
if (editor === newEditor) {
|
|
6718
7292
|
return;
|
|
6719
7293
|
}
|
|
@@ -6727,7 +7301,7 @@ const continueScrollingAndMovingSelection = async editorUid => {
|
|
|
6727
7301
|
}
|
|
6728
7302
|
};
|
|
6729
7303
|
const newEditorWithDerivedState = await updateDerivedState(editor, nextEditor);
|
|
6730
|
-
set$
|
|
7304
|
+
set$9(editor.uid, editor, newEditorWithDerivedState);
|
|
6731
7305
|
requestAnimationFrame(() => continueScrollingAndMovingSelection(editorUid));
|
|
6732
7306
|
};
|
|
6733
7307
|
|
|
@@ -7315,7 +7889,7 @@ const launch = async () => {
|
|
|
7315
7889
|
return;
|
|
7316
7890
|
}
|
|
7317
7891
|
const rpc = await launchFindWidgetWorker();
|
|
7318
|
-
set$
|
|
7892
|
+
set$h(rpcId, rpc);
|
|
7319
7893
|
};
|
|
7320
7894
|
const invoke$3 = async (method, ...params) => {
|
|
7321
7895
|
const rpc = get$8(rpcId);
|
|
@@ -7378,6 +7952,16 @@ const openFind = async state => {
|
|
|
7378
7952
|
return openFind2(state);
|
|
7379
7953
|
};
|
|
7380
7954
|
|
|
7955
|
+
const getOffsetAtCursor$1 = editor => {
|
|
7956
|
+
const {
|
|
7957
|
+
selections
|
|
7958
|
+
} = editor;
|
|
7959
|
+
const rowIndex = selections[0];
|
|
7960
|
+
const columnIndex = selections[1];
|
|
7961
|
+
const offset = offsetAt(editor, rowIndex, columnIndex);
|
|
7962
|
+
return offset;
|
|
7963
|
+
};
|
|
7964
|
+
|
|
7381
7965
|
const getPositionAtCursor$1 = editor => {
|
|
7382
7966
|
const {
|
|
7383
7967
|
selections
|
|
@@ -7453,7 +8037,16 @@ const openRename = async editor => {
|
|
|
7453
8037
|
return editor;
|
|
7454
8038
|
}
|
|
7455
8039
|
const fullFocus = true;
|
|
7456
|
-
|
|
8040
|
+
const editorWithRenameWidget = await addWidgetToEditor(Rename$1, FocusEditorRename$1, editor, create$2, newStateGenerator$2, fullFocus);
|
|
8041
|
+
if (editorWithRenameWidget === editor) {
|
|
8042
|
+
return editor;
|
|
8043
|
+
}
|
|
8044
|
+
const wordBefore = getWordBefore(editor, rowIndex, columnIndex);
|
|
8045
|
+
const offset = getOffsetAtCursor$1(editor) - wordBefore.length;
|
|
8046
|
+
return {
|
|
8047
|
+
...editorWithRenameWidget,
|
|
8048
|
+
decorations: [...editorWithRenameWidget.decorations, offset, word.length, 3, 0]
|
|
8049
|
+
};
|
|
7457
8050
|
};
|
|
7458
8051
|
|
|
7459
8052
|
const getOrganizeImportEdits = async editor => {
|
|
@@ -7502,233 +8095,6 @@ const redo = state => {
|
|
|
7502
8095
|
return scheduleDocumentAndCursorsSelectionIsUndo(newState, last);
|
|
7503
8096
|
};
|
|
7504
8097
|
|
|
7505
|
-
const getErrorMessage$2 = error => {
|
|
7506
|
-
if (!error) {
|
|
7507
|
-
return `Error: ${error}`;
|
|
7508
|
-
}
|
|
7509
|
-
let {
|
|
7510
|
-
message
|
|
7511
|
-
} = error;
|
|
7512
|
-
while (error.cause) {
|
|
7513
|
-
error = error.cause;
|
|
7514
|
-
message += `: ${error}`;
|
|
7515
|
-
}
|
|
7516
|
-
return message;
|
|
7517
|
-
};
|
|
7518
|
-
const prepareErrorMessageWithCodeFrame = error => {
|
|
7519
|
-
if (!error) {
|
|
7520
|
-
return {
|
|
7521
|
-
codeFrame: undefined,
|
|
7522
|
-
message: error,
|
|
7523
|
-
stack: undefined,
|
|
7524
|
-
type: 'Error'
|
|
7525
|
-
};
|
|
7526
|
-
}
|
|
7527
|
-
const message = getErrorMessage$2(error);
|
|
7528
|
-
if (error.codeFrame) {
|
|
7529
|
-
return {
|
|
7530
|
-
codeFrame: error.codeFrame,
|
|
7531
|
-
message,
|
|
7532
|
-
stack: error.stack,
|
|
7533
|
-
type: error.constructor.name
|
|
7534
|
-
};
|
|
7535
|
-
}
|
|
7536
|
-
return {
|
|
7537
|
-
category: error.category,
|
|
7538
|
-
codeFrame: error.originalCodeFrame,
|
|
7539
|
-
message,
|
|
7540
|
-
stack: error.originalStack,
|
|
7541
|
-
stderr: error.stderr
|
|
7542
|
-
};
|
|
7543
|
-
};
|
|
7544
|
-
|
|
7545
|
-
/* eslint-disable sonarjs/super-linear-regex */
|
|
7546
|
-
|
|
7547
|
-
const RE_PATH_1 = /\((.*):(\d+):(\d+)\)$/;
|
|
7548
|
-
const RE_PATH_2 = /at (.*):(\d+):(\d+)$/;
|
|
7549
|
-
|
|
7550
|
-
/**
|
|
7551
|
-
*
|
|
7552
|
-
* @param {readonly string[]} lines
|
|
7553
|
-
* @returns
|
|
7554
|
-
*/
|
|
7555
|
-
const getFile = lines => {
|
|
7556
|
-
for (const line of lines) {
|
|
7557
|
-
if (RE_PATH_1.test(line) || RE_PATH_2.test(line)) {
|
|
7558
|
-
return line;
|
|
7559
|
-
}
|
|
7560
|
-
}
|
|
7561
|
-
return '';
|
|
7562
|
-
};
|
|
7563
|
-
const prepareErrorMessageWithoutCodeFrame = async error => {
|
|
7564
|
-
try {
|
|
7565
|
-
const lines = splitLines(error.stack);
|
|
7566
|
-
const file = getFile(lines);
|
|
7567
|
-
let match = file.match(RE_PATH_1);
|
|
7568
|
-
if (!match) {
|
|
7569
|
-
match = file.match(RE_PATH_2);
|
|
7570
|
-
}
|
|
7571
|
-
if (!match) {
|
|
7572
|
-
return error;
|
|
7573
|
-
}
|
|
7574
|
-
const relevantStack = joinLines(lines.slice(1));
|
|
7575
|
-
const message = getErrorMessage$2(error);
|
|
7576
|
-
return {
|
|
7577
|
-
message,
|
|
7578
|
-
stack: relevantStack,
|
|
7579
|
-
type: error.constructor.name
|
|
7580
|
-
};
|
|
7581
|
-
} catch (otherError) {
|
|
7582
|
-
console.warn('ErrorHandling Error');
|
|
7583
|
-
console.warn(otherError);
|
|
7584
|
-
return error;
|
|
7585
|
-
}
|
|
7586
|
-
};
|
|
7587
|
-
const prepare = async error => {
|
|
7588
|
-
if (error && error.message && error.codeFrame) {
|
|
7589
|
-
return prepareErrorMessageWithCodeFrame(error);
|
|
7590
|
-
}
|
|
7591
|
-
if (error && error.stack) {
|
|
7592
|
-
return prepareErrorMessageWithoutCodeFrame(error);
|
|
7593
|
-
}
|
|
7594
|
-
return error;
|
|
7595
|
-
};
|
|
7596
|
-
const print = error => {
|
|
7597
|
-
if (error && error.type && error.message && error.codeFrame) {
|
|
7598
|
-
return `${error.type}: ${error.message}\n\n${error.codeFrame}\n\n${error.stack}`;
|
|
7599
|
-
}
|
|
7600
|
-
if (error && error.message && error.codeFrame) {
|
|
7601
|
-
return `${error.message}\n\n${error.codeFrame}\n\n${error.stack}`;
|
|
7602
|
-
}
|
|
7603
|
-
if (error && error.type && error.message) {
|
|
7604
|
-
return `${error.type}: ${error.message}\n${error.stack}`;
|
|
7605
|
-
}
|
|
7606
|
-
if (error && error.stack) {
|
|
7607
|
-
return error.stack;
|
|
7608
|
-
}
|
|
7609
|
-
if (error === null) {
|
|
7610
|
-
return null;
|
|
7611
|
-
}
|
|
7612
|
-
return String(error);
|
|
7613
|
-
};
|
|
7614
|
-
|
|
7615
|
-
// @ts-nocheck
|
|
7616
|
-
const logError = async error => {
|
|
7617
|
-
const prettyError = await prepare(error);
|
|
7618
|
-
const prettyErrorString = print(prettyError);
|
|
7619
|
-
console.error(prettyErrorString);
|
|
7620
|
-
return prettyError;
|
|
7621
|
-
};
|
|
7622
|
-
const handleError = async error => {
|
|
7623
|
-
try {
|
|
7624
|
-
await logError(error);
|
|
7625
|
-
} catch (otherError) {
|
|
7626
|
-
console.warn('ErrorHandling error');
|
|
7627
|
-
console.warn(otherError);
|
|
7628
|
-
console.error(error);
|
|
7629
|
-
}
|
|
7630
|
-
};
|
|
7631
|
-
|
|
7632
|
-
// @ts-ignore
|
|
7633
|
-
const getNewEditor = async editor => {
|
|
7634
|
-
return editor;
|
|
7635
|
-
};
|
|
7636
|
-
|
|
7637
|
-
const isUntitledFile = uri => {
|
|
7638
|
-
return uri.startsWith('untitled:');
|
|
7639
|
-
};
|
|
7640
|
-
|
|
7641
|
-
const saveNormalFile = async (uri, content) => {
|
|
7642
|
-
await invoke$b('FileSystem.writeFile', uri, content);
|
|
7643
|
-
};
|
|
7644
|
-
|
|
7645
|
-
const showFilePicker = async platform => {
|
|
7646
|
-
const dialogTitle = 'Save File'; // TODO use i18n string
|
|
7647
|
-
const {
|
|
7648
|
-
canceled,
|
|
7649
|
-
filePath
|
|
7650
|
-
} = await invoke$d('Open.showSaveDialog', dialogTitle, [], platform);
|
|
7651
|
-
if (canceled) {
|
|
7652
|
-
return '';
|
|
7653
|
-
}
|
|
7654
|
-
return filePath;
|
|
7655
|
-
};
|
|
7656
|
-
|
|
7657
|
-
const saveUntitledFile = async (uri, content, platform) => {
|
|
7658
|
-
const filePath = await showFilePicker(platform);
|
|
7659
|
-
if (!filePath) {
|
|
7660
|
-
return;
|
|
7661
|
-
}
|
|
7662
|
-
await invoke$b('FileSystem.writeFile', filePath, content);
|
|
7663
|
-
await handleWorkspaceRefresh();
|
|
7664
|
-
await invoke$b('Main.handleUriChange', uri, filePath);
|
|
7665
|
-
return filePath;
|
|
7666
|
-
};
|
|
7667
|
-
|
|
7668
|
-
const isPermissionDeniedError = error => {
|
|
7669
|
-
const errorCode = 'code' in error ? error.code : undefined;
|
|
7670
|
-
return errorCode === 'EACCES' || error.message.includes('EACCES:');
|
|
7671
|
-
};
|
|
7672
|
-
const showSaveErrorDialog = async error => {
|
|
7673
|
-
if (isPermissionDeniedError(error)) {
|
|
7674
|
-
await invoke$b('ElectronDialog.showMessageBox', {
|
|
7675
|
-
buttons: ['OK'],
|
|
7676
|
-
defaultId: 0,
|
|
7677
|
-
message: "You don't have permission to save changes to this file.",
|
|
7678
|
-
title: 'Unable to Save File',
|
|
7679
|
-
type: 'error'
|
|
7680
|
-
});
|
|
7681
|
-
return;
|
|
7682
|
-
}
|
|
7683
|
-
await invoke$b('ElectronDialog.showMessageBox', {
|
|
7684
|
-
buttons: ['OK'],
|
|
7685
|
-
defaultId: 0,
|
|
7686
|
-
detail: error.message,
|
|
7687
|
-
message: 'Saving the file failed.',
|
|
7688
|
-
title: 'Failed to Save File',
|
|
7689
|
-
type: 'error'
|
|
7690
|
-
});
|
|
7691
|
-
};
|
|
7692
|
-
|
|
7693
|
-
const save = async editor => {
|
|
7694
|
-
try {
|
|
7695
|
-
const {
|
|
7696
|
-
platform,
|
|
7697
|
-
uri
|
|
7698
|
-
} = editor;
|
|
7699
|
-
const newEditor = await getNewEditor(editor);
|
|
7700
|
-
const content = getText$1(newEditor);
|
|
7701
|
-
if (isUntitledFile(uri)) {
|
|
7702
|
-
const pickedFilePath = await saveUntitledFile(uri, content, platform);
|
|
7703
|
-
if (pickedFilePath) {
|
|
7704
|
-
return {
|
|
7705
|
-
...newEditor,
|
|
7706
|
-
modified: false,
|
|
7707
|
-
uri: pickedFilePath
|
|
7708
|
-
};
|
|
7709
|
-
}
|
|
7710
|
-
return newEditor;
|
|
7711
|
-
}
|
|
7712
|
-
await saveNormalFile(uri, content);
|
|
7713
|
-
return {
|
|
7714
|
-
...newEditor,
|
|
7715
|
-
modified: false
|
|
7716
|
-
};
|
|
7717
|
-
} catch (error) {
|
|
7718
|
-
// @ts-ignore
|
|
7719
|
-
const betterError = new VError(error, `Failed to save file "${editor.uri}"`);
|
|
7720
|
-
await handleError(betterError);
|
|
7721
|
-
if (editor.platform === Electron) {
|
|
7722
|
-
try {
|
|
7723
|
-
await showSaveErrorDialog(betterError);
|
|
7724
|
-
} catch (dialogError) {
|
|
7725
|
-
await handleError(dialogError);
|
|
7726
|
-
}
|
|
7727
|
-
}
|
|
7728
|
-
return editor;
|
|
7729
|
-
}
|
|
7730
|
-
};
|
|
7731
|
-
|
|
7732
8098
|
// @ts-ignore
|
|
7733
8099
|
|
|
7734
8100
|
// @ts-ignore
|
|
@@ -7780,42 +8146,6 @@ const editorSelectAllLeft = editor => {
|
|
|
7780
8146
|
editorSelectHorizontalLeft(editor, lineCharacterStart);
|
|
7781
8147
|
};
|
|
7782
8148
|
|
|
7783
|
-
const RE_ALPHA_NUMERIC = /[a-zA-Z\d]/;
|
|
7784
|
-
const isAlphaNumeric = char => {
|
|
7785
|
-
return RE_ALPHA_NUMERIC.test(char);
|
|
7786
|
-
};
|
|
7787
|
-
|
|
7788
|
-
const isWordChar = char => {
|
|
7789
|
-
return isAlphaNumeric(char) || char === '_';
|
|
7790
|
-
};
|
|
7791
|
-
const getWordStartIndex = (line, index) => {
|
|
7792
|
-
for (let i = index - 1; i >= 0; i--) {
|
|
7793
|
-
if (!isWordChar(line[i])) {
|
|
7794
|
-
return i + 1;
|
|
7795
|
-
}
|
|
7796
|
-
}
|
|
7797
|
-
return 0;
|
|
7798
|
-
};
|
|
7799
|
-
const getWordEndIndex = (line, index) => {
|
|
7800
|
-
for (let i = index; i < line.length; i++) {
|
|
7801
|
-
if (!isWordChar(line[i])) {
|
|
7802
|
-
return i;
|
|
7803
|
-
}
|
|
7804
|
-
}
|
|
7805
|
-
return line.length;
|
|
7806
|
-
};
|
|
7807
|
-
const getWordMatchAtPosition = (lines, rowIndex, columnIndex) => {
|
|
7808
|
-
const line = lines[rowIndex];
|
|
7809
|
-
const start = getWordStartIndex(line, columnIndex);
|
|
7810
|
-
const end = getWordEndIndex(line, columnIndex);
|
|
7811
|
-
const word = line.slice(start, end);
|
|
7812
|
-
return {
|
|
7813
|
-
end,
|
|
7814
|
-
start,
|
|
7815
|
-
word
|
|
7816
|
-
};
|
|
7817
|
-
};
|
|
7818
|
-
|
|
7819
8149
|
const isMultiLineMatch = (lines, rowIndex, wordParts) => {
|
|
7820
8150
|
let j = 0;
|
|
7821
8151
|
if (!lines[rowIndex + j].endsWith(wordParts[j])) {
|
|
@@ -8283,7 +8613,7 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
|
8283
8613
|
await loadTokenizer(languageId, tokenizePath);
|
|
8284
8614
|
const tokenizer = getTokenizer(languageId);
|
|
8285
8615
|
const newTokenizerId = tokenizerId + 1;
|
|
8286
|
-
set$
|
|
8616
|
+
set$4(newTokenizerId, tokenizer);
|
|
8287
8617
|
const latest = getEditor$1(editor.uid);
|
|
8288
8618
|
if (!latest) {
|
|
8289
8619
|
return editor;
|
|
@@ -8609,16 +8939,6 @@ const executeTabCompletionProvider = async (editor, offset) => {
|
|
|
8609
8939
|
});
|
|
8610
8940
|
};
|
|
8611
8941
|
|
|
8612
|
-
const getOffsetAtCursor$1 = editor => {
|
|
8613
|
-
const {
|
|
8614
|
-
selections
|
|
8615
|
-
} = editor;
|
|
8616
|
-
const rowIndex = selections[0];
|
|
8617
|
-
const columnIndex = selections[1];
|
|
8618
|
-
const offset = offsetAt(editor, rowIndex, columnIndex);
|
|
8619
|
-
return offset;
|
|
8620
|
-
};
|
|
8621
|
-
|
|
8622
8942
|
const getTabCompletion = async editor => {
|
|
8623
8943
|
const offset = getOffsetAtCursor$1(editor);
|
|
8624
8944
|
const completions = await executeTabCompletionProvider(editor, offset);
|
|
@@ -8732,7 +9052,7 @@ const tabCompletion = async editor => {
|
|
|
8732
9052
|
}
|
|
8733
9053
|
return editorSnippet(editor, tabCompletion);
|
|
8734
9054
|
} catch (error) {
|
|
8735
|
-
await handleError(error);
|
|
9055
|
+
await handleError$1(error);
|
|
8736
9056
|
// TODO cursor should always be of type object
|
|
8737
9057
|
const rowIndex = editor.selections[0];
|
|
8738
9058
|
const columnIndex = editor.selections[1];
|
|
@@ -9469,7 +9789,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
9469
9789
|
focused: true,
|
|
9470
9790
|
widgets: removeEditorWidget(latest.widgets, widgetId)
|
|
9471
9791
|
};
|
|
9472
|
-
set$
|
|
9792
|
+
set$9(editor.uid, latest, newEditor);
|
|
9473
9793
|
return newEditor;
|
|
9474
9794
|
}
|
|
9475
9795
|
const newState = {
|
|
@@ -9477,7 +9797,7 @@ const createFn = (key, name, widgetId) => {
|
|
|
9477
9797
|
commands
|
|
9478
9798
|
};
|
|
9479
9799
|
const newEditor = updateWidget(latest, widgetId, newState);
|
|
9480
|
-
set$
|
|
9800
|
+
set$9(editor.uid, latest, newEditor);
|
|
9481
9801
|
return newEditor;
|
|
9482
9802
|
};
|
|
9483
9803
|
return fn;
|
|
@@ -9492,6 +9812,7 @@ const createFns = (keys, name, widgetId) => {
|
|
|
9492
9812
|
|
|
9493
9813
|
const AppendToBody = 'Viewlet.appendToBody';
|
|
9494
9814
|
const Focus = 'focus';
|
|
9815
|
+
const FocusSelector = 'Viewlet.focusSelector';
|
|
9495
9816
|
const RegisterEventListeners = 'Viewlet.registerEventListeners';
|
|
9496
9817
|
const SetSelectionByName = 'Viewlet.setSelectionByName';
|
|
9497
9818
|
const SetValueByName = 'Viewlet.setValueByName';
|
|
@@ -9916,6 +10237,7 @@ const HandleScrollBarVerticalPointerDown = 30;
|
|
|
9916
10237
|
const HandleScrollBarVerticalPointerMove = 31;
|
|
9917
10238
|
const HandleScrollBarVerticalPointerUp = 32;
|
|
9918
10239
|
const HandleWheel = 33;
|
|
10240
|
+
const HandleKeyUp = 34;
|
|
9919
10241
|
|
|
9920
10242
|
const Div = 4;
|
|
9921
10243
|
const Input = 6;
|
|
@@ -10247,6 +10569,7 @@ const FocusFindWidgetCloseButton = 48;
|
|
|
10247
10569
|
const FocusFindWidgetNextMatchButton = 49;
|
|
10248
10570
|
const FocusFindWidgetPreviousMatchButton = 50;
|
|
10249
10571
|
const FocusEditorCodeGenerator = 52;
|
|
10572
|
+
const FocusColorPicker = 41;
|
|
10250
10573
|
|
|
10251
10574
|
const getPositionAtCursor = editorUid => {
|
|
10252
10575
|
const editor = getEditor$1(editorUid);
|
|
@@ -10302,7 +10625,7 @@ const setSelections2 = async (editorUid, selections) => {
|
|
|
10302
10625
|
selections
|
|
10303
10626
|
};
|
|
10304
10627
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10305
|
-
set$
|
|
10628
|
+
set$9(editorUid, editor, newEditorWithDerivedState);
|
|
10306
10629
|
};
|
|
10307
10630
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
10308
10631
|
const editor = getEditor$1(editorUid);
|
|
@@ -10318,11 +10641,12 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
10318
10641
|
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
10319
10642
|
const newEditor = {
|
|
10320
10643
|
...editor,
|
|
10644
|
+
decorations: widgetId === Rename$1 ? editor.decorations.slice(0, -4) : editor.decorations,
|
|
10321
10645
|
focused: true,
|
|
10322
10646
|
widgets: newWidgets
|
|
10323
10647
|
};
|
|
10324
10648
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10325
|
-
set$
|
|
10649
|
+
set$9(editorUid, editor, newEditorWithDerivedState);
|
|
10326
10650
|
await setFocus(FocusEditorText);
|
|
10327
10651
|
if (unsetAdditionalFocus$1) {
|
|
10328
10652
|
await unsetAdditionalFocus(unsetAdditionalFocus$1);
|
|
@@ -10335,7 +10659,7 @@ const applyEdits2 = async (editorUid, edits) => {
|
|
|
10335
10659
|
const editor = getEditor$1(editorUid);
|
|
10336
10660
|
const newEditor = await applyEdit(editor, edits);
|
|
10337
10661
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
10338
|
-
set$
|
|
10662
|
+
set$9(editorUid, editor, newEditorWithDerivedState);
|
|
10339
10663
|
};
|
|
10340
10664
|
const getSourceActions = async editorUid => {
|
|
10341
10665
|
const actions = await getEditorSourceActions(editorUid);
|
|
@@ -10355,6 +10679,10 @@ const ensure = async (fontName, fontUrl) => {
|
|
|
10355
10679
|
|
|
10356
10680
|
const getKeyBindings = () => {
|
|
10357
10681
|
return [{
|
|
10682
|
+
command: 'Editor.closeColorPicker',
|
|
10683
|
+
key: Escape,
|
|
10684
|
+
when: FocusColorPicker
|
|
10685
|
+
}, {
|
|
10358
10686
|
command: 'Editor.closeSourceAction',
|
|
10359
10687
|
key: Escape,
|
|
10360
10688
|
when: FocusSourceActions
|
|
@@ -10913,7 +11241,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
10913
11241
|
messagePort: port
|
|
10914
11242
|
});
|
|
10915
11243
|
if (rpcId) {
|
|
10916
|
-
set$
|
|
11244
|
+
set$h(rpcId, rpc);
|
|
10917
11245
|
}
|
|
10918
11246
|
};
|
|
10919
11247
|
|
|
@@ -11064,7 +11392,7 @@ const hotReload = async () => {
|
|
|
11064
11392
|
await relaunchWorkers();
|
|
11065
11393
|
const newEditors = await restoreWidgetState(keys, savedStates);
|
|
11066
11394
|
for (const editor of newEditors) {
|
|
11067
|
-
set$
|
|
11395
|
+
set$9(editor.newState.uid, editor.oldState, editor.newState);
|
|
11068
11396
|
}
|
|
11069
11397
|
|
|
11070
11398
|
// TODO ask renderer worker to rerender all editors
|
|
@@ -11102,7 +11430,7 @@ const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncre
|
|
|
11102
11430
|
if (syntaxHighlightingEnabled) {
|
|
11103
11431
|
setEnabled$1(true);
|
|
11104
11432
|
const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
|
|
11105
|
-
set$
|
|
11433
|
+
set$7(syntaxRpc);
|
|
11106
11434
|
}
|
|
11107
11435
|
if (syncIncremental) {
|
|
11108
11436
|
setEnabled(true);
|
|
@@ -11244,7 +11572,7 @@ const loadContent = async (state, savedState) => {
|
|
|
11244
11572
|
await loadTokenizer(computedLanguageId, tokenizePath);
|
|
11245
11573
|
const tokenizer = getTokenizer(computedLanguageId);
|
|
11246
11574
|
const newTokenizerId = state.tokenizerId + 1;
|
|
11247
|
-
set$
|
|
11575
|
+
set$4(newTokenizerId, tokenizer);
|
|
11248
11576
|
const newEditor0 = {
|
|
11249
11577
|
...state,
|
|
11250
11578
|
charWidth,
|
|
@@ -11399,6 +11727,7 @@ ${editorSelector} .EditorRow {
|
|
|
11399
11727
|
height: var(--EditorRowHeight);
|
|
11400
11728
|
line-height: var(--EditorRowHeight);
|
|
11401
11729
|
}
|
|
11730
|
+
${editorSelector} .R{background-color:#add6ff40}
|
|
11402
11731
|
${editorSelector} .ScrollBarThumbVertical {
|
|
11403
11732
|
height: var(--ScrollBarHeight);
|
|
11404
11733
|
translate: 0px var(--ScrollBarTop);
|
|
@@ -11439,13 +11768,15 @@ const renderCss$1 = (oldState, newState) => {
|
|
|
11439
11768
|
|
|
11440
11769
|
const renderFocus$2 = (oldState, newState) => {
|
|
11441
11770
|
const selector = '.EditorInput textarea';
|
|
11442
|
-
return [FocusSelector, newState.uid, selector];
|
|
11771
|
+
return [FocusSelector$1, newState.uid, selector];
|
|
11443
11772
|
};
|
|
11444
11773
|
|
|
11445
11774
|
const renderFocusContext$1 = (oldState, newState) => {
|
|
11446
|
-
return [SetFocusContext$1, newState.uid,
|
|
11775
|
+
return [SetFocusContext$1, newState.uid, newState.focus];
|
|
11447
11776
|
};
|
|
11448
11777
|
|
|
11778
|
+
new Set(Object.values(VirtualDomElements));
|
|
11779
|
+
|
|
11449
11780
|
const SetText = 1;
|
|
11450
11781
|
const Replace = 2;
|
|
11451
11782
|
const SetAttribute = 3;
|
|
@@ -11929,6 +12260,7 @@ const getEditorContentVirtualDom = ({
|
|
|
11929
12260
|
return [{
|
|
11930
12261
|
childCount: 5,
|
|
11931
12262
|
className: 'EditorContent',
|
|
12263
|
+
onKeyUp: HandleKeyUp,
|
|
11932
12264
|
onMouseMove: HandleMouseMove,
|
|
11933
12265
|
type: Div
|
|
11934
12266
|
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
|
|
@@ -12072,7 +12404,7 @@ const render2 = (uid, diffResult) => {
|
|
|
12072
12404
|
newState,
|
|
12073
12405
|
oldState
|
|
12074
12406
|
} = get$7(uid);
|
|
12075
|
-
set$
|
|
12407
|
+
set$9(uid, newState, newState);
|
|
12076
12408
|
const commands = applyRender(oldState, newState, diffResult);
|
|
12077
12409
|
return commands;
|
|
12078
12410
|
};
|
|
@@ -12175,7 +12507,7 @@ const renderEditor = async id => {
|
|
|
12175
12507
|
oldState
|
|
12176
12508
|
} = instance;
|
|
12177
12509
|
const commands = [];
|
|
12178
|
-
set$
|
|
12510
|
+
set$9(id, newState, newState);
|
|
12179
12511
|
for (const item of render$7) {
|
|
12180
12512
|
if (item.isEqual(oldState, newState)) {
|
|
12181
12513
|
continue;
|
|
@@ -12198,6 +12530,9 @@ const renderEventListeners = () => {
|
|
|
12198
12530
|
}, {
|
|
12199
12531
|
name: HandleMouseMove,
|
|
12200
12532
|
params: ['handleMouseMove', ClientX, ClientY, AltKey]
|
|
12533
|
+
}, {
|
|
12534
|
+
name: HandleKeyUp,
|
|
12535
|
+
params: ['handleKeyUp', Key]
|
|
12201
12536
|
}, {
|
|
12202
12537
|
name: HandleBlur,
|
|
12203
12538
|
params: ['handleBlur']
|
|
@@ -12328,7 +12663,7 @@ const updateDebugInfo = async debugId => {
|
|
|
12328
12663
|
...newState,
|
|
12329
12664
|
highlightedLine: newInfo.rowIndex
|
|
12330
12665
|
};
|
|
12331
|
-
set$
|
|
12666
|
+
set$9(key, oldState, newEditor);
|
|
12332
12667
|
// @ts-ignore
|
|
12333
12668
|
await invoke$b('Editor.rerender', key);
|
|
12334
12669
|
};
|
|
@@ -12349,7 +12684,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
|
|
|
12349
12684
|
|
|
12350
12685
|
// TODO combine neweditor with latest editor?
|
|
12351
12686
|
|
|
12352
|
-
set$
|
|
12687
|
+
set$9(editorUid, state, newEditorWithDerivedState);
|
|
12353
12688
|
return newEditorWithDerivedState;
|
|
12354
12689
|
};
|
|
12355
12690
|
|
|
@@ -12366,6 +12701,7 @@ const commandMap = {
|
|
|
12366
12701
|
'Editor.braceCompletion': wrapCommand(braceCompletion),
|
|
12367
12702
|
'Editor.cancelSelection': wrapCommand(cancelSelection),
|
|
12368
12703
|
'Editor.closeCodeGenerator': wrapCommand(closeCodeGenerator),
|
|
12704
|
+
'Editor.closeColorPicker': wrapCommand(closeColorPicker),
|
|
12369
12705
|
'Editor.closeFind': wrapCommand(closeFind),
|
|
12370
12706
|
'Editor.closeFind2': closeFind2,
|
|
12371
12707
|
'Editor.closeRename': wrapCommand(closeRename),
|
|
@@ -12443,6 +12779,7 @@ const commandMap = {
|
|
|
12443
12779
|
'Editor.handleContextMenu': wrapCommand(handleContextMenu),
|
|
12444
12780
|
'Editor.handleDoubleClick': wrapCommand(handleDoubleClick),
|
|
12445
12781
|
'Editor.handleFocus': wrapCommand(handleFocus$1),
|
|
12782
|
+
'Editor.handleKeyUp': wrapCommand(handleKeyUp),
|
|
12446
12783
|
'Editor.handleMouseDown': wrapCommand(handleMouseDown),
|
|
12447
12784
|
'Editor.handleMouseMove': wrapCommand(handleMouseMove),
|
|
12448
12785
|
'Editor.handleMouseMoveWithAltKey': wrapCommand(handleMouseMoveWithAltKey),
|
|
@@ -12619,6 +12956,16 @@ for (const [key, value] of Object.entries(commandMap)) {
|
|
|
12619
12956
|
}
|
|
12620
12957
|
}
|
|
12621
12958
|
|
|
12959
|
+
const initializeErrorWorker = async () => {
|
|
12960
|
+
const rpc = await create$c({
|
|
12961
|
+
commandMap: {},
|
|
12962
|
+
send(port) {
|
|
12963
|
+
return sendMessagePortToErrorWorker(port, EditorWorker);
|
|
12964
|
+
}
|
|
12965
|
+
});
|
|
12966
|
+
set$g(rpc);
|
|
12967
|
+
};
|
|
12968
|
+
|
|
12622
12969
|
const createExtensionHostRpc = async () => {
|
|
12623
12970
|
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
12624
12971
|
const rpc = await create$c({
|
|
@@ -12632,7 +12979,7 @@ const createExtensionHostRpc = async () => {
|
|
|
12632
12979
|
|
|
12633
12980
|
const initializeExtensionHost = async () => {
|
|
12634
12981
|
const extensionHostRpc = await createExtensionHostRpc();
|
|
12635
|
-
set$
|
|
12982
|
+
set$3(extensionHostRpc);
|
|
12636
12983
|
};
|
|
12637
12984
|
|
|
12638
12985
|
const createExtensionManagementWorkerRpc = async () => {
|
|
@@ -12648,7 +12995,7 @@ const createExtensionManagementWorkerRpc = async () => {
|
|
|
12648
12995
|
const initializeExtensionManagementWorker = async () => {
|
|
12649
12996
|
try {
|
|
12650
12997
|
const rpc = await createExtensionManagementWorkerRpc();
|
|
12651
|
-
set$
|
|
12998
|
+
set$e(rpc);
|
|
12652
12999
|
} catch {
|
|
12653
13000
|
// ignore
|
|
12654
13001
|
}
|
|
@@ -12663,14 +13010,14 @@ const initializeOpenerWorker = async () => {
|
|
|
12663
13010
|
commandMap: {},
|
|
12664
13011
|
send: send$1
|
|
12665
13012
|
});
|
|
12666
|
-
set$
|
|
13013
|
+
set$d(rpc);
|
|
12667
13014
|
};
|
|
12668
13015
|
|
|
12669
13016
|
const initializeRendererWorker = async () => {
|
|
12670
13017
|
const rpc = await create$a({
|
|
12671
13018
|
commandMap: commandMap
|
|
12672
13019
|
});
|
|
12673
|
-
set$
|
|
13020
|
+
set$b(rpc);
|
|
12674
13021
|
};
|
|
12675
13022
|
|
|
12676
13023
|
const send = port => {
|
|
@@ -12681,12 +13028,12 @@ const initializeTextMeasurementWorker = async () => {
|
|
|
12681
13028
|
commandMap: {},
|
|
12682
13029
|
send
|
|
12683
13030
|
});
|
|
12684
|
-
set$
|
|
13031
|
+
set$c(rpc);
|
|
12685
13032
|
};
|
|
12686
13033
|
|
|
12687
13034
|
const listen = async () => {
|
|
12688
13035
|
registerCommands(commandMap);
|
|
12689
|
-
await Promise.all([initializeRendererWorker(), initializeExtensionHost(), initializeExtensionManagementWorker(), initializeTextMeasurementWorker(), initializeOpenerWorker()]);
|
|
13036
|
+
await Promise.all([initializeRendererWorker(), initializeErrorWorker(), initializeExtensionHost(), initializeExtensionManagementWorker(), initializeTextMeasurementWorker(), initializeOpenerWorker()]);
|
|
12690
13037
|
};
|
|
12691
13038
|
|
|
12692
13039
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
@@ -12780,7 +13127,7 @@ const renderFull$1 = (oldState, newState) => {
|
|
|
12780
13127
|
return commands;
|
|
12781
13128
|
};
|
|
12782
13129
|
|
|
12783
|
-
const commandsToForward$1 = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetUid];
|
|
13130
|
+
const commandsToForward$1 = [SetDom2, SetCss, AppendToBody, FocusSelector, SetBounds2, RegisterEventListeners, SetUid];
|
|
12784
13131
|
const render$4 = widget => {
|
|
12785
13132
|
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
12786
13133
|
const wrappedCommands = [];
|
|
@@ -12992,15 +13339,15 @@ const EditorMessageWidget = {
|
|
|
12992
13339
|
};
|
|
12993
13340
|
|
|
12994
13341
|
const registerWidgets = () => {
|
|
12995
|
-
set$
|
|
12996
|
-
set$
|
|
12997
|
-
set$
|
|
12998
|
-
set$
|
|
12999
|
-
set$
|
|
13000
|
-
set$
|
|
13001
|
-
set$
|
|
13002
|
-
set$
|
|
13003
|
-
set$
|
|
13342
|
+
set$8(ColorPicker$1, EditorColorPickerWidget);
|
|
13343
|
+
set$8(Completion, EditorCompletionWidget);
|
|
13344
|
+
set$8(CompletionDetail, EditorCompletionDetailWidget);
|
|
13345
|
+
set$8(Find, EditorFindWidget);
|
|
13346
|
+
set$8(Hover, EditorHoverWidget);
|
|
13347
|
+
set$8(Message, EditorMessageWidget);
|
|
13348
|
+
set$8(Rename$1, EditorRenameWidget);
|
|
13349
|
+
set$8(SourceAction$1, EditorSourceActionWidget);
|
|
13350
|
+
set$8(CodeGenerator, EditorCodeGeneratorWidget);
|
|
13004
13351
|
};
|
|
13005
13352
|
|
|
13006
13353
|
const handleUnhandledRejection = event => {
|