@lvce-editor/editor-worker 7.3.0 → 7.4.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 +1462 -1562
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1,1038 +1,1151 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const normalizeLine = line => {
|
|
2
|
+
if (line.startsWith('Error: ')) {
|
|
3
|
+
return line.slice('Error: '.length);
|
|
4
|
+
}
|
|
5
|
+
if (line.startsWith('VError: ')) {
|
|
6
|
+
return line.slice('VError: '.length);
|
|
7
|
+
}
|
|
8
|
+
return line;
|
|
4
9
|
};
|
|
5
|
-
const
|
|
6
|
-
|
|
10
|
+
const getCombinedMessage = (error, message) => {
|
|
11
|
+
const stringifiedError = normalizeLine(`${error}`);
|
|
12
|
+
if (message) {
|
|
13
|
+
return `${message}: ${stringifiedError}`;
|
|
14
|
+
}
|
|
15
|
+
return stringifiedError;
|
|
7
16
|
};
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
const NewLine$3 = '\n';
|
|
18
|
+
const getNewLineIndex$1 = (string, startIndex = undefined) => {
|
|
19
|
+
return string.indexOf(NewLine$3, startIndex);
|
|
20
|
+
};
|
|
21
|
+
const mergeStacks = (parent, child) => {
|
|
22
|
+
if (!child) {
|
|
23
|
+
return parent;
|
|
12
24
|
}
|
|
13
|
-
|
|
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;
|
|
14
37
|
};
|
|
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
|
+
}
|
|
15
56
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
57
|
+
class AssertionError extends Error {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = 'AssertionError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const getType = value => {
|
|
64
|
+
switch (typeof value) {
|
|
65
|
+
case 'number':
|
|
66
|
+
return 'number';
|
|
67
|
+
case 'function':
|
|
68
|
+
return 'function';
|
|
69
|
+
case 'string':
|
|
70
|
+
return 'string';
|
|
71
|
+
case 'object':
|
|
72
|
+
if (value === null) {
|
|
73
|
+
return 'null';
|
|
74
|
+
}
|
|
75
|
+
if (Array.isArray(value)) {
|
|
76
|
+
return 'array';
|
|
77
|
+
}
|
|
78
|
+
return 'object';
|
|
79
|
+
case 'boolean':
|
|
80
|
+
return 'boolean';
|
|
81
|
+
default:
|
|
82
|
+
return 'unknown';
|
|
83
|
+
}
|
|
21
84
|
};
|
|
22
|
-
const
|
|
23
|
-
|
|
85
|
+
const object = value => {
|
|
86
|
+
const type = getType(value);
|
|
87
|
+
if (type !== 'object') {
|
|
88
|
+
throw new AssertionError('expected value to be of type object');
|
|
89
|
+
}
|
|
24
90
|
};
|
|
25
|
-
const
|
|
26
|
-
|
|
91
|
+
const number = value => {
|
|
92
|
+
const type = getType(value);
|
|
93
|
+
if (type !== 'number') {
|
|
94
|
+
throw new AssertionError('expected value to be of type number');
|
|
95
|
+
}
|
|
27
96
|
};
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
method,
|
|
34
|
-
params
|
|
35
|
-
};
|
|
97
|
+
const array = value => {
|
|
98
|
+
const type = getType(value);
|
|
99
|
+
if (type !== 'array') {
|
|
100
|
+
throw new AssertionError('expected value to be of type array');
|
|
101
|
+
}
|
|
36
102
|
};
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
103
|
+
const string = value => {
|
|
104
|
+
const type = getType(value);
|
|
105
|
+
if (type !== 'string') {
|
|
106
|
+
throw new AssertionError('expected value to be of type string');
|
|
107
|
+
}
|
|
40
108
|
};
|
|
41
|
-
const
|
|
42
|
-
|
|
109
|
+
const boolean = value => {
|
|
110
|
+
const type = getType(value);
|
|
111
|
+
if (type !== 'boolean') {
|
|
112
|
+
throw new AssertionError('expected value to be of type boolean');
|
|
113
|
+
}
|
|
43
114
|
};
|
|
44
|
-
|
|
45
|
-
|
|
115
|
+
|
|
116
|
+
const isMessagePort = value => {
|
|
117
|
+
return value && value instanceof MessagePort;
|
|
46
118
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return ++id;
|
|
119
|
+
const isMessagePortMain = value => {
|
|
120
|
+
return value && value.constructor && value.constructor.name === 'MessagePortMain';
|
|
50
121
|
};
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
const {
|
|
54
|
-
resolve,
|
|
55
|
-
promise
|
|
56
|
-
} = Promise.withResolvers();
|
|
57
|
-
set$6(id, resolve);
|
|
58
|
-
return {
|
|
59
|
-
id,
|
|
60
|
-
promise
|
|
61
|
-
};
|
|
122
|
+
const isOffscreenCanvas = value => {
|
|
123
|
+
return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
|
|
62
124
|
};
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
id,
|
|
66
|
-
promise
|
|
67
|
-
} = registerPromise();
|
|
68
|
-
const message = {
|
|
69
|
-
jsonrpc: Two,
|
|
70
|
-
method,
|
|
71
|
-
params,
|
|
72
|
-
id
|
|
73
|
-
};
|
|
74
|
-
return {
|
|
75
|
-
message,
|
|
76
|
-
promise
|
|
77
|
-
};
|
|
125
|
+
const isInstanceOf = (value, constructorName) => {
|
|
126
|
+
return value?.constructor?.name === constructorName;
|
|
78
127
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const ReferenceError$1 = 'ReferenceError';
|
|
88
|
-
const SyntaxError$1 = 'SyntaxError';
|
|
89
|
-
const TypeError$1 = 'TypeError';
|
|
90
|
-
const getErrorConstructor = (message, type) => {
|
|
91
|
-
if (type) {
|
|
92
|
-
switch (type) {
|
|
93
|
-
case DomException:
|
|
94
|
-
return DOMException;
|
|
95
|
-
case TypeError$1:
|
|
96
|
-
return TypeError;
|
|
97
|
-
case SyntaxError$1:
|
|
98
|
-
return SyntaxError;
|
|
99
|
-
case ReferenceError$1:
|
|
100
|
-
return ReferenceError;
|
|
101
|
-
default:
|
|
102
|
-
return Error;
|
|
128
|
+
const isSocket = value => {
|
|
129
|
+
return isInstanceOf(value, 'Socket');
|
|
130
|
+
};
|
|
131
|
+
const transferrables = [isMessagePort, isMessagePortMain, isOffscreenCanvas, isSocket];
|
|
132
|
+
const isTransferrable = value => {
|
|
133
|
+
for (const fn of transferrables) {
|
|
134
|
+
if (fn(value)) {
|
|
135
|
+
return true;
|
|
103
136
|
}
|
|
104
137
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
return
|
|
138
|
+
return false;
|
|
139
|
+
};
|
|
140
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
141
|
+
if (!value) {
|
|
142
|
+
return;
|
|
110
143
|
}
|
|
111
|
-
if (
|
|
112
|
-
|
|
144
|
+
if (isTransferrable(value)) {
|
|
145
|
+
transferrables.push(value);
|
|
146
|
+
return;
|
|
113
147
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return new ErrorConstructor(message, name);
|
|
148
|
+
if (Array.isArray(value)) {
|
|
149
|
+
for (const item of value) {
|
|
150
|
+
walkValue(item, transferrables, isTransferrable);
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
120
153
|
}
|
|
121
|
-
if (
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
error.name = name;
|
|
154
|
+
if (typeof value === 'object') {
|
|
155
|
+
for (const property of Object.values(value)) {
|
|
156
|
+
walkValue(property, transferrables, isTransferrable);
|
|
125
157
|
}
|
|
126
|
-
return
|
|
158
|
+
return;
|
|
127
159
|
}
|
|
128
|
-
return new ErrorConstructor(message);
|
|
129
|
-
};
|
|
130
|
-
const getNewLineIndex$1 = (string, startIndex = undefined) => {
|
|
131
|
-
return string.indexOf(NewLine$3, startIndex);
|
|
132
160
|
};
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
return parentStack;
|
|
161
|
+
const getTransferrables = value => {
|
|
162
|
+
const transferrables = [];
|
|
163
|
+
walkValue(value, transferrables, isTransferrable);
|
|
164
|
+
return transferrables;
|
|
139
165
|
};
|
|
140
|
-
const
|
|
141
|
-
|
|
166
|
+
const attachEvents = that => {
|
|
167
|
+
const handleMessage = (...args) => {
|
|
168
|
+
const data = that.getData(...args);
|
|
169
|
+
that.dispatchEvent(new MessageEvent('message', {
|
|
170
|
+
data
|
|
171
|
+
}));
|
|
172
|
+
};
|
|
173
|
+
that.onMessage(handleMessage);
|
|
174
|
+
const handleClose = event => {
|
|
175
|
+
that.dispatchEvent(new Event('close'));
|
|
176
|
+
};
|
|
177
|
+
that.onClose(handleClose);
|
|
142
178
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const restoreJsonRpcError = error => {
|
|
149
|
-
if (error && error instanceof Error) {
|
|
150
|
-
return error;
|
|
151
|
-
}
|
|
152
|
-
const currentStack = joinLines$2(splitLines$2(new Error().stack || '').slice(1));
|
|
153
|
-
if (error && error.code && error.code === MethodNotFound) {
|
|
154
|
-
const restoredError = new JsonRpcError(error.message);
|
|
155
|
-
const parentStack = getParentStack(error);
|
|
156
|
-
restoredError.stack = parentStack + NewLine$3 + currentStack;
|
|
157
|
-
return restoredError;
|
|
158
|
-
}
|
|
159
|
-
if (error && error.message) {
|
|
160
|
-
const restoredError = constructError(error.message, error.type, error.name);
|
|
161
|
-
if (error.data) {
|
|
162
|
-
if (error.data.stack && error.data.type && error.message) {
|
|
163
|
-
restoredError.stack = error.data.type + ': ' + error.message + NewLine$3 + error.data.stack + NewLine$3 + currentStack;
|
|
164
|
-
} else if (error.data.stack) {
|
|
165
|
-
restoredError.stack = error.data.stack;
|
|
166
|
-
}
|
|
167
|
-
if (error.data.codeFrame) {
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
restoredError.codeFrame = error.data.codeFrame;
|
|
170
|
-
}
|
|
171
|
-
if (error.data.code) {
|
|
172
|
-
// @ts-ignore
|
|
173
|
-
restoredError.code = error.data.code;
|
|
174
|
-
}
|
|
175
|
-
if (error.data.type) {
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
restoredError.name = error.data.type;
|
|
178
|
-
}
|
|
179
|
-
} else {
|
|
180
|
-
if (error.stack) {
|
|
181
|
-
const lowerStack = restoredError.stack || '';
|
|
182
|
-
// @ts-ignore
|
|
183
|
-
const indexNewLine = getNewLineIndex$1(lowerStack);
|
|
184
|
-
const parentStack = getParentStack(error);
|
|
185
|
-
// @ts-ignore
|
|
186
|
-
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
187
|
-
}
|
|
188
|
-
if (error.codeFrame) {
|
|
189
|
-
// @ts-ignore
|
|
190
|
-
restoredError.codeFrame = error.codeFrame;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return restoredError;
|
|
194
|
-
}
|
|
195
|
-
if (typeof error === 'string') {
|
|
196
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
197
|
-
}
|
|
198
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
199
|
-
};
|
|
200
|
-
const unwrapJsonRpcResult = responseMessage => {
|
|
201
|
-
if ('error' in responseMessage) {
|
|
202
|
-
const restoredError = restoreJsonRpcError(responseMessage.error);
|
|
203
|
-
throw restoredError;
|
|
204
|
-
}
|
|
205
|
-
if ('result' in responseMessage) {
|
|
206
|
-
return responseMessage.result;
|
|
207
|
-
}
|
|
208
|
-
throw new JsonRpcError('unexpected response message');
|
|
209
|
-
};
|
|
210
|
-
const warn$1 = (...args) => {
|
|
211
|
-
console.warn(...args);
|
|
212
|
-
};
|
|
213
|
-
const resolve = (id, response) => {
|
|
214
|
-
const fn = get$6(id);
|
|
215
|
-
if (!fn) {
|
|
216
|
-
console.log(response);
|
|
217
|
-
warn$1(`callback ${id} may already be disposed`);
|
|
218
|
-
return;
|
|
179
|
+
class Ipc extends EventTarget {
|
|
180
|
+
constructor(rawIpc) {
|
|
181
|
+
super();
|
|
182
|
+
this._rawIpc = rawIpc;
|
|
183
|
+
attachEvents(this);
|
|
219
184
|
}
|
|
220
|
-
|
|
221
|
-
|
|
185
|
+
}
|
|
186
|
+
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
187
|
+
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
188
|
+
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
189
|
+
const NewLine$2 = '\n';
|
|
190
|
+
const joinLines$2 = lines => {
|
|
191
|
+
return lines.join(NewLine$2);
|
|
222
192
|
};
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
if (prettyError && prettyError.constructor && prettyError.constructor.name) {
|
|
229
|
-
return prettyError.constructor.name;
|
|
230
|
-
}
|
|
231
|
-
return undefined;
|
|
193
|
+
const RE_AT = /^\s+at/;
|
|
194
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
195
|
+
const isNormalStackLine = line => {
|
|
196
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
232
197
|
};
|
|
233
|
-
const
|
|
234
|
-
|
|
198
|
+
const getDetails = lines => {
|
|
199
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
200
|
+
if (index === -1) {
|
|
235
201
|
return {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
data: error.stack
|
|
202
|
+
actualMessage: joinLines$2(lines),
|
|
203
|
+
rest: []
|
|
239
204
|
};
|
|
240
205
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
stack: prettyError.stack,
|
|
246
|
-
codeFrame: prettyError.codeFrame,
|
|
247
|
-
type: getErrorType(prettyError),
|
|
248
|
-
code: prettyError.code,
|
|
249
|
-
name: prettyError.name
|
|
206
|
+
let lastIndex = index - 1;
|
|
207
|
+
while (++lastIndex < lines.length) {
|
|
208
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
209
|
+
break;
|
|
250
210
|
}
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
const create$1$1 = (message, error) => {
|
|
211
|
+
}
|
|
254
212
|
return {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
error
|
|
213
|
+
actualMessage: lines[index - 1],
|
|
214
|
+
rest: lines.slice(index, lastIndex)
|
|
258
215
|
};
|
|
259
216
|
};
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
logError(error, prettyError);
|
|
263
|
-
const errorProperty = getErrorProperty(error, prettyError);
|
|
264
|
-
return create$1$1(message, errorProperty);
|
|
217
|
+
const splitLines$2 = lines => {
|
|
218
|
+
return lines.split(NewLine$2);
|
|
265
219
|
};
|
|
266
|
-
const
|
|
220
|
+
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
221
|
+
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
222
|
+
const isMessageCodeBlockStartIndex = line => {
|
|
223
|
+
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
224
|
+
};
|
|
225
|
+
const isMessageCodeBlockEndIndex = line => {
|
|
226
|
+
return RE_MESSAGE_CODE_BLOCK_END.test(line);
|
|
227
|
+
};
|
|
228
|
+
const getMessageCodeBlock = stderr => {
|
|
229
|
+
const lines = splitLines$2(stderr);
|
|
230
|
+
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
231
|
+
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
232
|
+
const relevantLines = lines.slice(startIndex, endIndex);
|
|
233
|
+
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
234
|
+
return relevantMessage;
|
|
235
|
+
};
|
|
236
|
+
const isModuleNotFoundMessage = line => {
|
|
237
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
238
|
+
};
|
|
239
|
+
const getModuleNotFoundError = stderr => {
|
|
240
|
+
const lines = splitLines$2(stderr);
|
|
241
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
242
|
+
const message = lines[messageIndex];
|
|
267
243
|
return {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
result: result ?? null
|
|
244
|
+
message,
|
|
245
|
+
code: ERR_MODULE_NOT_FOUND
|
|
271
246
|
};
|
|
272
247
|
};
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
};
|
|
277
|
-
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
278
|
-
try {
|
|
279
|
-
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
|
280
|
-
return getSuccessResponse(message, result);
|
|
281
|
-
} catch (error) {
|
|
282
|
-
return getErrorResponse(message, error, preparePrettyError, logError);
|
|
248
|
+
const isModuleNotFoundError = stderr => {
|
|
249
|
+
if (!stderr) {
|
|
250
|
+
return false;
|
|
283
251
|
}
|
|
252
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
284
253
|
};
|
|
285
|
-
const
|
|
286
|
-
|
|
254
|
+
const isModulesSyntaxError = stderr => {
|
|
255
|
+
if (!stderr) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
287
259
|
};
|
|
288
|
-
const
|
|
289
|
-
|
|
260
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
261
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
262
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
263
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
290
264
|
};
|
|
291
|
-
const
|
|
292
|
-
|
|
265
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
266
|
+
const message = getMessageCodeBlock(stderr);
|
|
267
|
+
return {
|
|
268
|
+
message: `Incompatible native node module: ${message}`,
|
|
269
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
270
|
+
};
|
|
293
271
|
};
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
// TODO maybe remove this in v6 or v7, only accept options object to simplify the code
|
|
297
|
-
const normalizeParams = args => {
|
|
298
|
-
if (args.length === 1) {
|
|
299
|
-
const options = args[0];
|
|
300
|
-
return {
|
|
301
|
-
ipc: options.ipc,
|
|
302
|
-
message: options.message,
|
|
303
|
-
execute: options.execute,
|
|
304
|
-
resolve: options.resolve || defaultResolve,
|
|
305
|
-
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
306
|
-
logError: options.logError || defaultLogError,
|
|
307
|
-
requiresSocket: options.requiresSocket || defaultRequiresSocket
|
|
308
|
-
};
|
|
309
|
-
}
|
|
272
|
+
const getModuleSyntaxError = () => {
|
|
310
273
|
return {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
execute: args[2],
|
|
314
|
-
resolve: args[3],
|
|
315
|
-
preparePrettyError: args[4],
|
|
316
|
-
logError: args[5],
|
|
317
|
-
requiresSocket: args[6]
|
|
274
|
+
message: `ES Modules are not supported in electron`,
|
|
275
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
318
276
|
};
|
|
319
277
|
};
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
message,
|
|
324
|
-
ipc,
|
|
325
|
-
execute,
|
|
326
|
-
resolve,
|
|
327
|
-
preparePrettyError,
|
|
328
|
-
logError,
|
|
329
|
-
requiresSocket
|
|
330
|
-
} = options;
|
|
331
|
-
if ('id' in message) {
|
|
332
|
-
if ('method' in message) {
|
|
333
|
-
const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
334
|
-
try {
|
|
335
|
-
ipc.send(response);
|
|
336
|
-
} catch (error) {
|
|
337
|
-
const errorResponse = getErrorResponse(message, error, preparePrettyError, logError);
|
|
338
|
-
ipc.send(errorResponse);
|
|
339
|
-
}
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
resolve(message.id, message);
|
|
343
|
-
return;
|
|
278
|
+
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
279
|
+
if (isUnhelpfulNativeModuleError(stderr)) {
|
|
280
|
+
return getNativeModuleErrorMessage(stderr);
|
|
344
281
|
}
|
|
345
|
-
if (
|
|
346
|
-
|
|
347
|
-
return;
|
|
282
|
+
if (isModulesSyntaxError(stderr)) {
|
|
283
|
+
return getModuleSyntaxError();
|
|
348
284
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
352
|
-
const {
|
|
353
|
-
message,
|
|
354
|
-
promise
|
|
355
|
-
} = create$2$1(method, params);
|
|
356
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
357
|
-
ipc.sendAndTransfer(message);
|
|
358
|
-
} else {
|
|
359
|
-
ipc.send(message);
|
|
285
|
+
if (isModuleNotFoundError(stderr)) {
|
|
286
|
+
return getModuleNotFoundError(stderr);
|
|
360
287
|
}
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
288
|
+
const lines = splitLines$2(stderr);
|
|
289
|
+
const {
|
|
290
|
+
actualMessage,
|
|
291
|
+
rest
|
|
292
|
+
} = getDetails(lines);
|
|
293
|
+
return {
|
|
294
|
+
message: actualMessage,
|
|
295
|
+
code: '',
|
|
296
|
+
stack: rest
|
|
297
|
+
};
|
|
367
298
|
};
|
|
368
|
-
|
|
369
|
-
|
|
299
|
+
class IpcError extends VError {
|
|
300
|
+
// @ts-ignore
|
|
301
|
+
constructor(betterMessage, stdout = '', stderr = '') {
|
|
302
|
+
if (stdout || stderr) {
|
|
303
|
+
// @ts-ignore
|
|
304
|
+
const {
|
|
305
|
+
message,
|
|
306
|
+
code,
|
|
307
|
+
stack
|
|
308
|
+
} = getHelpfulChildProcessError(stdout, stderr);
|
|
309
|
+
const cause = new Error(message);
|
|
310
|
+
// @ts-ignore
|
|
311
|
+
cause.code = code;
|
|
312
|
+
cause.stack = stack;
|
|
313
|
+
super(cause, betterMessage);
|
|
314
|
+
} else {
|
|
315
|
+
super(betterMessage);
|
|
316
|
+
}
|
|
317
|
+
// @ts-ignore
|
|
318
|
+
this.name = 'IpcError';
|
|
319
|
+
// @ts-ignore
|
|
320
|
+
this.stdout = stdout;
|
|
321
|
+
// @ts-ignore
|
|
322
|
+
this.stderr = stderr;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const readyMessage = 'ready';
|
|
326
|
+
const getData$2 = event => {
|
|
327
|
+
return event.data;
|
|
370
328
|
};
|
|
371
|
-
const
|
|
372
|
-
|
|
329
|
+
const listen$7 = () => {
|
|
330
|
+
// @ts-ignore
|
|
331
|
+
if (typeof WorkerGlobalScope === 'undefined') {
|
|
332
|
+
throw new TypeError('module is not in web worker scope');
|
|
333
|
+
}
|
|
334
|
+
return globalThis;
|
|
373
335
|
};
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
const ipc = get$7();
|
|
377
|
-
return invoke$9(ipc, method, ...params);
|
|
336
|
+
const signal$8 = global => {
|
|
337
|
+
global.postMessage(readyMessage);
|
|
378
338
|
};
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
339
|
+
class IpcChildWithModuleWorker extends Ipc {
|
|
340
|
+
getData(event) {
|
|
341
|
+
return getData$2(event);
|
|
342
|
+
}
|
|
343
|
+
send(message) {
|
|
344
|
+
// @ts-ignore
|
|
345
|
+
this._rawIpc.postMessage(message);
|
|
346
|
+
}
|
|
347
|
+
sendAndTransfer(message) {
|
|
348
|
+
const transfer = getTransferrables(message);
|
|
349
|
+
// @ts-ignore
|
|
350
|
+
this._rawIpc.postMessage(message, transfer);
|
|
351
|
+
}
|
|
352
|
+
dispose() {
|
|
353
|
+
// ignore
|
|
354
|
+
}
|
|
355
|
+
onClose(callback) {
|
|
356
|
+
// ignore
|
|
357
|
+
}
|
|
358
|
+
onMessage(callback) {
|
|
359
|
+
this._rawIpc.addEventListener('message', callback);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const wrap$f = global => {
|
|
363
|
+
return new IpcChildWithModuleWorker(global);
|
|
382
364
|
};
|
|
383
|
-
const
|
|
384
|
-
|
|
365
|
+
const waitForFirstMessage = async port => {
|
|
366
|
+
const {
|
|
367
|
+
resolve,
|
|
368
|
+
promise
|
|
369
|
+
} = Promise.withResolvers();
|
|
370
|
+
port.addEventListener('message', resolve, {
|
|
371
|
+
once: true
|
|
372
|
+
});
|
|
373
|
+
const event = await promise;
|
|
374
|
+
// @ts-ignore
|
|
375
|
+
return event.data;
|
|
385
376
|
};
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
|
|
377
|
+
const listen$6 = async () => {
|
|
378
|
+
const parentIpcRaw = listen$7();
|
|
379
|
+
signal$8(parentIpcRaw);
|
|
380
|
+
const parentIpc = wrap$f(parentIpcRaw);
|
|
381
|
+
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
382
|
+
if (firstMessage.method !== 'initialize') {
|
|
383
|
+
throw new IpcError('unexpected first message');
|
|
384
|
+
}
|
|
385
|
+
const type = firstMessage.params[0];
|
|
386
|
+
if (type === 'message-port') {
|
|
387
|
+
parentIpc.send({
|
|
388
|
+
jsonrpc: '2.0',
|
|
389
|
+
id: firstMessage.id,
|
|
390
|
+
result: null
|
|
391
|
+
});
|
|
392
|
+
parentIpc.dispose();
|
|
393
|
+
const port = firstMessage.params[1];
|
|
394
|
+
return port;
|
|
395
|
+
}
|
|
396
|
+
return globalThis;
|
|
389
397
|
};
|
|
390
|
-
|
|
391
|
-
|
|
398
|
+
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
399
|
+
getData(event) {
|
|
400
|
+
return getData$2(event);
|
|
401
|
+
}
|
|
402
|
+
send(message) {
|
|
403
|
+
this._rawIpc.postMessage(message);
|
|
404
|
+
}
|
|
405
|
+
sendAndTransfer(message) {
|
|
406
|
+
const transfer = getTransferrables(message);
|
|
407
|
+
this._rawIpc.postMessage(message, transfer);
|
|
408
|
+
}
|
|
409
|
+
dispose() {
|
|
410
|
+
if (this._rawIpc.close) {
|
|
411
|
+
this._rawIpc.close();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
onClose(callback) {
|
|
415
|
+
// ignore
|
|
416
|
+
}
|
|
417
|
+
onMessage(callback) {
|
|
418
|
+
this._rawIpc.addEventListener('message', callback);
|
|
419
|
+
this._rawIpc.start();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const wrap$e = port => {
|
|
423
|
+
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
392
424
|
};
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
425
|
+
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
426
|
+
__proto__: null,
|
|
427
|
+
listen: listen$6,
|
|
428
|
+
wrap: wrap$e
|
|
397
429
|
};
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
430
|
+
const addListener = (emitter, type, callback) => {
|
|
431
|
+
if ('addEventListener' in emitter) {
|
|
432
|
+
emitter.addEventListener(type, callback);
|
|
433
|
+
} else {
|
|
434
|
+
emitter.on(type, callback);
|
|
435
|
+
}
|
|
402
436
|
};
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
437
|
+
const removeListener = (emitter, type, callback) => {
|
|
438
|
+
if ('removeEventListener' in emitter) {
|
|
439
|
+
emitter.removeEventListener(type, callback);
|
|
440
|
+
} else {
|
|
441
|
+
emitter.off(type, callback);
|
|
407
442
|
}
|
|
408
|
-
|
|
409
|
-
|
|
443
|
+
};
|
|
444
|
+
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
445
|
+
const {
|
|
446
|
+
resolve,
|
|
447
|
+
promise
|
|
448
|
+
} = Promise.withResolvers();
|
|
449
|
+
const listenerMap = Object.create(null);
|
|
450
|
+
const cleanup = value => {
|
|
451
|
+
for (const event of Object.keys(eventMap)) {
|
|
452
|
+
removeListener(eventEmitter, event, listenerMap[event]);
|
|
453
|
+
}
|
|
454
|
+
resolve(value);
|
|
455
|
+
};
|
|
456
|
+
for (const [event, type] of Object.entries(eventMap)) {
|
|
457
|
+
const listener = event => {
|
|
458
|
+
cleanup({
|
|
459
|
+
type,
|
|
460
|
+
event
|
|
461
|
+
});
|
|
462
|
+
};
|
|
463
|
+
addListener(eventEmitter, event, listener);
|
|
464
|
+
listenerMap[event] = listener;
|
|
410
465
|
}
|
|
411
|
-
return
|
|
466
|
+
return promise;
|
|
412
467
|
};
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
468
|
+
const Message$1 = 3;
|
|
469
|
+
const create$5$1 = async ({
|
|
470
|
+
messagePort,
|
|
471
|
+
isMessagePortOpen
|
|
472
|
+
}) => {
|
|
473
|
+
if (!isMessagePort(messagePort)) {
|
|
474
|
+
throw new IpcError('port must be of type MessagePort');
|
|
417
475
|
}
|
|
418
|
-
|
|
476
|
+
if (isMessagePortOpen) {
|
|
477
|
+
return messagePort;
|
|
478
|
+
}
|
|
479
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
480
|
+
message: Message$1
|
|
481
|
+
});
|
|
482
|
+
messagePort.start();
|
|
483
|
+
const {
|
|
484
|
+
type,
|
|
485
|
+
event
|
|
486
|
+
} = await eventPromise;
|
|
487
|
+
if (type !== Message$1) {
|
|
488
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
489
|
+
}
|
|
490
|
+
if (event.data !== readyMessage) {
|
|
491
|
+
throw new IpcError('unexpected first message');
|
|
492
|
+
}
|
|
493
|
+
return messagePort;
|
|
419
494
|
};
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
return string.indexOf(NewLine$2, startIndex);
|
|
495
|
+
const signal$1 = messagePort => {
|
|
496
|
+
messagePort.start();
|
|
423
497
|
};
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
498
|
+
class IpcParentWithMessagePort extends Ipc {
|
|
499
|
+
getData = getData$2;
|
|
500
|
+
send(message) {
|
|
501
|
+
this._rawIpc.postMessage(message);
|
|
427
502
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return parent;
|
|
503
|
+
sendAndTransfer(message) {
|
|
504
|
+
const transfer = getTransferrables(message);
|
|
505
|
+
this._rawIpc.postMessage(message, transfer);
|
|
432
506
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
436
|
-
if (parentFirstLine.includes(childFirstLine)) {
|
|
437
|
-
return parentFirstLine + childRest;
|
|
507
|
+
dispose() {
|
|
508
|
+
this._rawIpc.close();
|
|
438
509
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
class VError extends Error {
|
|
442
|
-
constructor(error, message) {
|
|
443
|
-
const combinedMessage = getCombinedMessage(error, message);
|
|
444
|
-
super(combinedMessage);
|
|
445
|
-
this.name = 'VError';
|
|
446
|
-
if (error instanceof Error) {
|
|
447
|
-
this.stack = mergeStacks(this.stack, error.stack);
|
|
448
|
-
}
|
|
449
|
-
if (error.codeFrame) {
|
|
450
|
-
// @ts-ignore
|
|
451
|
-
this.codeFrame = error.codeFrame;
|
|
452
|
-
}
|
|
453
|
-
if (error.code) {
|
|
454
|
-
// @ts-ignore
|
|
455
|
-
this.code = error.code;
|
|
456
|
-
}
|
|
510
|
+
onMessage(callback) {
|
|
511
|
+
this._rawIpc.addEventListener('message', callback);
|
|
457
512
|
}
|
|
513
|
+
onClose(callback) {}
|
|
458
514
|
}
|
|
515
|
+
const wrap$5 = messagePort => {
|
|
516
|
+
return new IpcParentWithMessagePort(messagePort);
|
|
517
|
+
};
|
|
518
|
+
const IpcParentWithMessagePort$1 = {
|
|
519
|
+
__proto__: null,
|
|
520
|
+
create: create$5$1,
|
|
521
|
+
signal: signal$1,
|
|
522
|
+
wrap: wrap$5
|
|
523
|
+
};
|
|
459
524
|
|
|
460
|
-
|
|
525
|
+
const Two = '2.0';
|
|
526
|
+
const create$4$1 = (method, params) => {
|
|
527
|
+
return {
|
|
528
|
+
jsonrpc: Two,
|
|
529
|
+
method,
|
|
530
|
+
params
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
const callbacks = Object.create(null);
|
|
534
|
+
const set$a = (id, fn) => {
|
|
535
|
+
callbacks[id] = fn;
|
|
536
|
+
};
|
|
537
|
+
const get$7 = id => {
|
|
538
|
+
return callbacks[id];
|
|
539
|
+
};
|
|
540
|
+
const remove$8 = id => {
|
|
541
|
+
delete callbacks[id];
|
|
542
|
+
};
|
|
543
|
+
let id = 0;
|
|
544
|
+
const create$3$2 = () => {
|
|
545
|
+
return ++id;
|
|
546
|
+
};
|
|
547
|
+
const registerPromise = () => {
|
|
548
|
+
const id = create$3$2();
|
|
549
|
+
const {
|
|
550
|
+
resolve,
|
|
551
|
+
promise
|
|
552
|
+
} = Promise.withResolvers();
|
|
553
|
+
set$a(id, resolve);
|
|
554
|
+
return {
|
|
555
|
+
id,
|
|
556
|
+
promise
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
const create$2$2 = (method, params) => {
|
|
560
|
+
const {
|
|
561
|
+
id,
|
|
562
|
+
promise
|
|
563
|
+
} = registerPromise();
|
|
564
|
+
const message = {
|
|
565
|
+
jsonrpc: Two,
|
|
566
|
+
method,
|
|
567
|
+
params,
|
|
568
|
+
id
|
|
569
|
+
};
|
|
570
|
+
return {
|
|
571
|
+
message,
|
|
572
|
+
promise
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
class JsonRpcError extends Error {
|
|
461
576
|
constructor(message) {
|
|
462
577
|
super(message);
|
|
463
|
-
this.name = '
|
|
578
|
+
this.name = 'JsonRpcError';
|
|
464
579
|
}
|
|
465
580
|
}
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
return
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
return 'unknown';
|
|
581
|
+
const NewLine$1 = '\n';
|
|
582
|
+
const DomException = 'DOMException';
|
|
583
|
+
const ReferenceError$1 = 'ReferenceError';
|
|
584
|
+
const SyntaxError$1 = 'SyntaxError';
|
|
585
|
+
const TypeError$1 = 'TypeError';
|
|
586
|
+
const getErrorConstructor = (message, type) => {
|
|
587
|
+
if (type) {
|
|
588
|
+
switch (type) {
|
|
589
|
+
case DomException:
|
|
590
|
+
return DOMException;
|
|
591
|
+
case TypeError$1:
|
|
592
|
+
return TypeError;
|
|
593
|
+
case SyntaxError$1:
|
|
594
|
+
return SyntaxError;
|
|
595
|
+
case ReferenceError$1:
|
|
596
|
+
return ReferenceError;
|
|
597
|
+
default:
|
|
598
|
+
return Error;
|
|
599
|
+
}
|
|
486
600
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const type = getType(value);
|
|
490
|
-
if (type !== 'object') {
|
|
491
|
-
throw new AssertionError('expected value to be of type object');
|
|
601
|
+
if (message.startsWith('TypeError: ')) {
|
|
602
|
+
return TypeError;
|
|
492
603
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
const type = getType(value);
|
|
496
|
-
if (type !== 'number') {
|
|
497
|
-
throw new AssertionError('expected value to be of type number');
|
|
604
|
+
if (message.startsWith('SyntaxError: ')) {
|
|
605
|
+
return SyntaxError;
|
|
498
606
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
const type = getType(value);
|
|
502
|
-
if (type !== 'array') {
|
|
503
|
-
throw new AssertionError('expected value to be of type array');
|
|
607
|
+
if (message.startsWith('ReferenceError: ')) {
|
|
608
|
+
return ReferenceError;
|
|
504
609
|
}
|
|
610
|
+
return Error;
|
|
505
611
|
};
|
|
506
|
-
const
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
509
|
-
|
|
612
|
+
const constructError = (message, type, name) => {
|
|
613
|
+
const ErrorConstructor = getErrorConstructor(message, type);
|
|
614
|
+
if (ErrorConstructor === DOMException && name) {
|
|
615
|
+
return new ErrorConstructor(message, name);
|
|
510
616
|
}
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
617
|
+
if (ErrorConstructor === Error) {
|
|
618
|
+
const error = new Error(message);
|
|
619
|
+
if (name && name !== 'VError') {
|
|
620
|
+
error.name = name;
|
|
621
|
+
}
|
|
622
|
+
return error;
|
|
516
623
|
}
|
|
624
|
+
return new ErrorConstructor(message);
|
|
517
625
|
};
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
return value && value instanceof MessagePort;
|
|
626
|
+
const joinLines$1 = lines => {
|
|
627
|
+
return lines.join(NewLine$1);
|
|
521
628
|
};
|
|
522
|
-
const
|
|
523
|
-
return
|
|
629
|
+
const splitLines$1 = lines => {
|
|
630
|
+
return lines.split(NewLine$1);
|
|
524
631
|
};
|
|
525
|
-
const
|
|
526
|
-
|
|
632
|
+
const getCurrentStack = () => {
|
|
633
|
+
const currentStack = joinLines$1(splitLines$1(new Error().stack || '').slice(2));
|
|
634
|
+
return currentStack;
|
|
527
635
|
};
|
|
528
|
-
const
|
|
529
|
-
return
|
|
636
|
+
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
637
|
+
return string.indexOf(NewLine$1, startIndex);
|
|
530
638
|
};
|
|
531
|
-
const
|
|
532
|
-
|
|
639
|
+
const getParentStack = error => {
|
|
640
|
+
let parentStack = error.stack || error.data || error.message || '';
|
|
641
|
+
if (parentStack.startsWith(' at')) {
|
|
642
|
+
parentStack = error.message + NewLine$1 + parentStack;
|
|
643
|
+
}
|
|
644
|
+
return parentStack;
|
|
533
645
|
};
|
|
534
|
-
const
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
646
|
+
const MethodNotFound = -32601;
|
|
647
|
+
const Custom = -32001;
|
|
648
|
+
const restoreJsonRpcError = error => {
|
|
649
|
+
const currentStack = getCurrentStack();
|
|
650
|
+
if (error && error instanceof Error) {
|
|
651
|
+
if (typeof error.stack === 'string') {
|
|
652
|
+
error.stack = error.stack + NewLine$1 + currentStack;
|
|
539
653
|
}
|
|
654
|
+
return error;
|
|
540
655
|
}
|
|
541
|
-
|
|
656
|
+
if (error && error.code && error.code === MethodNotFound) {
|
|
657
|
+
const restoredError = new JsonRpcError(error.message);
|
|
658
|
+
const parentStack = getParentStack(error);
|
|
659
|
+
restoredError.stack = parentStack + NewLine$1 + currentStack;
|
|
660
|
+
return restoredError;
|
|
661
|
+
}
|
|
662
|
+
if (error && error.message) {
|
|
663
|
+
const restoredError = constructError(error.message, error.type, error.name);
|
|
664
|
+
if (error.data) {
|
|
665
|
+
if (error.data.stack && error.data.type && error.message) {
|
|
666
|
+
restoredError.stack = error.data.type + ': ' + error.message + NewLine$1 + error.data.stack + NewLine$1 + currentStack;
|
|
667
|
+
} else if (error.data.stack) {
|
|
668
|
+
restoredError.stack = error.data.stack;
|
|
669
|
+
}
|
|
670
|
+
if (error.data.codeFrame) {
|
|
671
|
+
// @ts-ignore
|
|
672
|
+
restoredError.codeFrame = error.data.codeFrame;
|
|
673
|
+
}
|
|
674
|
+
if (error.data.code) {
|
|
675
|
+
// @ts-ignore
|
|
676
|
+
restoredError.code = error.data.code;
|
|
677
|
+
}
|
|
678
|
+
if (error.data.type) {
|
|
679
|
+
// @ts-ignore
|
|
680
|
+
restoredError.name = error.data.type;
|
|
681
|
+
}
|
|
682
|
+
} else {
|
|
683
|
+
if (error.stack) {
|
|
684
|
+
const lowerStack = restoredError.stack || '';
|
|
685
|
+
// @ts-ignore
|
|
686
|
+
const indexNewLine = getNewLineIndex(lowerStack);
|
|
687
|
+
const parentStack = getParentStack(error);
|
|
688
|
+
// @ts-ignore
|
|
689
|
+
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
690
|
+
}
|
|
691
|
+
if (error.codeFrame) {
|
|
692
|
+
// @ts-ignore
|
|
693
|
+
restoredError.codeFrame = error.codeFrame;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return restoredError;
|
|
697
|
+
}
|
|
698
|
+
if (typeof error === 'string') {
|
|
699
|
+
return new Error(`JsonRpc Error: ${error}`);
|
|
700
|
+
}
|
|
701
|
+
return new Error(`JsonRpc Error: ${error}`);
|
|
542
702
|
};
|
|
543
|
-
const
|
|
544
|
-
if (
|
|
545
|
-
|
|
703
|
+
const unwrapJsonRpcResult = responseMessage => {
|
|
704
|
+
if ('error' in responseMessage) {
|
|
705
|
+
const restoredError = restoreJsonRpcError(responseMessage.error);
|
|
706
|
+
throw restoredError;
|
|
546
707
|
}
|
|
547
|
-
if (
|
|
548
|
-
|
|
549
|
-
return;
|
|
708
|
+
if ('result' in responseMessage) {
|
|
709
|
+
return responseMessage.result;
|
|
550
710
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
711
|
+
throw new JsonRpcError('unexpected response message');
|
|
712
|
+
};
|
|
713
|
+
const warn$1 = (...args) => {
|
|
714
|
+
console.warn(...args);
|
|
715
|
+
};
|
|
716
|
+
const resolve = (id, response) => {
|
|
717
|
+
const fn = get$7(id);
|
|
718
|
+
if (!fn) {
|
|
719
|
+
console.log(response);
|
|
720
|
+
warn$1(`callback ${id} may already be disposed`);
|
|
555
721
|
return;
|
|
556
722
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
723
|
+
fn(response);
|
|
724
|
+
remove$8(id);
|
|
725
|
+
};
|
|
726
|
+
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
727
|
+
const getErrorType = prettyError => {
|
|
728
|
+
if (prettyError && prettyError.type) {
|
|
729
|
+
return prettyError.type;
|
|
730
|
+
}
|
|
731
|
+
if (prettyError && prettyError.constructor && prettyError.constructor.name) {
|
|
732
|
+
return prettyError.constructor.name;
|
|
562
733
|
}
|
|
734
|
+
return undefined;
|
|
563
735
|
};
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
walkValue(value, transferrables, isTransferrable);
|
|
567
|
-
return transferrables;
|
|
568
|
-
};
|
|
569
|
-
const attachEvents = that => {
|
|
570
|
-
const handleMessage = (...args) => {
|
|
571
|
-
const data = that.getData(...args);
|
|
572
|
-
that.dispatchEvent(new MessageEvent('message', {
|
|
573
|
-
data
|
|
574
|
-
}));
|
|
575
|
-
};
|
|
576
|
-
that.onMessage(handleMessage);
|
|
577
|
-
const handleClose = event => {
|
|
578
|
-
that.dispatchEvent(new Event('close'));
|
|
579
|
-
};
|
|
580
|
-
that.onClose(handleClose);
|
|
736
|
+
const isAlreadyStack = line => {
|
|
737
|
+
return line.trim().startsWith('at ');
|
|
581
738
|
};
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
739
|
+
const getStack = prettyError => {
|
|
740
|
+
const stackString = prettyError.stack || '';
|
|
741
|
+
const newLineIndex = stackString.indexOf('\n');
|
|
742
|
+
if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
|
|
743
|
+
return stackString.slice(newLineIndex + 1);
|
|
587
744
|
}
|
|
588
|
-
|
|
589
|
-
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
590
|
-
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
591
|
-
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
592
|
-
const NewLine$1 = '\n';
|
|
593
|
-
const joinLines$1 = lines => {
|
|
594
|
-
return lines.join(NewLine$1);
|
|
595
|
-
};
|
|
596
|
-
const RE_AT = /^\s+at/;
|
|
597
|
-
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
598
|
-
const isNormalStackLine = line => {
|
|
599
|
-
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
745
|
+
return stackString;
|
|
600
746
|
};
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
if (index === -1) {
|
|
747
|
+
const getErrorProperty = (error, prettyError) => {
|
|
748
|
+
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
604
749
|
return {
|
|
605
|
-
|
|
606
|
-
|
|
750
|
+
code: MethodNotFound,
|
|
751
|
+
message: error.message,
|
|
752
|
+
data: error.stack
|
|
607
753
|
};
|
|
608
754
|
}
|
|
609
|
-
let lastIndex = index - 1;
|
|
610
|
-
while (++lastIndex < lines.length) {
|
|
611
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
612
|
-
break;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
755
|
return {
|
|
616
|
-
|
|
617
|
-
|
|
756
|
+
code: Custom,
|
|
757
|
+
message: prettyError.message,
|
|
758
|
+
data: {
|
|
759
|
+
stack: getStack(prettyError),
|
|
760
|
+
codeFrame: prettyError.codeFrame,
|
|
761
|
+
type: getErrorType(prettyError),
|
|
762
|
+
code: prettyError.code,
|
|
763
|
+
name: prettyError.name
|
|
764
|
+
}
|
|
618
765
|
};
|
|
619
766
|
};
|
|
620
|
-
const
|
|
621
|
-
return lines.split(NewLine$1);
|
|
622
|
-
};
|
|
623
|
-
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
624
|
-
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
625
|
-
const isMessageCodeBlockStartIndex = line => {
|
|
626
|
-
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
627
|
-
};
|
|
628
|
-
const isMessageCodeBlockEndIndex = line => {
|
|
629
|
-
return RE_MESSAGE_CODE_BLOCK_END.test(line);
|
|
630
|
-
};
|
|
631
|
-
const getMessageCodeBlock = stderr => {
|
|
632
|
-
const lines = splitLines$1(stderr);
|
|
633
|
-
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
634
|
-
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
635
|
-
const relevantLines = lines.slice(startIndex, endIndex);
|
|
636
|
-
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
637
|
-
return relevantMessage;
|
|
638
|
-
};
|
|
639
|
-
const isModuleNotFoundMessage = line => {
|
|
640
|
-
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
641
|
-
};
|
|
642
|
-
const getModuleNotFoundError = stderr => {
|
|
643
|
-
const lines = splitLines$1(stderr);
|
|
644
|
-
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
645
|
-
const message = lines[messageIndex];
|
|
767
|
+
const create$1$1 = (id, error) => {
|
|
646
768
|
return {
|
|
647
|
-
|
|
648
|
-
|
|
769
|
+
jsonrpc: Two,
|
|
770
|
+
id,
|
|
771
|
+
error
|
|
649
772
|
};
|
|
650
773
|
};
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
return
|
|
656
|
-
};
|
|
657
|
-
const isModulesSyntaxError = stderr => {
|
|
658
|
-
if (!stderr) {
|
|
659
|
-
return false;
|
|
660
|
-
}
|
|
661
|
-
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
662
|
-
};
|
|
663
|
-
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
664
|
-
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
665
|
-
const isUnhelpfulNativeModuleError = stderr => {
|
|
666
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
774
|
+
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
775
|
+
const prettyError = preparePrettyError(error);
|
|
776
|
+
logError(error, prettyError);
|
|
777
|
+
const errorProperty = getErrorProperty(error, prettyError);
|
|
778
|
+
return create$1$1(id, errorProperty);
|
|
667
779
|
};
|
|
668
|
-
const
|
|
669
|
-
const message = getMessageCodeBlock(stderr);
|
|
780
|
+
const create$b = (message, result) => {
|
|
670
781
|
return {
|
|
671
|
-
|
|
672
|
-
|
|
782
|
+
jsonrpc: Two,
|
|
783
|
+
id: message.id,
|
|
784
|
+
result: result ?? null
|
|
673
785
|
};
|
|
674
786
|
};
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
679
|
-
};
|
|
787
|
+
const getSuccessResponse = (message, result) => {
|
|
788
|
+
const resultProperty = result ?? null;
|
|
789
|
+
return create$b(message, resultProperty);
|
|
680
790
|
};
|
|
681
|
-
const
|
|
682
|
-
if (isUnhelpfulNativeModuleError(stderr)) {
|
|
683
|
-
return getNativeModuleErrorMessage(stderr);
|
|
684
|
-
}
|
|
685
|
-
if (isModulesSyntaxError(stderr)) {
|
|
686
|
-
return getModuleSyntaxError();
|
|
687
|
-
}
|
|
688
|
-
if (isModuleNotFoundError(stderr)) {
|
|
689
|
-
return getModuleNotFoundError(stderr);
|
|
690
|
-
}
|
|
691
|
-
const lines = splitLines$1(stderr);
|
|
692
|
-
const {
|
|
693
|
-
actualMessage,
|
|
694
|
-
rest
|
|
695
|
-
} = getDetails(lines);
|
|
791
|
+
const getErrorResponseSimple = (id, error) => {
|
|
696
792
|
return {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
793
|
+
jsonrpc: Two,
|
|
794
|
+
id,
|
|
795
|
+
error: {
|
|
796
|
+
code: Custom,
|
|
797
|
+
// @ts-ignore
|
|
798
|
+
message: error.message,
|
|
799
|
+
data: error
|
|
800
|
+
}
|
|
700
801
|
};
|
|
701
802
|
};
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
code,
|
|
710
|
-
stack
|
|
711
|
-
} = getHelpfulChildProcessError(stdout, stderr);
|
|
712
|
-
const cause = new Error(message);
|
|
713
|
-
// @ts-ignore
|
|
714
|
-
cause.code = code;
|
|
715
|
-
cause.stack = stack;
|
|
716
|
-
super(cause, betterMessage);
|
|
717
|
-
} else {
|
|
718
|
-
super(betterMessage);
|
|
803
|
+
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
804
|
+
try {
|
|
805
|
+
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
|
806
|
+
return getSuccessResponse(message, result);
|
|
807
|
+
} catch (error) {
|
|
808
|
+
if (ipc.canUseSimpleErrorResponse) {
|
|
809
|
+
return getErrorResponseSimple(message.id, error);
|
|
719
810
|
}
|
|
720
|
-
|
|
721
|
-
this.name = 'IpcError';
|
|
722
|
-
// @ts-ignore
|
|
723
|
-
this.stdout = stdout;
|
|
724
|
-
// @ts-ignore
|
|
725
|
-
this.stderr = stderr;
|
|
811
|
+
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
726
812
|
}
|
|
727
813
|
};
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
return event.data;
|
|
814
|
+
const defaultPreparePrettyError = error => {
|
|
815
|
+
return error;
|
|
731
816
|
};
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
}) => {
|
|
735
|
-
return port;
|
|
817
|
+
const defaultLogError = () => {
|
|
818
|
+
// ignore
|
|
736
819
|
};
|
|
737
|
-
const
|
|
738
|
-
|
|
820
|
+
const defaultRequiresSocket = () => {
|
|
821
|
+
return false;
|
|
739
822
|
};
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
823
|
+
const defaultResolve = resolve;
|
|
824
|
+
|
|
825
|
+
// TODO maybe remove this in v6 or v7, only accept options object to simplify the code
|
|
826
|
+
const normalizeParams = args => {
|
|
827
|
+
if (args.length === 1) {
|
|
828
|
+
const options = args[0];
|
|
829
|
+
return {
|
|
830
|
+
ipc: options.ipc,
|
|
831
|
+
message: options.message,
|
|
832
|
+
execute: options.execute,
|
|
833
|
+
resolve: options.resolve || defaultResolve,
|
|
834
|
+
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
835
|
+
logError: options.logError || defaultLogError,
|
|
836
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket
|
|
837
|
+
};
|
|
750
838
|
}
|
|
751
|
-
|
|
752
|
-
|
|
839
|
+
return {
|
|
840
|
+
ipc: args[0],
|
|
841
|
+
message: args[1],
|
|
842
|
+
execute: args[2],
|
|
843
|
+
resolve: args[3],
|
|
844
|
+
preparePrettyError: args[4],
|
|
845
|
+
logError: args[5],
|
|
846
|
+
requiresSocket: args[6]
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
const handleJsonRpcMessage = async (...args) => {
|
|
850
|
+
const options = normalizeParams(args);
|
|
851
|
+
const {
|
|
852
|
+
message,
|
|
853
|
+
ipc,
|
|
854
|
+
execute,
|
|
855
|
+
resolve,
|
|
856
|
+
preparePrettyError,
|
|
857
|
+
logError,
|
|
858
|
+
requiresSocket
|
|
859
|
+
} = options;
|
|
860
|
+
if ('id' in message) {
|
|
861
|
+
if ('method' in message) {
|
|
862
|
+
const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
863
|
+
try {
|
|
864
|
+
ipc.send(response);
|
|
865
|
+
} catch (error) {
|
|
866
|
+
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
867
|
+
ipc.send(errorResponse);
|
|
868
|
+
}
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
resolve(message.id, message);
|
|
872
|
+
return;
|
|
753
873
|
}
|
|
754
|
-
|
|
755
|
-
|
|
874
|
+
if ('method' in message) {
|
|
875
|
+
await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
876
|
+
return;
|
|
756
877
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
878
|
+
throw new JsonRpcError('unexpected message');
|
|
879
|
+
};
|
|
880
|
+
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
881
|
+
const {
|
|
882
|
+
message,
|
|
883
|
+
promise
|
|
884
|
+
} = create$2$2(method, params);
|
|
885
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
886
|
+
ipc.sendAndTransfer(message);
|
|
887
|
+
} else {
|
|
888
|
+
ipc.send(message);
|
|
760
889
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
return new IpcChildWithMessagePort(port);
|
|
764
|
-
};
|
|
765
|
-
const IpcChildWithMessagePort$1 = {
|
|
766
|
-
__proto__: null,
|
|
767
|
-
listen: listen$8,
|
|
768
|
-
signal: signal$9,
|
|
769
|
-
wrap: wrap$g
|
|
890
|
+
const responseMessage = await promise;
|
|
891
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
770
892
|
};
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
throw new TypeError('module is not in web worker scope');
|
|
775
|
-
}
|
|
776
|
-
return globalThis;
|
|
893
|
+
const send = (transport, method, ...params) => {
|
|
894
|
+
const message = create$4$1(method, params);
|
|
895
|
+
transport.send(message);
|
|
777
896
|
};
|
|
778
|
-
const
|
|
779
|
-
|
|
897
|
+
const invoke$a = (ipc, method, ...params) => {
|
|
898
|
+
return invokeHelper(ipc, method, params, false);
|
|
780
899
|
};
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
return getData$2(event);
|
|
784
|
-
}
|
|
785
|
-
send(message) {
|
|
786
|
-
// @ts-ignore
|
|
787
|
-
this._rawIpc.postMessage(message);
|
|
788
|
-
}
|
|
789
|
-
sendAndTransfer(message) {
|
|
790
|
-
const transfer = getTransferrables(message);
|
|
791
|
-
// @ts-ignore
|
|
792
|
-
this._rawIpc.postMessage(message, transfer);
|
|
793
|
-
}
|
|
794
|
-
dispose() {
|
|
795
|
-
// ignore
|
|
796
|
-
}
|
|
797
|
-
onClose(callback) {
|
|
798
|
-
// ignore
|
|
799
|
-
}
|
|
800
|
-
onMessage(callback) {
|
|
801
|
-
this._rawIpc.addEventListener('message', callback);
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
const wrap$f = global => {
|
|
805
|
-
return new IpcChildWithModuleWorker(global);
|
|
900
|
+
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
901
|
+
return invokeHelper(ipc, method, params, true);
|
|
806
902
|
};
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
wrap: wrap$f
|
|
903
|
+
|
|
904
|
+
const commands = Object.create(null);
|
|
905
|
+
const register = commandMap => {
|
|
906
|
+
Object.assign(commands, commandMap);
|
|
812
907
|
};
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
resolve,
|
|
816
|
-
promise
|
|
817
|
-
} = Promise.withResolvers();
|
|
818
|
-
port.addEventListener('message', resolve, {
|
|
819
|
-
once: true
|
|
820
|
-
});
|
|
821
|
-
const event = await promise;
|
|
822
|
-
// @ts-ignore
|
|
823
|
-
return event.data;
|
|
908
|
+
const getCommand = key => {
|
|
909
|
+
return commands[key];
|
|
824
910
|
};
|
|
825
|
-
const
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const firstMessage = await waitForFirstMessage$1(parentIpc);
|
|
830
|
-
if (firstMessage.method !== 'initialize') {
|
|
831
|
-
throw new IpcError$1('unexpected first message');
|
|
832
|
-
}
|
|
833
|
-
const type = firstMessage.params[0];
|
|
834
|
-
if (type === 'message-port') {
|
|
835
|
-
parentIpc.send({
|
|
836
|
-
jsonrpc: '2.0',
|
|
837
|
-
id: firstMessage.id,
|
|
838
|
-
result: null
|
|
839
|
-
});
|
|
840
|
-
parentIpc.dispose();
|
|
841
|
-
const port = firstMessage.params[1];
|
|
842
|
-
return port;
|
|
911
|
+
const execute$1 = (command, ...args) => {
|
|
912
|
+
const fn = getCommand(command);
|
|
913
|
+
if (!fn) {
|
|
914
|
+
throw new Error(`command not found ${command}`);
|
|
843
915
|
}
|
|
844
|
-
return
|
|
916
|
+
return fn(...args);
|
|
845
917
|
};
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
918
|
+
|
|
919
|
+
const createRpc = ipc => {
|
|
920
|
+
const rpc = {
|
|
921
|
+
// @ts-ignore
|
|
922
|
+
ipc,
|
|
923
|
+
/**
|
|
924
|
+
* @deprecated
|
|
925
|
+
*/
|
|
926
|
+
send(method, ...params) {
|
|
927
|
+
send(ipc, method, ...params);
|
|
928
|
+
},
|
|
929
|
+
invoke(method, ...params) {
|
|
930
|
+
return invoke$a(ipc, method, ...params);
|
|
931
|
+
},
|
|
932
|
+
invokeAndTransfer(method, ...params) {
|
|
933
|
+
return invokeAndTransfer$1(ipc, method, ...params);
|
|
934
|
+
},
|
|
935
|
+
async dispose() {
|
|
936
|
+
await ipc?.dispose();
|
|
860
937
|
}
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
// ignore
|
|
864
|
-
}
|
|
865
|
-
onMessage(callback) {
|
|
866
|
-
this._rawIpc.addEventListener('message', callback);
|
|
867
|
-
this._rawIpc.start();
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
const wrap$e = port => {
|
|
871
|
-
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
938
|
+
};
|
|
939
|
+
return rpc;
|
|
872
940
|
};
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
listen: listen$6,
|
|
876
|
-
wrap: wrap$e
|
|
941
|
+
const requiresSocket = () => {
|
|
942
|
+
return false;
|
|
877
943
|
};
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
emitter.addEventListener(type, callback);
|
|
881
|
-
} else {
|
|
882
|
-
emitter.on(type, callback);
|
|
883
|
-
}
|
|
944
|
+
const preparePrettyError = error => {
|
|
945
|
+
return error;
|
|
884
946
|
};
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
947
|
+
const logError$1 = () => {
|
|
948
|
+
// handled by renderer worker
|
|
949
|
+
};
|
|
950
|
+
const handleMessage = event => {
|
|
951
|
+
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
952
|
+
const actualExecute = event?.target?.execute || execute$1;
|
|
953
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError$1, actualRequiresSocket);
|
|
954
|
+
};
|
|
955
|
+
const handleIpc = ipc => {
|
|
956
|
+
if ('addEventListener' in ipc) {
|
|
957
|
+
ipc.addEventListener('message', handleMessage);
|
|
958
|
+
} else if ('on' in ipc) {
|
|
959
|
+
// deprecated
|
|
960
|
+
ipc.on('message', handleMessage);
|
|
890
961
|
}
|
|
891
962
|
};
|
|
892
|
-
const
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
} = Promise.withResolvers();
|
|
897
|
-
const listenerMap = Object.create(null);
|
|
898
|
-
const cleanup = value => {
|
|
899
|
-
for (const event of Object.keys(eventMap)) {
|
|
900
|
-
removeListener(eventEmitter, event, listenerMap[event]);
|
|
901
|
-
}
|
|
902
|
-
resolve(value);
|
|
903
|
-
};
|
|
904
|
-
for (const [event, type] of Object.entries(eventMap)) {
|
|
905
|
-
const listener = event => {
|
|
906
|
-
cleanup({
|
|
907
|
-
type,
|
|
908
|
-
event
|
|
909
|
-
});
|
|
910
|
-
};
|
|
911
|
-
addListener(eventEmitter, event, listener);
|
|
912
|
-
listenerMap[event] = listener;
|
|
963
|
+
const listen$1 = async (module, options) => {
|
|
964
|
+
const rawIpc = await module.listen(options);
|
|
965
|
+
if (module.signal) {
|
|
966
|
+
module.signal(rawIpc);
|
|
913
967
|
}
|
|
914
|
-
|
|
968
|
+
const ipc = module.wrap(rawIpc);
|
|
969
|
+
return ipc;
|
|
915
970
|
};
|
|
916
|
-
const
|
|
917
|
-
|
|
971
|
+
const create$9$1 = async ({
|
|
972
|
+
commandMap,
|
|
918
973
|
messagePort,
|
|
919
974
|
isMessagePortOpen
|
|
920
975
|
}) => {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}
|
|
927
|
-
const eventPromise = getFirstEvent(messagePort, {
|
|
928
|
-
message: Message$1
|
|
976
|
+
// TODO create a commandMap per rpc instance
|
|
977
|
+
register(commandMap);
|
|
978
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
979
|
+
messagePort,
|
|
980
|
+
isMessagePortOpen
|
|
929
981
|
});
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
} = await eventPromise;
|
|
935
|
-
if (type !== Message$1) {
|
|
936
|
-
throw new IpcError$1('Failed to wait for ipc message');
|
|
937
|
-
}
|
|
938
|
-
if (event.data !== readyMessage) {
|
|
939
|
-
throw new IpcError$1('unexpected first message');
|
|
940
|
-
}
|
|
941
|
-
return messagePort;
|
|
982
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
983
|
+
handleIpc(ipc);
|
|
984
|
+
const rpc = createRpc(ipc);
|
|
985
|
+
return rpc;
|
|
942
986
|
};
|
|
943
|
-
const
|
|
987
|
+
const MessagePortRpcParent = {
|
|
988
|
+
__proto__: null,
|
|
989
|
+
create: create$9$1
|
|
990
|
+
};
|
|
991
|
+
const create$3$1 = async ({
|
|
992
|
+
commandMap,
|
|
993
|
+
messagePort
|
|
994
|
+
}) => {
|
|
995
|
+
// TODO create a commandMap per rpc instance
|
|
996
|
+
register(commandMap);
|
|
997
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
998
|
+
messagePort,
|
|
999
|
+
isMessagePortOpen: true
|
|
1000
|
+
});
|
|
1001
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1002
|
+
handleIpc(ipc);
|
|
1003
|
+
const rpc = createRpc(ipc);
|
|
944
1004
|
messagePort.start();
|
|
1005
|
+
return rpc;
|
|
945
1006
|
};
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1007
|
+
const create$2$1 = async ({
|
|
1008
|
+
commandMap,
|
|
1009
|
+
messagePort
|
|
1010
|
+
}) => {
|
|
1011
|
+
return create$3$1({
|
|
1012
|
+
commandMap,
|
|
1013
|
+
messagePort
|
|
1014
|
+
});
|
|
1015
|
+
};
|
|
1016
|
+
const PlainMessagePortRpcParent = {
|
|
1017
|
+
__proto__: null,
|
|
1018
|
+
create: create$2$1
|
|
1019
|
+
};
|
|
1020
|
+
const create$a = async ({
|
|
1021
|
+
commandMap
|
|
1022
|
+
}) => {
|
|
1023
|
+
// TODO create a commandMap per rpc instance
|
|
1024
|
+
register(commandMap);
|
|
1025
|
+
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
1026
|
+
handleIpc(ipc);
|
|
1027
|
+
const rpc = createRpc(ipc);
|
|
1028
|
+
return rpc;
|
|
965
1029
|
};
|
|
966
|
-
const
|
|
1030
|
+
const WebWorkerRpcClient = {
|
|
967
1031
|
__proto__: null,
|
|
968
|
-
create: create$
|
|
969
|
-
signal: signal$1,
|
|
970
|
-
wrap: wrap$5
|
|
1032
|
+
create: create$a
|
|
971
1033
|
};
|
|
972
1034
|
|
|
973
|
-
const
|
|
974
|
-
|
|
1035
|
+
const rpcs = Object.create(null);
|
|
1036
|
+
const set$c = (id, rpc) => {
|
|
1037
|
+
rpcs[id] = rpc;
|
|
1038
|
+
};
|
|
1039
|
+
const get$6 = id => {
|
|
1040
|
+
return rpcs[id];
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1044
|
+
|
|
1045
|
+
const create$9 = rpcId => {
|
|
1046
|
+
return {
|
|
975
1047
|
// @ts-ignore
|
|
976
|
-
ipc,
|
|
977
|
-
/**
|
|
978
|
-
* @deprecated
|
|
979
|
-
*/
|
|
980
|
-
send(method, ...params) {
|
|
981
|
-
send(ipc, method, ...params);
|
|
982
|
-
},
|
|
983
1048
|
invoke(method, ...params) {
|
|
984
|
-
|
|
1049
|
+
const rpc = get$6(rpcId);
|
|
1050
|
+
// @ts-ignore
|
|
1051
|
+
return rpc.invoke(method, ...params);
|
|
985
1052
|
},
|
|
1053
|
+
// @ts-ignore
|
|
986
1054
|
invokeAndTransfer(method, ...params) {
|
|
987
|
-
|
|
1055
|
+
const rpc = get$6(rpcId);
|
|
1056
|
+
// @ts-ignore
|
|
1057
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
988
1058
|
},
|
|
989
|
-
|
|
990
|
-
|
|
1059
|
+
set(rpc) {
|
|
1060
|
+
set$c(rpcId, rpc);
|
|
991
1061
|
}
|
|
992
1062
|
};
|
|
993
|
-
return rpc;
|
|
994
1063
|
};
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
const
|
|
999
|
-
|
|
1064
|
+
const DebugWorker = 55;
|
|
1065
|
+
const EditorWorker$1 = 99;
|
|
1066
|
+
const ExtensionHostWorker = 44;
|
|
1067
|
+
const MainProcess$1 = -5;
|
|
1068
|
+
const RendererWorker$1 = 1;
|
|
1069
|
+
const SearchProcess$1 = 77;
|
|
1070
|
+
const SearchProcessElectron = 2;
|
|
1071
|
+
const SharedProcess$1 = 1;
|
|
1072
|
+
const SourceControlWorker = 66;
|
|
1073
|
+
const EmbedsProcess$1 = 207;
|
|
1074
|
+
const EmbedsWorker = 208;
|
|
1075
|
+
const FileSystemWorker$1 = 209;
|
|
1076
|
+
const FileSystemProcess$1 = 210;
|
|
1077
|
+
const MarkdownWorker$1 = 300;
|
|
1078
|
+
const CompletionWorker = 301;
|
|
1079
|
+
const ColorPickerWorker = 302;
|
|
1080
|
+
const SourceActionWorker = 303;
|
|
1081
|
+
const ErrorWorker$1 = 3308;
|
|
1082
|
+
const SyntaxHighlightingWorker$1 = 3309;
|
|
1083
|
+
const RpcId = {
|
|
1084
|
+
__proto__: null,
|
|
1085
|
+
ColorPickerWorker,
|
|
1086
|
+
CompletionWorker,
|
|
1087
|
+
DebugWorker,
|
|
1088
|
+
EditorWorker: EditorWorker$1,
|
|
1089
|
+
EmbedsProcess: EmbedsProcess$1,
|
|
1090
|
+
EmbedsWorker,
|
|
1091
|
+
ErrorWorker: ErrorWorker$1,
|
|
1092
|
+
ExtensionHostWorker,
|
|
1093
|
+
FileSystemProcess: FileSystemProcess$1,
|
|
1094
|
+
FileSystemWorker: FileSystemWorker$1,
|
|
1095
|
+
MainProcess: MainProcess$1,
|
|
1096
|
+
MarkdownWorker: MarkdownWorker$1,
|
|
1097
|
+
RendererWorker: RendererWorker$1,
|
|
1098
|
+
SearchProcess: SearchProcess$1,
|
|
1099
|
+
SearchProcessElectron,
|
|
1100
|
+
SharedProcess: SharedProcess$1,
|
|
1101
|
+
SourceActionWorker,
|
|
1102
|
+
SourceControlWorker,
|
|
1103
|
+
SyntaxHighlightingWorker: SyntaxHighlightingWorker$1
|
|
1000
1104
|
};
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1105
|
+
const {
|
|
1106
|
+
invoke: invoke$8,
|
|
1107
|
+
set: set$8$1
|
|
1108
|
+
} = create$9(ExtensionHostWorker);
|
|
1109
|
+
const ExtensionHost = {
|
|
1110
|
+
__proto__: null,
|
|
1111
|
+
invoke: invoke$8,
|
|
1112
|
+
set: set$8$1
|
|
1003
1113
|
};
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1114
|
+
const {
|
|
1115
|
+
invoke: invoke$3$1,
|
|
1116
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1117
|
+
set: set$3$1
|
|
1118
|
+
} = create$9(RendererWorker$1);
|
|
1119
|
+
const RendererWorker = {
|
|
1120
|
+
__proto__: null,
|
|
1121
|
+
invoke: invoke$3$1,
|
|
1122
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1123
|
+
set: set$3$1
|
|
1008
1124
|
};
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1125
|
+
const {
|
|
1126
|
+
invoke: invoke$9,
|
|
1127
|
+
set: set$9
|
|
1128
|
+
} = create$9(MarkdownWorker$1);
|
|
1129
|
+
const SyntaxHighlightingWorker = {
|
|
1130
|
+
__proto__: null,
|
|
1131
|
+
invoke: invoke$9,
|
|
1132
|
+
set: set$9
|
|
1016
1133
|
};
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
});
|
|
1028
|
-
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1029
|
-
handleIpc$1(ipc);
|
|
1030
|
-
const rpc = createRpc$1(ipc);
|
|
1031
|
-
return rpc;
|
|
1134
|
+
|
|
1135
|
+
const {
|
|
1136
|
+
set: set$8,
|
|
1137
|
+
invoke: invoke$7,
|
|
1138
|
+
invokeAndTransfer
|
|
1139
|
+
} = RendererWorker;
|
|
1140
|
+
|
|
1141
|
+
// TODO add tests for this
|
|
1142
|
+
const activateByEvent = async event => {
|
|
1143
|
+
await invoke$7('ExtensionHostManagement.activateByEvent', event);
|
|
1032
1144
|
};
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1145
|
+
|
|
1146
|
+
const codeGeneratorAccept = state => {
|
|
1147
|
+
// TODO close code generator widget
|
|
1148
|
+
return state;
|
|
1036
1149
|
};
|
|
1037
1150
|
|
|
1038
1151
|
const getPortTuple = () => {
|
|
@@ -1048,15 +1161,15 @@ const getPortTuple = () => {
|
|
|
1048
1161
|
|
|
1049
1162
|
const ModuleWorkerAndWorkaroundForChromeDevtoolsBug = 6;
|
|
1050
1163
|
|
|
1051
|
-
const
|
|
1052
|
-
const name = 'Color Picker Worker';
|
|
1164
|
+
const launchWorker = async (name, url) => {
|
|
1053
1165
|
const {
|
|
1054
1166
|
port1,
|
|
1055
1167
|
port2
|
|
1056
1168
|
} = getPortTuple();
|
|
1169
|
+
// @ts-ignore
|
|
1057
1170
|
await invokeAndTransfer('IpcParent.create', {
|
|
1058
1171
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
1059
|
-
url
|
|
1172
|
+
url,
|
|
1060
1173
|
name: name,
|
|
1061
1174
|
raw: true,
|
|
1062
1175
|
port: port1
|
|
@@ -1070,15 +1183,21 @@ const launchColorPickerWorker = async () => {
|
|
|
1070
1183
|
return rpc;
|
|
1071
1184
|
};
|
|
1072
1185
|
|
|
1073
|
-
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
-
|
|
1186
|
+
const launchColorPickerWorker = async () => {
|
|
1187
|
+
const name = 'Color Picker Worker';
|
|
1188
|
+
const url = 'colorPickerWorkerMain.js';
|
|
1189
|
+
return launchWorker(name, url);
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
let workerPromise$4;
|
|
1193
|
+
const getOrCreate$5 = () => {
|
|
1194
|
+
if (!workerPromise$4) {
|
|
1195
|
+
workerPromise$4 = launchColorPickerWorker();
|
|
1077
1196
|
}
|
|
1078
|
-
return workerPromise$
|
|
1197
|
+
return workerPromise$4;
|
|
1079
1198
|
};
|
|
1080
1199
|
const invoke$6 = async (method, ...params) => {
|
|
1081
|
-
const worker = await getOrCreate$
|
|
1200
|
+
const worker = await getOrCreate$5();
|
|
1082
1201
|
return await worker.invoke(method, ...params);
|
|
1083
1202
|
};
|
|
1084
1203
|
|
|
@@ -1118,19 +1237,19 @@ const LineComment = 'lineComment';
|
|
|
1118
1237
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1119
1238
|
|
|
1120
1239
|
const map$1 = Object.create(null);
|
|
1121
|
-
const set$
|
|
1240
|
+
const set$7 = (id, widget) => {
|
|
1122
1241
|
map$1[id] = widget;
|
|
1123
1242
|
};
|
|
1124
1243
|
const get$5 = id => {
|
|
1125
1244
|
return map$1[id];
|
|
1126
1245
|
};
|
|
1127
1246
|
|
|
1128
|
-
const getModule
|
|
1247
|
+
const getModule = id => {
|
|
1129
1248
|
return get$5(id);
|
|
1130
1249
|
};
|
|
1131
1250
|
|
|
1132
1251
|
const applyWidgetChange = async (editor, widget, changes) => {
|
|
1133
|
-
const module = getModule
|
|
1252
|
+
const module = getModule(widget.id);
|
|
1134
1253
|
if (changes.length === 1 && changes[0].origin === EditorType && module.handleEditorType) {
|
|
1135
1254
|
const newState = await module.handleEditorType(widget.newState);
|
|
1136
1255
|
return {
|
|
@@ -1168,7 +1287,7 @@ const get$4 = id => {
|
|
|
1168
1287
|
number(id);
|
|
1169
1288
|
return editors[id];
|
|
1170
1289
|
};
|
|
1171
|
-
const set$
|
|
1290
|
+
const set$6 = (id, oldEditor, newEditor) => {
|
|
1172
1291
|
object(oldEditor);
|
|
1173
1292
|
object(newEditor);
|
|
1174
1293
|
editors[id] = {
|
|
@@ -1498,7 +1617,7 @@ const createMeasureContext = () => {
|
|
|
1498
1617
|
const state$8 = {
|
|
1499
1618
|
ctx: undefined
|
|
1500
1619
|
};
|
|
1501
|
-
const getOrCreate$
|
|
1620
|
+
const getOrCreate$4 = createCtx => {
|
|
1502
1621
|
if (state$8.ctx) {
|
|
1503
1622
|
return state$8.ctx;
|
|
1504
1623
|
}
|
|
@@ -1507,7 +1626,7 @@ const getOrCreate$3 = createCtx => {
|
|
|
1507
1626
|
};
|
|
1508
1627
|
|
|
1509
1628
|
const getContext = () => {
|
|
1510
|
-
const ctx = getOrCreate$
|
|
1629
|
+
const ctx = getOrCreate$4(createMeasureContext);
|
|
1511
1630
|
return ctx;
|
|
1512
1631
|
};
|
|
1513
1632
|
|
|
@@ -1908,7 +2027,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
1908
2027
|
invalidStartIndex,
|
|
1909
2028
|
autoClosingRanges
|
|
1910
2029
|
};
|
|
1911
|
-
set$
|
|
2030
|
+
set$6(editor.uid, editor, newEditor);
|
|
1912
2031
|
const newWidgets = await applyWidgetChanges(newEditor, changes);
|
|
1913
2032
|
const newEditor2 = {
|
|
1914
2033
|
...newEditor,
|
|
@@ -1972,343 +2091,65 @@ const scheduleDocument = async (editor, changes) => {
|
|
|
1972
2091
|
// /* scrollBarHeight */ scrollBarHeight,
|
|
1973
2092
|
// /* textInfos */ textInfos,
|
|
1974
2093
|
// /* cursorInfos */ cursorInfos,
|
|
1975
|
-
// /* selectionInfos */ selectionInfos,
|
|
1976
|
-
// ])
|
|
1977
|
-
};
|
|
1978
|
-
const hasSelection = editor => {
|
|
1979
|
-
// TODO editor.selections should always be defined
|
|
1980
|
-
return editor.selections && editor.selections.length > 0;
|
|
1981
|
-
};
|
|
1982
|
-
const setBounds = (editor, x, y, width, height, columnWidth) => {
|
|
1983
|
-
const {
|
|
1984
|
-
itemHeight
|
|
1985
|
-
} = editor;
|
|
1986
|
-
const numberOfVisibleLines = Math.floor(height / itemHeight);
|
|
1987
|
-
const total = editor.lines.length;
|
|
1988
|
-
const maxLineY = Math.min(numberOfVisibleLines, total);
|
|
1989
|
-
const finalY = Math.max(total - numberOfVisibleLines, 0);
|
|
1990
|
-
const finalDeltaY = finalY * itemHeight;
|
|
1991
|
-
return {
|
|
1992
|
-
...editor,
|
|
1993
|
-
x,
|
|
1994
|
-
y,
|
|
1995
|
-
width,
|
|
1996
|
-
height,
|
|
1997
|
-
columnWidth,
|
|
1998
|
-
numberOfVisibleLines,
|
|
1999
|
-
maxLineY,
|
|
2000
|
-
finalY,
|
|
2001
|
-
finalDeltaY
|
|
2002
|
-
};
|
|
2003
|
-
};
|
|
2004
|
-
const setText = (editor, text) => {
|
|
2005
|
-
const lines = splitLines(text);
|
|
2006
|
-
const {
|
|
2007
|
-
itemHeight,
|
|
2008
|
-
numberOfVisibleLines,
|
|
2009
|
-
minimumSliderSize
|
|
2010
|
-
} = editor;
|
|
2011
|
-
const total = lines.length;
|
|
2012
|
-
const maxLineY = Math.min(numberOfVisibleLines, total);
|
|
2013
|
-
const finalY = Math.max(total - numberOfVisibleLines, 0);
|
|
2014
|
-
const finalDeltaY = finalY * itemHeight;
|
|
2015
|
-
const contentHeight = lines.length * editor.rowHeight;
|
|
2016
|
-
const scrollBarHeight = getScrollBarSize(editor.height, contentHeight, minimumSliderSize);
|
|
2017
|
-
return {
|
|
2018
|
-
...editor,
|
|
2019
|
-
lines,
|
|
2020
|
-
maxLineY,
|
|
2021
|
-
finalY,
|
|
2022
|
-
finalDeltaY,
|
|
2023
|
-
scrollBarHeight
|
|
2024
|
-
};
|
|
2025
|
-
};
|
|
2026
|
-
|
|
2027
|
-
const HoverExecute = 'ExtensionHostHover.execute';
|
|
2028
|
-
const TabCompletionExecuteTabCompletionProvider = 'ExtensionHost.executeTabCompletionProvider';
|
|
2029
|
-
const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
2030
|
-
|
|
2031
|
-
const requiresSocket = () => {
|
|
2032
|
-
return false;
|
|
2033
|
-
};
|
|
2034
|
-
const preparePrettyError = error => {
|
|
2035
|
-
return error;
|
|
2036
|
-
};
|
|
2037
|
-
const logError$1 = error => {
|
|
2038
|
-
// handled in renderer worker
|
|
2039
|
-
};
|
|
2040
|
-
const handleMessage = async event => {
|
|
2041
|
-
return handleJsonRpcMessage(event.target, event.data, execute$1, resolve, preparePrettyError, logError$1, requiresSocket);
|
|
2042
|
-
};
|
|
2043
|
-
|
|
2044
|
-
const handleIpc = ipc => {
|
|
2045
|
-
if ('addEventListener' in ipc) {
|
|
2046
|
-
ipc.addEventListener('message', handleMessage);
|
|
2047
|
-
} else {
|
|
2048
|
-
// deprecated
|
|
2049
|
-
ipc.onmessage = handleMessage;
|
|
2050
|
-
}
|
|
2051
|
-
};
|
|
2052
|
-
|
|
2053
|
-
const RendererProcess = 9;
|
|
2054
|
-
const ExtensionHostWorker = 10;
|
|
2055
|
-
const SyntaxHighlightingWorker = 11;
|
|
2056
|
-
|
|
2057
|
-
// @ts-ignore
|
|
2058
|
-
const getData = event => {
|
|
2059
|
-
return event.data;
|
|
2060
|
-
};
|
|
2061
|
-
|
|
2062
|
-
class IpcError extends Error {
|
|
2063
|
-
constructor(message) {
|
|
2064
|
-
super(message);
|
|
2065
|
-
this.name = 'IpcError';
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
|
-
const sendMessagePortToExtensionHostWorker = async port => {
|
|
2070
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
2071
|
-
};
|
|
2072
|
-
const sendMessagePortToExtensionHostWorker2 = async (port, initialCommand, rpcId) => {
|
|
2073
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, initialCommand, rpcId);
|
|
2074
|
-
};
|
|
2075
|
-
|
|
2076
|
-
const withResolvers = () => {
|
|
2077
|
-
let _resolve;
|
|
2078
|
-
const promise = new Promise(resolve => {
|
|
2079
|
-
_resolve = resolve;
|
|
2080
|
-
});
|
|
2081
|
-
return {
|
|
2082
|
-
resolve: _resolve,
|
|
2083
|
-
promise
|
|
2084
|
-
};
|
|
2085
|
-
};
|
|
2086
|
-
|
|
2087
|
-
const waitForFirstMessage = async port => {
|
|
2088
|
-
const {
|
|
2089
|
-
resolve,
|
|
2090
|
-
promise
|
|
2091
|
-
} = withResolvers();
|
|
2092
|
-
const cleanup = value => {
|
|
2093
|
-
port.onmessage = null;
|
|
2094
|
-
resolve(value);
|
|
2095
|
-
};
|
|
2096
|
-
const handleMessage = event => {
|
|
2097
|
-
cleanup(event);
|
|
2098
|
-
};
|
|
2099
|
-
port.onmessage = handleMessage;
|
|
2100
|
-
const event = await promise;
|
|
2101
|
-
return event;
|
|
2102
|
-
};
|
|
2103
|
-
|
|
2104
|
-
const create$c = async () => {
|
|
2105
|
-
const {
|
|
2106
|
-
port1,
|
|
2107
|
-
port2
|
|
2108
|
-
} = getPortTuple();
|
|
2109
|
-
await sendMessagePortToExtensionHostWorker(port1);
|
|
2110
|
-
const event = await waitForFirstMessage(port2);
|
|
2111
|
-
if (event.data !== 'ready') {
|
|
2112
|
-
throw new IpcError('unexpected first message');
|
|
2113
|
-
}
|
|
2114
|
-
return port2;
|
|
2115
|
-
};
|
|
2116
|
-
const wrap$2 = port => {
|
|
2117
|
-
return {
|
|
2118
|
-
port,
|
|
2119
|
-
/**
|
|
2120
|
-
* @type {any}
|
|
2121
|
-
*/
|
|
2122
|
-
listener: undefined,
|
|
2123
|
-
get onmessage() {
|
|
2124
|
-
return this.listener;
|
|
2125
|
-
},
|
|
2126
|
-
set onmessage(listener) {
|
|
2127
|
-
this.listener = listener;
|
|
2128
|
-
const wrappedListener = event => {
|
|
2129
|
-
const data = getData(event);
|
|
2130
|
-
// @ts-ignore
|
|
2131
|
-
listener({
|
|
2132
|
-
target: this,
|
|
2133
|
-
data
|
|
2134
|
-
});
|
|
2135
|
-
};
|
|
2136
|
-
this.port.onmessage = wrappedListener;
|
|
2137
|
-
},
|
|
2138
|
-
send(message) {
|
|
2139
|
-
this.port.postMessage(message);
|
|
2140
|
-
},
|
|
2141
|
-
sendAndTransfer(message, transfer) {
|
|
2142
|
-
this.port.postMessage(message, transfer);
|
|
2143
|
-
}
|
|
2144
|
-
};
|
|
2145
|
-
};
|
|
2146
|
-
|
|
2147
|
-
const IpcParentWithExtensionHostWorker = {
|
|
2148
|
-
__proto__: null,
|
|
2149
|
-
create: create$c,
|
|
2150
|
-
wrap: wrap$2
|
|
2151
|
-
};
|
|
2152
|
-
|
|
2153
|
-
const sendMessagePortToRendererProcess = async port => {
|
|
2154
|
-
await invokeAndTransfer('SendMessagePortToRendererProcess.sendMessagePortToRendererProcess', port, 'HandleMessagePort.handleMessagePort');
|
|
2155
|
-
};
|
|
2156
|
-
|
|
2157
|
-
const create$b = async () => {
|
|
2158
|
-
const {
|
|
2159
|
-
port1,
|
|
2160
|
-
port2
|
|
2161
|
-
} = getPortTuple();
|
|
2162
|
-
await sendMessagePortToRendererProcess(port1);
|
|
2163
|
-
const event = await waitForFirstMessage(port2);
|
|
2164
|
-
if (event.data !== 'ready') {
|
|
2165
|
-
throw new IpcError('unexpected first message');
|
|
2166
|
-
}
|
|
2167
|
-
return port2;
|
|
2168
|
-
};
|
|
2169
|
-
const wrap$1 = port => {
|
|
2170
|
-
return {
|
|
2171
|
-
port,
|
|
2172
|
-
/**
|
|
2173
|
-
* @type {any}
|
|
2174
|
-
*/
|
|
2175
|
-
listener: undefined,
|
|
2176
|
-
get onmessage() {
|
|
2177
|
-
return this.listener;
|
|
2178
|
-
},
|
|
2179
|
-
set onmessage(listener) {
|
|
2180
|
-
this.listener = listener;
|
|
2181
|
-
const wrappedListener = event => {
|
|
2182
|
-
const data = getData(event);
|
|
2183
|
-
// @ts-ignore
|
|
2184
|
-
listener({
|
|
2185
|
-
target: this,
|
|
2186
|
-
data
|
|
2187
|
-
});
|
|
2188
|
-
};
|
|
2189
|
-
this.port.onmessage = wrappedListener;
|
|
2190
|
-
},
|
|
2191
|
-
send(message) {
|
|
2192
|
-
this.port.postMessage(message);
|
|
2193
|
-
},
|
|
2194
|
-
sendAndTransfer(message, transfer) {
|
|
2195
|
-
this.port.postMessage(message, transfer);
|
|
2196
|
-
}
|
|
2197
|
-
};
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
const IpcParentWithRendererProcess = {
|
|
2201
|
-
__proto__: null,
|
|
2202
|
-
create: create$b,
|
|
2203
|
-
wrap: wrap$1
|
|
2204
|
-
};
|
|
2205
|
-
|
|
2206
|
-
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
2207
|
-
await invokeAndTransfer('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
2208
|
-
};
|
|
2209
|
-
|
|
2210
|
-
const create$a = async () => {
|
|
2211
|
-
const {
|
|
2212
|
-
port1,
|
|
2213
|
-
port2
|
|
2214
|
-
} = getPortTuple();
|
|
2215
|
-
await sendMessagePortToSyntaxHighlightingWorker(port1);
|
|
2216
|
-
const event = await waitForFirstMessage(port2);
|
|
2217
|
-
if (event.data !== 'ready') {
|
|
2218
|
-
throw new IpcError('unexpected first message');
|
|
2219
|
-
}
|
|
2220
|
-
return port2;
|
|
2221
|
-
};
|
|
2222
|
-
const wrap = port => {
|
|
2223
|
-
return {
|
|
2224
|
-
port,
|
|
2225
|
-
/**
|
|
2226
|
-
* @type {any}
|
|
2227
|
-
*/
|
|
2228
|
-
listener: undefined,
|
|
2229
|
-
get onmessage() {
|
|
2230
|
-
return this.listener;
|
|
2231
|
-
},
|
|
2232
|
-
set onmessage(listener) {
|
|
2233
|
-
this.listener = listener;
|
|
2234
|
-
const wrappedListener = event => {
|
|
2235
|
-
const data = getData(event);
|
|
2236
|
-
// @ts-ignore
|
|
2237
|
-
listener({
|
|
2238
|
-
target: this,
|
|
2239
|
-
data
|
|
2240
|
-
});
|
|
2241
|
-
};
|
|
2242
|
-
this.port.onmessage = wrappedListener;
|
|
2243
|
-
},
|
|
2244
|
-
send(message) {
|
|
2245
|
-
this.port.postMessage(message);
|
|
2246
|
-
},
|
|
2247
|
-
sendAndTransfer(message, transfer) {
|
|
2248
|
-
this.port.postMessage(message, transfer);
|
|
2249
|
-
}
|
|
2250
|
-
};
|
|
2251
|
-
};
|
|
2252
|
-
|
|
2253
|
-
const IpcParentWithSyntaxHighlightingWorker = {
|
|
2254
|
-
__proto__: null,
|
|
2255
|
-
create: create$a,
|
|
2256
|
-
wrap
|
|
2257
|
-
};
|
|
2258
|
-
|
|
2259
|
-
const getModule$1 = method => {
|
|
2260
|
-
switch (method) {
|
|
2261
|
-
case RendererProcess:
|
|
2262
|
-
return IpcParentWithRendererProcess;
|
|
2263
|
-
case ExtensionHostWorker:
|
|
2264
|
-
return IpcParentWithExtensionHostWorker;
|
|
2265
|
-
case SyntaxHighlightingWorker:
|
|
2266
|
-
return IpcParentWithSyntaxHighlightingWorker;
|
|
2267
|
-
default:
|
|
2268
|
-
throw new Error('unexpected ipc type');
|
|
2269
|
-
}
|
|
2094
|
+
// /* selectionInfos */ selectionInfos,
|
|
2095
|
+
// ])
|
|
2270
2096
|
};
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
...options
|
|
2275
|
-
}) => {
|
|
2276
|
-
const module = getModule$1(method);
|
|
2277
|
-
// @ts-ignore
|
|
2278
|
-
const rawIpc = await module.create(options);
|
|
2279
|
-
// @ts-ignore
|
|
2280
|
-
if (options.raw) {
|
|
2281
|
-
return rawIpc;
|
|
2282
|
-
}
|
|
2283
|
-
const ipc = module.wrap(rawIpc);
|
|
2284
|
-
return ipc;
|
|
2097
|
+
const hasSelection = editor => {
|
|
2098
|
+
// TODO editor.selections should always be defined
|
|
2099
|
+
return editor.selections && editor.selections.length > 0;
|
|
2285
2100
|
};
|
|
2286
|
-
|
|
2287
|
-
const
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2101
|
+
const setBounds = (editor, x, y, width, height, columnWidth) => {
|
|
2102
|
+
const {
|
|
2103
|
+
itemHeight
|
|
2104
|
+
} = editor;
|
|
2105
|
+
const numberOfVisibleLines = Math.floor(height / itemHeight);
|
|
2106
|
+
const total = editor.lines.length;
|
|
2107
|
+
const maxLineY = Math.min(numberOfVisibleLines, total);
|
|
2108
|
+
const finalY = Math.max(total - numberOfVisibleLines, 0);
|
|
2109
|
+
const finalDeltaY = finalY * itemHeight;
|
|
2110
|
+
return {
|
|
2111
|
+
...editor,
|
|
2112
|
+
x,
|
|
2113
|
+
y,
|
|
2114
|
+
width,
|
|
2115
|
+
height,
|
|
2116
|
+
columnWidth,
|
|
2117
|
+
numberOfVisibleLines,
|
|
2118
|
+
maxLineY,
|
|
2119
|
+
finalY,
|
|
2120
|
+
finalDeltaY
|
|
2301
2121
|
};
|
|
2122
|
+
};
|
|
2123
|
+
const setText = (editor, text) => {
|
|
2124
|
+
const lines = splitLines(text);
|
|
2125
|
+
const {
|
|
2126
|
+
itemHeight,
|
|
2127
|
+
numberOfVisibleLines,
|
|
2128
|
+
minimumSliderSize
|
|
2129
|
+
} = editor;
|
|
2130
|
+
const total = lines.length;
|
|
2131
|
+
const maxLineY = Math.min(numberOfVisibleLines, total);
|
|
2132
|
+
const finalY = Math.max(total - numberOfVisibleLines, 0);
|
|
2133
|
+
const finalDeltaY = finalY * itemHeight;
|
|
2134
|
+
const contentHeight = lines.length * editor.rowHeight;
|
|
2135
|
+
const scrollBarHeight = getScrollBarSize(editor.height, contentHeight, minimumSliderSize);
|
|
2302
2136
|
return {
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2137
|
+
...editor,
|
|
2138
|
+
lines,
|
|
2139
|
+
maxLineY,
|
|
2140
|
+
finalY,
|
|
2141
|
+
finalDeltaY,
|
|
2142
|
+
scrollBarHeight
|
|
2306
2143
|
};
|
|
2307
2144
|
};
|
|
2308
2145
|
|
|
2146
|
+
const HoverExecute = 'ExtensionHostHover.execute';
|
|
2147
|
+
const TabCompletionExecuteTabCompletionProvider = 'ExtensionHost.executeTabCompletionProvider';
|
|
2148
|
+
const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
2149
|
+
|
|
2309
2150
|
const {
|
|
2310
|
-
|
|
2311
|
-
invoke: invoke$5} =
|
|
2151
|
+
set: set$5,
|
|
2152
|
+
invoke: invoke$5} = ExtensionHost;
|
|
2312
2153
|
|
|
2313
2154
|
const ColorPicker$1 = 41;
|
|
2314
2155
|
const EditorCompletion = 9;
|
|
@@ -2404,6 +2245,7 @@ const updateDiagnostics = async newState => {
|
|
|
2404
2245
|
|
|
2405
2246
|
// TODO don't really need text document sync response
|
|
2406
2247
|
// could perhaps save a lot of messages by using send instead of invoke
|
|
2248
|
+
// @ts-ignore
|
|
2407
2249
|
await invoke$5(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
|
|
2408
2250
|
const diagnostics = await executeDiagnosticProvider(newState);
|
|
2409
2251
|
const latest = get$4(newState.id);
|
|
@@ -2416,7 +2258,8 @@ const updateDiagnostics = async newState => {
|
|
|
2416
2258
|
diagnostics,
|
|
2417
2259
|
decorations
|
|
2418
2260
|
};
|
|
2419
|
-
set$
|
|
2261
|
+
set$6(newState.id, latest.oldState, newEditor);
|
|
2262
|
+
// @ts-ignore
|
|
2420
2263
|
await invoke$7('Editor.rerender', newState.id);
|
|
2421
2264
|
return newEditor;
|
|
2422
2265
|
} catch (error) {
|
|
@@ -2450,7 +2293,9 @@ const emptyEditor = {
|
|
|
2450
2293
|
undoStack: [],
|
|
2451
2294
|
lineCache: [],
|
|
2452
2295
|
selections: new Uint32Array(),
|
|
2453
|
-
diagnostics: []
|
|
2296
|
+
diagnostics: [],
|
|
2297
|
+
highlightedLine: -1,
|
|
2298
|
+
debugEnabled: false
|
|
2454
2299
|
};
|
|
2455
2300
|
const createEditor = async ({
|
|
2456
2301
|
id,
|
|
@@ -2550,7 +2395,8 @@ const createEditor = async ({
|
|
|
2550
2395
|
...newEditor3,
|
|
2551
2396
|
focused: true
|
|
2552
2397
|
};
|
|
2553
|
-
set$
|
|
2398
|
+
set$6(id, emptyEditor, newEditor4);
|
|
2399
|
+
// @ts-ignore
|
|
2554
2400
|
await invoke$5(TextDocumentSyncFull, uri, id, languageId, content);
|
|
2555
2401
|
if (diagnosticsEnabled) {
|
|
2556
2402
|
updateDiagnostics(newEditor4);
|
|
@@ -2620,7 +2466,7 @@ const applyEdit = async (editor, changes) => {
|
|
|
2620
2466
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
2621
2467
|
};
|
|
2622
2468
|
|
|
2623
|
-
const handleBlur = editor => {
|
|
2469
|
+
const handleBlur$1 = editor => {
|
|
2624
2470
|
if (editor.focusKey !== Empty) {
|
|
2625
2471
|
return editor;
|
|
2626
2472
|
}
|
|
@@ -2862,6 +2708,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
2862
2708
|
const x$1 = x(editor, rowIndex, columnIndex);
|
|
2863
2709
|
const y$1 = y(editor, rowIndex);
|
|
2864
2710
|
const displayErrorMessage = message;
|
|
2711
|
+
// @ts-ignore
|
|
2865
2712
|
await invoke$7('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
|
|
2866
2713
|
if (!isError) {
|
|
2867
2714
|
const handleTimeout = () => {
|
|
@@ -2918,6 +2765,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
2918
2765
|
try {
|
|
2919
2766
|
// @ts-ignore
|
|
2920
2767
|
const offset = offsetAt(editor, editor.cursor);
|
|
2768
|
+
// @ts-ignore
|
|
2921
2769
|
const result = await invoke$7('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
2922
2770
|
if (result) {
|
|
2923
2771
|
const closingBrace = getMatchingClosingBrace$1(text);
|
|
@@ -3011,35 +2859,19 @@ const closeFind = editor => {
|
|
|
3011
2859
|
|
|
3012
2860
|
const launchRenameWorker = async () => {
|
|
3013
2861
|
const name = 'Rename Worker';
|
|
3014
|
-
const
|
|
3015
|
-
|
|
3016
|
-
port2
|
|
3017
|
-
} = getPortTuple();
|
|
3018
|
-
await invokeAndTransfer('IpcParent.create', {
|
|
3019
|
-
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
3020
|
-
url: 'renameWorkerMain.js',
|
|
3021
|
-
name: name,
|
|
3022
|
-
raw: true,
|
|
3023
|
-
port: port1
|
|
3024
|
-
});
|
|
3025
|
-
const rpc = await MessagePortRpcParent.create({
|
|
3026
|
-
commandMap: {},
|
|
3027
|
-
messagePort: port2,
|
|
3028
|
-
isMessagePortOpen: true
|
|
3029
|
-
});
|
|
3030
|
-
port2.start();
|
|
3031
|
-
return rpc;
|
|
2862
|
+
const url = 'renameWorkerMain.js';
|
|
2863
|
+
return launchWorker(name, url);
|
|
3032
2864
|
};
|
|
3033
2865
|
|
|
3034
|
-
let workerPromise$
|
|
3035
|
-
const getOrCreate$
|
|
3036
|
-
if (!workerPromise$
|
|
3037
|
-
workerPromise$
|
|
2866
|
+
let workerPromise$3;
|
|
2867
|
+
const getOrCreate$3 = () => {
|
|
2868
|
+
if (!workerPromise$3) {
|
|
2869
|
+
workerPromise$3 = launchRenameWorker();
|
|
3038
2870
|
}
|
|
3039
|
-
return workerPromise$
|
|
2871
|
+
return workerPromise$3;
|
|
3040
2872
|
};
|
|
3041
2873
|
const invoke$4 = async (method, ...params) => {
|
|
3042
|
-
const worker = await getOrCreate$
|
|
2874
|
+
const worker = await getOrCreate$3();
|
|
3043
2875
|
return await worker.invoke(method, ...params);
|
|
3044
2876
|
};
|
|
3045
2877
|
|
|
@@ -3093,6 +2925,7 @@ const hasWidget = (widgets, id) => {
|
|
|
3093
2925
|
};
|
|
3094
2926
|
|
|
3095
2927
|
const setAdditionalFocus = async focusKey => {
|
|
2928
|
+
// @ts-ignore
|
|
3096
2929
|
await invoke$7('Focus.setAdditionalFocus', focusKey);
|
|
3097
2930
|
};
|
|
3098
2931
|
|
|
@@ -3106,6 +2939,7 @@ const unsetAdditionalFocus = async focusKey => {
|
|
|
3106
2939
|
if (!focusKey) {
|
|
3107
2940
|
return;
|
|
3108
2941
|
}
|
|
2942
|
+
// @ts-ignore
|
|
3109
2943
|
await invoke$7('Focus.removeAdditionalFocus', focusKey);
|
|
3110
2944
|
};
|
|
3111
2945
|
|
|
@@ -3861,6 +3695,7 @@ const deleteWordRight = editor => {
|
|
|
3861
3695
|
};
|
|
3862
3696
|
|
|
3863
3697
|
const findAllReferences = async editor => {
|
|
3698
|
+
// @ts-ignore
|
|
3864
3699
|
await invoke$7('SideBar.show', 'References', /* focus */true);
|
|
3865
3700
|
return editor;
|
|
3866
3701
|
};
|
|
@@ -3991,6 +3826,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
|
|
|
3991
3826
|
|
|
3992
3827
|
// @ts-ignore
|
|
3993
3828
|
const getDefinition = async (editor, offset) => {
|
|
3829
|
+
// @ts-ignore
|
|
3994
3830
|
const definition = await invoke$7('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
|
|
3995
3831
|
return definition;
|
|
3996
3832
|
};
|
|
@@ -4251,6 +4087,7 @@ const getNoLocationFoundMessage = info => {
|
|
|
4251
4087
|
};
|
|
4252
4088
|
|
|
4253
4089
|
const getTypeDefinition = async (editor, offset) => {
|
|
4090
|
+
// @ts-ignore
|
|
4254
4091
|
const definition = await invoke$7('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
|
|
4255
4092
|
return definition;
|
|
4256
4093
|
};
|
|
@@ -4326,7 +4163,7 @@ const handleDoubleClick = (editor, modifier, x, y) => {
|
|
|
4326
4163
|
};
|
|
4327
4164
|
|
|
4328
4165
|
const WhenExpressionEditorText = 12;
|
|
4329
|
-
const handleFocus = editor => {
|
|
4166
|
+
const handleFocus$1 = editor => {
|
|
4330
4167
|
// TODO make change events functional,
|
|
4331
4168
|
// when rendering, send focus changes to renderer worker
|
|
4332
4169
|
invoke$7('Focus.setFocus', WhenExpressionEditorText);
|
|
@@ -4492,7 +4329,7 @@ const state$4 = {
|
|
|
4492
4329
|
const get$3 = () => {
|
|
4493
4330
|
return state$4;
|
|
4494
4331
|
};
|
|
4495
|
-
const set$
|
|
4332
|
+
const set$4 = (editor, timeout, x, y) => {
|
|
4496
4333
|
state$4.editor = editor;
|
|
4497
4334
|
state$4.timeout = timeout;
|
|
4498
4335
|
state$4.x = x;
|
|
@@ -4534,7 +4371,7 @@ const handleMouseMove = (editor, x, y) => {
|
|
|
4534
4371
|
clearTimeout(oldState.timeout);
|
|
4535
4372
|
}
|
|
4536
4373
|
const timeout = setTimeout(onHoverIdle, hoverDelay);
|
|
4537
|
-
set$
|
|
4374
|
+
set$4(editor, timeout, x, y);
|
|
4538
4375
|
return editor;
|
|
4539
4376
|
};
|
|
4540
4377
|
|
|
@@ -4987,6 +4824,7 @@ const indentMore = editor => {
|
|
|
4987
4824
|
};
|
|
4988
4825
|
|
|
4989
4826
|
const getLanguageConfiguration = async editor => {
|
|
4827
|
+
// @ts-ignore
|
|
4990
4828
|
return invoke$7('Languages.getLanguageConfiguration', {
|
|
4991
4829
|
uri: editor.uri,
|
|
4992
4830
|
languageId: editor.languageId
|
|
@@ -5331,36 +5169,19 @@ const create$4 = () => {
|
|
|
5331
5169
|
|
|
5332
5170
|
const launchCompletionWorker = async () => {
|
|
5333
5171
|
const name = 'Completion Worker';
|
|
5334
|
-
const
|
|
5335
|
-
|
|
5336
|
-
port2
|
|
5337
|
-
} = getPortTuple();
|
|
5338
|
-
await invokeAndTransfer('IpcParent.create', {
|
|
5339
|
-
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
5340
|
-
url: 'completionWorkerMain.js',
|
|
5341
|
-
name: name,
|
|
5342
|
-
raw: true,
|
|
5343
|
-
port: port1
|
|
5344
|
-
});
|
|
5345
|
-
const rpc = await MessagePortRpcParent.create({
|
|
5346
|
-
commandMap: {},
|
|
5347
|
-
messagePort: port2,
|
|
5348
|
-
isMessagePortOpen: true
|
|
5349
|
-
});
|
|
5350
|
-
port2.start();
|
|
5351
|
-
await rpc.invoke('Completions.initialize');
|
|
5352
|
-
return rpc;
|
|
5172
|
+
const url = 'completionWorkerMain.js';
|
|
5173
|
+
return launchWorker(name, url);
|
|
5353
5174
|
};
|
|
5354
5175
|
|
|
5355
|
-
let workerPromise$
|
|
5356
|
-
const getOrCreate$
|
|
5357
|
-
if (!workerPromise$
|
|
5358
|
-
workerPromise$
|
|
5176
|
+
let workerPromise$2;
|
|
5177
|
+
const getOrCreate$2 = () => {
|
|
5178
|
+
if (!workerPromise$2) {
|
|
5179
|
+
workerPromise$2 = launchCompletionWorker();
|
|
5359
5180
|
}
|
|
5360
|
-
return workerPromise$
|
|
5181
|
+
return workerPromise$2;
|
|
5361
5182
|
};
|
|
5362
5183
|
const invoke$3 = async (method, ...params) => {
|
|
5363
|
-
const worker = await getOrCreate$
|
|
5184
|
+
const worker = await getOrCreate$2();
|
|
5364
5185
|
return await worker.invoke(method, ...params);
|
|
5365
5186
|
};
|
|
5366
5187
|
|
|
@@ -5418,35 +5239,19 @@ const create$3 = () => {
|
|
|
5418
5239
|
|
|
5419
5240
|
const launchFindWidgetWorker = async () => {
|
|
5420
5241
|
const name = 'Find Widget Worker';
|
|
5421
|
-
const
|
|
5422
|
-
|
|
5423
|
-
port2
|
|
5424
|
-
} = getPortTuple();
|
|
5425
|
-
await invokeAndTransfer('IpcParent.create', {
|
|
5426
|
-
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
5427
|
-
url: 'findWidgetWorkerMain.js',
|
|
5428
|
-
name: name,
|
|
5429
|
-
raw: true,
|
|
5430
|
-
port: port1
|
|
5431
|
-
});
|
|
5432
|
-
const rpc = await MessagePortRpcParent.create({
|
|
5433
|
-
commandMap: {},
|
|
5434
|
-
messagePort: port2,
|
|
5435
|
-
isMessagePortOpen: true
|
|
5436
|
-
});
|
|
5437
|
-
port2.start();
|
|
5438
|
-
return rpc;
|
|
5242
|
+
const url = 'findWidgetWorkerMain.js';
|
|
5243
|
+
return launchWorker(name, url);
|
|
5439
5244
|
};
|
|
5440
5245
|
|
|
5441
|
-
let workerPromise;
|
|
5442
|
-
const getOrCreate = () => {
|
|
5443
|
-
if (!workerPromise) {
|
|
5444
|
-
workerPromise = launchFindWidgetWorker();
|
|
5246
|
+
let workerPromise$1;
|
|
5247
|
+
const getOrCreate$1 = () => {
|
|
5248
|
+
if (!workerPromise$1) {
|
|
5249
|
+
workerPromise$1 = launchFindWidgetWorker();
|
|
5445
5250
|
}
|
|
5446
|
-
return workerPromise;
|
|
5251
|
+
return workerPromise$1;
|
|
5447
5252
|
};
|
|
5448
5253
|
const invoke$2 = async (method, ...params) => {
|
|
5449
|
-
const worker = await getOrCreate();
|
|
5254
|
+
const worker = await getOrCreate$1();
|
|
5450
5255
|
return await worker.invoke(method, ...params);
|
|
5451
5256
|
};
|
|
5452
5257
|
|
|
@@ -5481,14 +5286,6 @@ const loadContent$1 = async (state, parentUid) => {
|
|
|
5481
5286
|
commands
|
|
5482
5287
|
};
|
|
5483
5288
|
};
|
|
5484
|
-
const close$1 = async state => {
|
|
5485
|
-
// TODO
|
|
5486
|
-
// await Viewlet.closeWidget(uid)
|
|
5487
|
-
return {
|
|
5488
|
-
...state,
|
|
5489
|
-
disposed: true
|
|
5490
|
-
};
|
|
5491
|
-
};
|
|
5492
5289
|
|
|
5493
5290
|
const newStateGenerator$2 = (state, parentUid) => {
|
|
5494
5291
|
return loadContent$1(state, parentUid);
|
|
@@ -5600,6 +5397,7 @@ const pasteText = (editor, text) => {
|
|
|
5600
5397
|
};
|
|
5601
5398
|
|
|
5602
5399
|
const paste = async editor => {
|
|
5400
|
+
// @ts-ignore
|
|
5603
5401
|
const text = await invoke$7('ClipBoard.readText');
|
|
5604
5402
|
string(text);
|
|
5605
5403
|
return pasteText(editor, text);
|
|
@@ -6048,6 +5846,7 @@ const selectInsideString = editor => {
|
|
|
6048
5846
|
// import * as ExtensionHostSelection from '../ExtensionHost/ExtensionHostSelection.ts'
|
|
6049
5847
|
|
|
6050
5848
|
const getNewSelections = async (editor, selections) => {
|
|
5849
|
+
// @ts-ignore
|
|
6051
5850
|
const newSelections = await invoke$7('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
6052
5851
|
if (newSelections.length === 0) {
|
|
6053
5852
|
return selections;
|
|
@@ -6301,9 +6100,8 @@ const getEnabled$1 = () => {
|
|
|
6301
6100
|
};
|
|
6302
6101
|
|
|
6303
6102
|
const {
|
|
6304
|
-
|
|
6305
|
-
invoke: invoke$1
|
|
6306
|
-
} = createRpc(SyntaxHighlightingWorker);
|
|
6103
|
+
set: set$3,
|
|
6104
|
+
invoke: invoke$1} = SyntaxHighlightingWorker;
|
|
6307
6105
|
|
|
6308
6106
|
/**
|
|
6309
6107
|
* @enum number
|
|
@@ -6372,6 +6170,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
6372
6170
|
return;
|
|
6373
6171
|
}
|
|
6374
6172
|
if (getEnabled$1()) {
|
|
6173
|
+
// @ts-ignore
|
|
6375
6174
|
const tokenMap = await invoke$1('Tokenizer.load', languageId, tokenizePath);
|
|
6376
6175
|
set$1(languageId, tokenMap);
|
|
6377
6176
|
return;
|
|
@@ -6529,20 +6328,10 @@ const getHover = async (editor, offset) => {
|
|
|
6529
6328
|
return hover;
|
|
6530
6329
|
};
|
|
6531
6330
|
|
|
6532
|
-
let _ipc;
|
|
6533
|
-
const listen$2 = async () => {
|
|
6534
|
-
const ipc = await create$9({
|
|
6535
|
-
method: RendererProcess
|
|
6536
|
-
});
|
|
6537
|
-
handleIpc(ipc);
|
|
6538
|
-
_ipc = ipc;
|
|
6539
|
-
};
|
|
6540
|
-
const invoke = async (method, ...args) => {
|
|
6541
|
-
return invoke$9(_ipc, method, ...args);
|
|
6542
|
-
};
|
|
6543
|
-
|
|
6544
6331
|
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
6545
|
-
|
|
6332
|
+
// @ts-ignore
|
|
6333
|
+
// return RendererProcess.invoke('MeasureTextBlockHeight.measureTextBlockHeight', text, fontSize, fontFamily, lineHeight, width)
|
|
6334
|
+
return 100;
|
|
6546
6335
|
};
|
|
6547
6336
|
|
|
6548
6337
|
const deepCopy = value => {
|
|
@@ -6660,16 +6449,6 @@ const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
|
|
|
6660
6449
|
return matching;
|
|
6661
6450
|
};
|
|
6662
6451
|
const fallbackDisplayStringLanguageId = 'typescript'; // TODO remove this
|
|
6663
|
-
|
|
6664
|
-
const hoverDocumentationFontSize = 15;
|
|
6665
|
-
const hoverDocumentationFontFamily = 'Fira Code';
|
|
6666
|
-
const hoverDocumentationLineHeight = '1.33333';
|
|
6667
|
-
const hoverBorderLeft = 1;
|
|
6668
|
-
const hoverBorderRight = 1;
|
|
6669
|
-
const hoverPaddingLeft = 8;
|
|
6670
|
-
const hoverPaddingRight = 8;
|
|
6671
|
-
const hovverFullWidth = 400;
|
|
6672
|
-
const hoverDocumentationWidth = hovverFullWidth - hoverPaddingLeft - hoverPaddingRight - hoverBorderLeft - hoverBorderRight;
|
|
6673
6452
|
const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) => {
|
|
6674
6453
|
const x$1 = x(editor, rowIndex, wordStart);
|
|
6675
6454
|
const y$1 = editor.height - y(editor, rowIndex) + editor.y + 40;
|
|
@@ -6703,7 +6482,7 @@ const getEditorHoverInfo = async (editorUid, position) => {
|
|
|
6703
6482
|
const lineInfos = await tokenizeCodeBlock(displayString, displayStringLanguageId || fallbackDisplayStringLanguageId, tokenizerPath);
|
|
6704
6483
|
const wordPart = getWordBefore(editor, rowIndex, columnIndex);
|
|
6705
6484
|
const wordStart = columnIndex - wordPart.length;
|
|
6706
|
-
await measureTextBlockHeight(
|
|
6485
|
+
await measureTextBlockHeight();
|
|
6707
6486
|
const {
|
|
6708
6487
|
x,
|
|
6709
6488
|
y
|
|
@@ -6759,6 +6538,7 @@ const showHover = async state => {
|
|
|
6759
6538
|
|
|
6760
6539
|
// TODO ask extension host worker instead
|
|
6761
6540
|
const getEditorSourceActions = async () => {
|
|
6541
|
+
// @ts-ignore
|
|
6762
6542
|
const sourceActions = await invoke$7('GetEditorSourceActions.getEditorSourceActions');
|
|
6763
6543
|
return sourceActions;
|
|
6764
6544
|
};
|
|
@@ -7419,6 +7199,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
7419
7199
|
|
|
7420
7200
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
7421
7201
|
const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
7202
|
+
// @ts-ignore
|
|
7422
7203
|
const result = await invoke$7('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
|
|
7423
7204
|
if (!result) {
|
|
7424
7205
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
@@ -7678,23 +7459,19 @@ const addWidget$1 = (widget, id, render) => {
|
|
|
7678
7459
|
return allCommands;
|
|
7679
7460
|
};
|
|
7680
7461
|
|
|
7681
|
-
const
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
const commands = [...newState.commands];
|
|
7695
|
-
// @ts-ignore
|
|
7696
|
-
newState.commands = [];
|
|
7697
|
-
return commands;
|
|
7462
|
+
const getWidgetInvoke = widgetId => {
|
|
7463
|
+
switch (widgetId) {
|
|
7464
|
+
case ColorPicker:
|
|
7465
|
+
return invoke$6;
|
|
7466
|
+
case Completion:
|
|
7467
|
+
return invoke$3;
|
|
7468
|
+
case Find:
|
|
7469
|
+
return invoke$2;
|
|
7470
|
+
case Rename:
|
|
7471
|
+
return invoke$4;
|
|
7472
|
+
default:
|
|
7473
|
+
return undefined;
|
|
7474
|
+
}
|
|
7698
7475
|
};
|
|
7699
7476
|
|
|
7700
7477
|
const updateWidget = (editor, widgetId, newState) => {
|
|
@@ -7720,29 +7497,7 @@ const updateWidget = (editor, widgetId, newState) => {
|
|
|
7720
7497
|
};
|
|
7721
7498
|
};
|
|
7722
7499
|
|
|
7723
|
-
const
|
|
7724
|
-
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
7725
|
-
const wrappedCommands = [];
|
|
7726
|
-
const {
|
|
7727
|
-
uid
|
|
7728
|
-
} = widget.newState;
|
|
7729
|
-
for (const command of commands) {
|
|
7730
|
-
if (command[0] === SetDom2 || command[0] === SetCss || command[0] === AppendToBody || command[0] === SetBounds2 || command[0] === RegisterEventListeners || command[0] === SetSelectionByName || command[0] === SetValueByName || command[0] === SetFocusContext || command[0] === SetUid || command[0] === 'Viewlet.focusSelector') {
|
|
7731
|
-
wrappedCommands.push(command);
|
|
7732
|
-
} else {
|
|
7733
|
-
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
7734
|
-
}
|
|
7735
|
-
}
|
|
7736
|
-
return wrappedCommands;
|
|
7737
|
-
};
|
|
7738
|
-
const add$7 = widget => {
|
|
7739
|
-
return addWidget$1(widget, 'EditorRename', render$c);
|
|
7740
|
-
};
|
|
7741
|
-
const remove$7 = widget => {
|
|
7742
|
-
return [['Viewlet.dispose', widget.newState.uid]];
|
|
7743
|
-
};
|
|
7744
|
-
const createFn = key => {
|
|
7745
|
-
const widgetId = Completion;
|
|
7500
|
+
const createFn = (key, name, widgetId) => {
|
|
7746
7501
|
const isWidget = widget => {
|
|
7747
7502
|
return widget.id === widgetId;
|
|
7748
7503
|
};
|
|
@@ -7754,9 +7509,10 @@ const createFn = key => {
|
|
|
7754
7509
|
const {
|
|
7755
7510
|
uid
|
|
7756
7511
|
} = state;
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
const
|
|
7512
|
+
const invoke = getWidgetInvoke(widgetId);
|
|
7513
|
+
await invoke(`${name}.${key}`, uid, ...args);
|
|
7514
|
+
const diff = await invoke(`${name}.diff2`, uid);
|
|
7515
|
+
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
7760
7516
|
const newState = {
|
|
7761
7517
|
...state,
|
|
7762
7518
|
commands
|
|
@@ -7767,19 +7523,60 @@ const createFn = key => {
|
|
|
7767
7523
|
};
|
|
7768
7524
|
return fn;
|
|
7769
7525
|
};
|
|
7770
|
-
const createFns = keys => {
|
|
7526
|
+
const createFns = (keys, name, widgetId) => {
|
|
7771
7527
|
const fns = Object.create(null);
|
|
7772
7528
|
for (const key of keys) {
|
|
7773
|
-
fns[key] = createFn(key);
|
|
7529
|
+
fns[key] = createFn(key, name, widgetId);
|
|
7774
7530
|
}
|
|
7775
7531
|
return fns;
|
|
7776
7532
|
};
|
|
7533
|
+
|
|
7534
|
+
const AppendToBody = 'Viewlet.appendToBody';
|
|
7535
|
+
const Focus = 'focus';
|
|
7536
|
+
const RegisterEventListeners = 'Viewlet.registerEventListeners';
|
|
7537
|
+
const SetSelectionByName = 'Viewlet.setSelectionByName';
|
|
7538
|
+
const SetValueByName = 'Viewlet.setValueByName';
|
|
7539
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
7540
|
+
const SetBounds = 'setBounds';
|
|
7541
|
+
const SetBounds2 = 'Viewlet.setBounds';
|
|
7542
|
+
const SetCss = 'Viewlet.setCss';
|
|
7543
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
7544
|
+
const SetUid = 'Viewlet.setUid';
|
|
7545
|
+
|
|
7546
|
+
const renderFull$4 = (oldState, newState) => {
|
|
7547
|
+
const commands = [...newState.commands];
|
|
7548
|
+
// @ts-ignore
|
|
7549
|
+
newState.commands = [];
|
|
7550
|
+
return commands;
|
|
7551
|
+
};
|
|
7552
|
+
|
|
7553
|
+
const render$c = widget => {
|
|
7554
|
+
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
7555
|
+
const wrappedCommands = [];
|
|
7556
|
+
const {
|
|
7557
|
+
uid
|
|
7558
|
+
} = widget.newState;
|
|
7559
|
+
for (const command of commands) {
|
|
7560
|
+
if (command[0] === SetDom2 || command[0] === SetCss || command[0] === AppendToBody || command[0] === SetBounds2 || command[0] === RegisterEventListeners || command[0] === SetSelectionByName || command[0] === SetValueByName || command[0] === SetFocusContext || command[0] === SetUid || command[0] === 'Viewlet.focusSelector') {
|
|
7561
|
+
wrappedCommands.push(command);
|
|
7562
|
+
} else {
|
|
7563
|
+
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
7564
|
+
}
|
|
7565
|
+
}
|
|
7566
|
+
return wrappedCommands;
|
|
7567
|
+
};
|
|
7568
|
+
const add$7 = widget => {
|
|
7569
|
+
return addWidget$1(widget, 'EditorRename', render$c);
|
|
7570
|
+
};
|
|
7571
|
+
const remove$7 = widget => {
|
|
7572
|
+
return [['Viewlet.dispose', widget.newState.uid]];
|
|
7573
|
+
};
|
|
7777
7574
|
const {
|
|
7778
7575
|
focusFirst,
|
|
7779
7576
|
focusIndex: focusIndex$1,
|
|
7780
7577
|
focusLast,
|
|
7781
|
-
focusNext: focusNext$
|
|
7782
|
-
focusPrevious,
|
|
7578
|
+
focusNext: focusNext$2,
|
|
7579
|
+
focusPrevious: focusPrevious$1,
|
|
7783
7580
|
handleEditorBlur,
|
|
7784
7581
|
handleEditorClick,
|
|
7785
7582
|
handleEditorDeleteLeft: handleEditorDeleteLeft$1,
|
|
@@ -7790,19 +7587,19 @@ const {
|
|
|
7790
7587
|
toggleDetails,
|
|
7791
7588
|
closeDetails,
|
|
7792
7589
|
handleWheel,
|
|
7793
|
-
close
|
|
7794
|
-
} = createFns(['handleEditorType', 'focusFirst', 'focusNext', 'focusPrevious', 'focusLast', 'handleEditorDeleteLeft', 'openDetails', 'focusIndex', 'handleEditorBlur', 'handleEditorClick', 'openDetails', 'selectCurrent', 'selectIndex', 'toggleDetails', 'closeDetails', 'handleWheel', 'close']);
|
|
7590
|
+
close: close$1
|
|
7591
|
+
} = createFns(['handleEditorType', 'focusFirst', 'focusNext', 'focusPrevious', 'focusLast', 'handleEditorDeleteLeft', 'openDetails', 'focusIndex', 'handleEditorBlur', 'handleEditorClick', 'openDetails', 'selectCurrent', 'selectIndex', 'toggleDetails', 'closeDetails', 'handleWheel', 'close'], 'Completions', Completion);
|
|
7795
7592
|
|
|
7796
7593
|
const EditorCompletionWidget = {
|
|
7797
7594
|
__proto__: null,
|
|
7798
7595
|
add: add$7,
|
|
7799
|
-
close,
|
|
7596
|
+
close: close$1,
|
|
7800
7597
|
closeDetails,
|
|
7801
7598
|
focusFirst,
|
|
7802
7599
|
focusIndex: focusIndex$1,
|
|
7803
7600
|
focusLast,
|
|
7804
|
-
focusNext: focusNext$
|
|
7805
|
-
focusPrevious,
|
|
7601
|
+
focusNext: focusNext$2,
|
|
7602
|
+
focusPrevious: focusPrevious$1,
|
|
7806
7603
|
handleEditorBlur,
|
|
7807
7604
|
handleEditorClick,
|
|
7808
7605
|
handleEditorDeleteLeft: handleEditorDeleteLeft$1,
|
|
@@ -7816,6 +7613,80 @@ const EditorCompletionWidget = {
|
|
|
7816
7613
|
toggleDetails
|
|
7817
7614
|
};
|
|
7818
7615
|
|
|
7616
|
+
const renderFull$3 = (oldState, newState) => {
|
|
7617
|
+
const commands = [...newState.commands];
|
|
7618
|
+
// @ts-ignore
|
|
7619
|
+
newState.commands = [];
|
|
7620
|
+
return commands;
|
|
7621
|
+
};
|
|
7622
|
+
|
|
7623
|
+
const render$b = widget => {
|
|
7624
|
+
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
7625
|
+
const wrappedCommands = [];
|
|
7626
|
+
const {
|
|
7627
|
+
uid
|
|
7628
|
+
} = widget.newState;
|
|
7629
|
+
for (const command of commands) {
|
|
7630
|
+
if (command[0] === SetDom2 || command[0] === SetCss || command[0] === AppendToBody || command[0] === SetBounds2 || command[0] === RegisterEventListeners || command[0] === SetSelectionByName || command[0] === SetValueByName || command[0] === SetFocusContext || command[0] === SetUid || command[0] === 'Viewlet.focusSelector') {
|
|
7631
|
+
wrappedCommands.push(command);
|
|
7632
|
+
} else {
|
|
7633
|
+
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
7634
|
+
}
|
|
7635
|
+
}
|
|
7636
|
+
return wrappedCommands;
|
|
7637
|
+
};
|
|
7638
|
+
const add$6 = widget => {
|
|
7639
|
+
return addWidget$1(widget, 'FindWidget', render$b);
|
|
7640
|
+
};
|
|
7641
|
+
const remove$6 = widget => {
|
|
7642
|
+
return [['Viewlet.dispose', widget.newState.uid]];
|
|
7643
|
+
};
|
|
7644
|
+
const {
|
|
7645
|
+
close,
|
|
7646
|
+
focusCloseButton,
|
|
7647
|
+
focusFind,
|
|
7648
|
+
focusNext: focusNext$1,
|
|
7649
|
+
focusNextMatchButton,
|
|
7650
|
+
focusPrevious,
|
|
7651
|
+
focusPreviousMatchButton,
|
|
7652
|
+
focusReplace,
|
|
7653
|
+
focusReplaceAllButton,
|
|
7654
|
+
focusReplaceButton,
|
|
7655
|
+
focusToggleReplace,
|
|
7656
|
+
handleBlur,
|
|
7657
|
+
handleFocus,
|
|
7658
|
+
handleInput,
|
|
7659
|
+
handleReplaceFocus,
|
|
7660
|
+
handleReplaceInput,
|
|
7661
|
+
handleToggleReplaceFocus,
|
|
7662
|
+
toggleReplace
|
|
7663
|
+
} = createFns(['close', 'focusCloseButton', 'focusFind', 'focusNext', 'focusNextMatchButton', 'focusPrevious', 'focusPreviousMatchButton', 'focusReplace', 'focusReplaceAllButton', 'focusReplaceButton', 'focusToggleReplace', 'handleBlur', 'handleFocus', 'handleInput', 'handleReplaceFocus', 'handleReplaceInput', 'handleToggleReplaceFocus', 'toggleReplace'], 'FindWidget', Find);
|
|
7664
|
+
|
|
7665
|
+
const EditorFindWidget = {
|
|
7666
|
+
__proto__: null,
|
|
7667
|
+
add: add$6,
|
|
7668
|
+
close,
|
|
7669
|
+
focusCloseButton,
|
|
7670
|
+
focusFind,
|
|
7671
|
+
focusNext: focusNext$1,
|
|
7672
|
+
focusNextMatchButton,
|
|
7673
|
+
focusPrevious,
|
|
7674
|
+
focusPreviousMatchButton,
|
|
7675
|
+
focusReplace,
|
|
7676
|
+
focusReplaceAllButton,
|
|
7677
|
+
focusReplaceButton,
|
|
7678
|
+
focusToggleReplace,
|
|
7679
|
+
handleBlur,
|
|
7680
|
+
handleFocus,
|
|
7681
|
+
handleInput,
|
|
7682
|
+
handleReplaceFocus,
|
|
7683
|
+
handleReplaceInput,
|
|
7684
|
+
handleToggleReplaceFocus,
|
|
7685
|
+
remove: remove$6,
|
|
7686
|
+
render: render$b,
|
|
7687
|
+
toggleReplace
|
|
7688
|
+
};
|
|
7689
|
+
|
|
7819
7690
|
const loadContent = async (editorUid, state, position) => {
|
|
7820
7691
|
const hoverInfo = await getEditorHoverInfo(editorUid, position);
|
|
7821
7692
|
if (!hoverInfo) {
|
|
@@ -7865,6 +7736,7 @@ const CompletionDetailContent = 'CompletionDetailContent';
|
|
|
7865
7736
|
const Diagnostic = 'Diagnostic';
|
|
7866
7737
|
const EditorCursor = 'EditorCursor';
|
|
7867
7738
|
const EditorRow = 'EditorRow';
|
|
7739
|
+
const EditorRowHighlighted = 'EditorRowHighlighted';
|
|
7868
7740
|
const EditorSelection = 'EditorSelection';
|
|
7869
7741
|
const EditorSourceActions = 'EditorSourceActions';
|
|
7870
7742
|
const EditorSourceActionsList = 'EditorSourceActionsList';
|
|
@@ -8011,10 +7883,10 @@ const renderBounds$3 = {
|
|
|
8011
7883
|
return [SetBounds, x, y, width, height];
|
|
8012
7884
|
}
|
|
8013
7885
|
};
|
|
8014
|
-
const render$
|
|
7886
|
+
const render$a = [renderHoverDom, renderBounds$3];
|
|
8015
7887
|
const renderHover = (oldState, newState) => {
|
|
8016
7888
|
const commands = [];
|
|
8017
|
-
for (const item of render$
|
|
7889
|
+
for (const item of render$a) {
|
|
8018
7890
|
if (!item.isEqual(oldState, newState)) {
|
|
8019
7891
|
commands.push(item.apply(oldState, newState));
|
|
8020
7892
|
}
|
|
@@ -8040,21 +7912,6 @@ const focusNext = state => {
|
|
|
8040
7912
|
return focusIndex(state, nextIndex);
|
|
8041
7913
|
};
|
|
8042
7914
|
|
|
8043
|
-
const getWidgetInvoke = widgetId => {
|
|
8044
|
-
switch (widgetId) {
|
|
8045
|
-
case ColorPicker:
|
|
8046
|
-
return invoke$6;
|
|
8047
|
-
case Completion:
|
|
8048
|
-
return invoke$3;
|
|
8049
|
-
case Find:
|
|
8050
|
-
return invoke$2;
|
|
8051
|
-
case Rename:
|
|
8052
|
-
return invoke$4;
|
|
8053
|
-
default:
|
|
8054
|
-
return undefined;
|
|
8055
|
-
}
|
|
8056
|
-
};
|
|
8057
|
-
|
|
8058
7915
|
const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...params) => {
|
|
8059
7916
|
const invoke = getWidgetInvoke(widgetId);
|
|
8060
7917
|
const actualMethod = method.slice(name.length + 1);
|
|
@@ -8156,6 +8013,14 @@ const getSelections2 = editorUid => {
|
|
|
8156
8013
|
} = editor;
|
|
8157
8014
|
return selections;
|
|
8158
8015
|
};
|
|
8016
|
+
const setSelections2 = (editorUid, selections) => {
|
|
8017
|
+
const editor = getEditor(editorUid);
|
|
8018
|
+
const newEditor = {
|
|
8019
|
+
...editor,
|
|
8020
|
+
selections
|
|
8021
|
+
};
|
|
8022
|
+
set$6(editorUid, editor, newEditor);
|
|
8023
|
+
};
|
|
8159
8024
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
8160
8025
|
const editor = getEditor(editorUid);
|
|
8161
8026
|
const invoke = getWidgetInvoke(widgetId);
|
|
@@ -8173,7 +8038,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
8173
8038
|
widgets: newWidgets,
|
|
8174
8039
|
focused: true
|
|
8175
8040
|
};
|
|
8176
|
-
set$
|
|
8041
|
+
set$6(editorUid, editor, newEditor);
|
|
8177
8042
|
await setFocus(FocusEditorText);
|
|
8178
8043
|
if (unsetAdditionalFocus$1) {
|
|
8179
8044
|
await unsetAdditionalFocus(unsetAdditionalFocus$1);
|
|
@@ -8185,7 +8050,7 @@ const closeFind2 = async editorUid => {
|
|
|
8185
8050
|
const applyEdits2 = async (editorUid, edits) => {
|
|
8186
8051
|
const editor = getEditor(editorUid);
|
|
8187
8052
|
const newEditor = await applyEdit(editor, edits);
|
|
8188
|
-
set$
|
|
8053
|
+
set$6(editorUid, editor, newEditor);
|
|
8189
8054
|
};
|
|
8190
8055
|
|
|
8191
8056
|
const pending = Object.create(null);
|
|
@@ -8311,6 +8176,10 @@ const getKeyBindings = () => {
|
|
|
8311
8176
|
key: Enter,
|
|
8312
8177
|
command: 'FindWidget.focusNext',
|
|
8313
8178
|
when: FocusFindWidget
|
|
8179
|
+
}, {
|
|
8180
|
+
key: CtrlCmd | KeyF,
|
|
8181
|
+
command: 'FindWidget.preventDefaultBrowserFind',
|
|
8182
|
+
when: FocusFindWidget
|
|
8314
8183
|
}, {
|
|
8315
8184
|
key: Shift | F4,
|
|
8316
8185
|
command: 'FindWidget.focusPrevious',
|
|
@@ -8746,6 +8615,56 @@ const handleTab = async editor => {
|
|
|
8746
8615
|
return applyTabCompletion(editor, result);
|
|
8747
8616
|
};
|
|
8748
8617
|
|
|
8618
|
+
const sendMessagePortToExtensionHostWorker2 = async (port, initialCommand, rpcId) => {
|
|
8619
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, initialCommand, rpcId);
|
|
8620
|
+
};
|
|
8621
|
+
|
|
8622
|
+
const createExtensionHostRpc = async () => {
|
|
8623
|
+
try {
|
|
8624
|
+
const {
|
|
8625
|
+
port1,
|
|
8626
|
+
port2
|
|
8627
|
+
} = getPortTuple();
|
|
8628
|
+
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
8629
|
+
await sendMessagePortToExtensionHostWorker2(port2, initialCommand, RpcId.EditorWorker);
|
|
8630
|
+
const rpc = await PlainMessagePortRpcParent.create({
|
|
8631
|
+
commandMap: {},
|
|
8632
|
+
messagePort: port1
|
|
8633
|
+
});
|
|
8634
|
+
return rpc;
|
|
8635
|
+
} catch (error) {
|
|
8636
|
+
throw new VError(error, `Failed to create extension host rpc`);
|
|
8637
|
+
}
|
|
8638
|
+
};
|
|
8639
|
+
|
|
8640
|
+
const initializeExtensionHost = async () => {
|
|
8641
|
+
const extensionHostRpc = await createExtensionHostRpc();
|
|
8642
|
+
set$5(extensionHostRpc);
|
|
8643
|
+
};
|
|
8644
|
+
|
|
8645
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
8646
|
+
await invokeAndTransfer(
|
|
8647
|
+
// @ts-ignore
|
|
8648
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
8649
|
+
};
|
|
8650
|
+
|
|
8651
|
+
const createSyntaxHighlightingWorkerRpc = async () => {
|
|
8652
|
+
try {
|
|
8653
|
+
const {
|
|
8654
|
+
port1,
|
|
8655
|
+
port2
|
|
8656
|
+
} = getPortTuple();
|
|
8657
|
+
await sendMessagePortToSyntaxHighlightingWorker(port2);
|
|
8658
|
+
const rpc = await PlainMessagePortRpcParent.create({
|
|
8659
|
+
commandMap: {},
|
|
8660
|
+
messagePort: port1
|
|
8661
|
+
});
|
|
8662
|
+
return rpc;
|
|
8663
|
+
} catch (error) {
|
|
8664
|
+
throw new VError(error, `Failed to create synax highlighting worker rpc`);
|
|
8665
|
+
}
|
|
8666
|
+
};
|
|
8667
|
+
|
|
8749
8668
|
let enabled = false;
|
|
8750
8669
|
const setEnabled = value => {
|
|
8751
8670
|
enabled = value;
|
|
@@ -8754,16 +8673,19 @@ const getEnabled = () => {
|
|
|
8754
8673
|
return enabled;
|
|
8755
8674
|
};
|
|
8756
8675
|
|
|
8757
|
-
const
|
|
8758
|
-
await listen$2();
|
|
8676
|
+
const initializeSyntaxHighlighting = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
8759
8677
|
if (syntaxHighlightingEnabled) {
|
|
8760
8678
|
setEnabled$1(true);
|
|
8761
|
-
await
|
|
8679
|
+
const syntaxRpc = await createSyntaxHighlightingWorkerRpc();
|
|
8680
|
+
set$3(syntaxRpc);
|
|
8762
8681
|
}
|
|
8763
8682
|
if (syncIncremental) {
|
|
8764
8683
|
setEnabled(true);
|
|
8765
8684
|
}
|
|
8766
|
-
|
|
8685
|
+
};
|
|
8686
|
+
|
|
8687
|
+
const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
8688
|
+
await Promise.all([initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental), initializeExtensionHost()]);
|
|
8767
8689
|
};
|
|
8768
8690
|
|
|
8769
8691
|
// TODO move cursor
|
|
@@ -8821,6 +8743,36 @@ const moveLineUp = editor => {
|
|
|
8821
8743
|
return editor;
|
|
8822
8744
|
};
|
|
8823
8745
|
|
|
8746
|
+
const launchDebugWorker = async () => {
|
|
8747
|
+
const name = 'Debug Worker';
|
|
8748
|
+
const url = 'debugWorkerMain.js';
|
|
8749
|
+
return launchWorker(name, url);
|
|
8750
|
+
};
|
|
8751
|
+
|
|
8752
|
+
let workerPromise;
|
|
8753
|
+
const getOrCreate = async () => {
|
|
8754
|
+
if (!workerPromise) {
|
|
8755
|
+
workerPromise = launchDebugWorker();
|
|
8756
|
+
}
|
|
8757
|
+
return workerPromise;
|
|
8758
|
+
};
|
|
8759
|
+
const invoke = async (method, ...params) => {
|
|
8760
|
+
const worker = await getOrCreate();
|
|
8761
|
+
return worker.invoke(method, ...params);
|
|
8762
|
+
};
|
|
8763
|
+
|
|
8764
|
+
const getHighlightedLine = async editor => {
|
|
8765
|
+
if (!editor.debugEnabled) {
|
|
8766
|
+
return -1;
|
|
8767
|
+
}
|
|
8768
|
+
try {
|
|
8769
|
+
return await invoke('Debug.getHighlightedLine', editor.uid);
|
|
8770
|
+
} catch (error) {
|
|
8771
|
+
console.error('Failed to get highlighted line:', error);
|
|
8772
|
+
return -1;
|
|
8773
|
+
}
|
|
8774
|
+
};
|
|
8775
|
+
|
|
8824
8776
|
const Link$1 = 'Link';
|
|
8825
8777
|
const Function = 'Function';
|
|
8826
8778
|
const Parameter = 'Parameter';
|
|
@@ -9052,9 +9004,12 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
|
|
|
9052
9004
|
languageId,
|
|
9053
9005
|
invalidStartIndex
|
|
9054
9006
|
};
|
|
9055
|
-
return invoke$1('GetTokensViewport.getTokensViewport', slimEditor,
|
|
9007
|
+
return invoke$1('GetTokensViewport.getTokensViewport', slimEditor,
|
|
9008
|
+
// @ts-ignore
|
|
9009
|
+
startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
|
|
9056
9010
|
}
|
|
9057
9011
|
// TODO only send needed lines of text
|
|
9012
|
+
// @ts-ignore
|
|
9058
9013
|
return invoke$1('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
|
|
9059
9014
|
}
|
|
9060
9015
|
return getTokensViewport(editor, startLineIndex, endLineIndex);
|
|
@@ -9283,6 +9238,7 @@ const getVisible = async (editor, syncIncremental) => {
|
|
|
9283
9238
|
charWidth
|
|
9284
9239
|
} = editor;
|
|
9285
9240
|
const maxLineY = Math.min(minLineY + numberOfVisibleLines, lines.length);
|
|
9241
|
+
// @ts-ignore
|
|
9286
9242
|
const {
|
|
9287
9243
|
tokens,
|
|
9288
9244
|
tokenizersToLoad,
|
|
@@ -9371,14 +9327,18 @@ const getEditorGutterVirtualDom = gutterInfos => {
|
|
|
9371
9327
|
return dom;
|
|
9372
9328
|
};
|
|
9373
9329
|
|
|
9374
|
-
const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true) => {
|
|
9330
|
+
const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1) => {
|
|
9375
9331
|
const dom = [];
|
|
9376
9332
|
for (let i = 0; i < textInfos.length; i++) {
|
|
9377
9333
|
const textInfo = textInfos[i];
|
|
9378
9334
|
const difference = differences[i];
|
|
9335
|
+
let className = EditorRow;
|
|
9336
|
+
if (i === highlightedLine) {
|
|
9337
|
+
className += ' ' + EditorRowHighlighted;
|
|
9338
|
+
}
|
|
9379
9339
|
dom.push({
|
|
9380
9340
|
type: Div,
|
|
9381
|
-
className
|
|
9341
|
+
className,
|
|
9382
9342
|
translate: px(difference),
|
|
9383
9343
|
childCount: textInfo.length / 2
|
|
9384
9344
|
});
|
|
@@ -9411,7 +9371,9 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
9411
9371
|
} = newState;
|
|
9412
9372
|
const oldLine = oldState.lines[rowIndex];
|
|
9413
9373
|
const newLine = lines[rowIndex];
|
|
9414
|
-
const incrementalEdits = await invoke$1('TokenizeIncremental.tokenizeIncremental', newState.uid,
|
|
9374
|
+
const incrementalEdits = await invoke$1('TokenizeIncremental.tokenizeIncremental', newState.uid,
|
|
9375
|
+
// @ts-ignore
|
|
9376
|
+
newState.languageId, oldLine, newLine, rowIndex, newState.minLineY);
|
|
9415
9377
|
if (incrementalEdits && incrementalEdits.length === 1) {
|
|
9416
9378
|
return incrementalEdits;
|
|
9417
9379
|
}
|
|
@@ -9463,7 +9425,7 @@ const removeWidget$1 = widget => {
|
|
|
9463
9425
|
|
|
9464
9426
|
const renderLines = {
|
|
9465
9427
|
isEqual(oldState, newState) {
|
|
9466
|
-
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;
|
|
9428
|
+
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;
|
|
9467
9429
|
},
|
|
9468
9430
|
async apply(oldState, newState) {
|
|
9469
9431
|
const incrementalEdits = await getIncrementalEdits(oldState, newState);
|
|
@@ -9476,7 +9438,8 @@ const renderLines = {
|
|
|
9476
9438
|
differences
|
|
9477
9439
|
} = await getVisible(newState, syncIncremental);
|
|
9478
9440
|
newState.differences = differences;
|
|
9479
|
-
const
|
|
9441
|
+
const highlightedLine = await getHighlightedLine(newState);
|
|
9442
|
+
const dom = getEditorRowsVirtualDom(textInfos, differences, true, highlightedLine);
|
|
9480
9443
|
return [/* method */'setText', dom];
|
|
9481
9444
|
}
|
|
9482
9445
|
};
|
|
@@ -9613,7 +9576,7 @@ const renderWidgets = {
|
|
|
9613
9576
|
},
|
|
9614
9577
|
multiple: true
|
|
9615
9578
|
};
|
|
9616
|
-
const render$
|
|
9579
|
+
const render$9 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets];
|
|
9617
9580
|
const renderEditor = async id => {
|
|
9618
9581
|
const instance = get$4(id);
|
|
9619
9582
|
if (!instance) {
|
|
@@ -9624,8 +9587,8 @@ const renderEditor = async id => {
|
|
|
9624
9587
|
newState
|
|
9625
9588
|
} = instance;
|
|
9626
9589
|
const commands = [];
|
|
9627
|
-
set$
|
|
9628
|
-
for (const item of render$
|
|
9590
|
+
set$6(id, newState, newState);
|
|
9591
|
+
for (const item of render$9) {
|
|
9629
9592
|
if (!item.isEqual(oldState, newState)) {
|
|
9630
9593
|
const result = await item.apply(oldState, newState);
|
|
9631
9594
|
// @ts-ignore
|
|
@@ -9676,6 +9639,10 @@ const renderEventListeners = () => {
|
|
|
9676
9639
|
}];
|
|
9677
9640
|
};
|
|
9678
9641
|
|
|
9642
|
+
const setDebugEnabled = (state, enabled) => {
|
|
9643
|
+
return state;
|
|
9644
|
+
};
|
|
9645
|
+
|
|
9679
9646
|
const editorDiagnosticEffect = {
|
|
9680
9647
|
isActive(oldEditor, newEditor) {
|
|
9681
9648
|
// TODO avoid slow comparison
|
|
@@ -9693,7 +9660,7 @@ const keep = [
|
|
|
9693
9660
|
// 'ColorPicker.loadContent',
|
|
9694
9661
|
'Editor.create', 'Editor.getWordAt', 'Editor.getWordBefore', 'Editor.offsetAt', 'Editor.render', 'Editor.getKeyBindings', 'Editor.getPositionAtCursor', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getWordBefore2', 'Editor.getLines2', 'Editor.applyEdit2', 'Editor.applyEdits2', 'Editor.closeFind2', 'Editor.closeWidget2', 'Editor.getSelections2', 'Editor.getQuickPickMenuEntries',
|
|
9695
9662
|
// 'ColorPicker.render',
|
|
9696
|
-
'Editor.getText', 'Editor.getSelections', 'Font.ensure', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'ActivateByEvent.activateByEvent'];
|
|
9663
|
+
'Editor.getText', 'Editor.getSelections', 'Editor.setSelections2', 'Font.ensure', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'ActivateByEvent.activateByEvent'];
|
|
9697
9664
|
|
|
9698
9665
|
const wrapWidgetCommand = (widgetId, fn) => {
|
|
9699
9666
|
const isWidget = widget => {
|
|
@@ -9757,7 +9724,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
|
|
|
9757
9724
|
effect.apply(newEditor);
|
|
9758
9725
|
}
|
|
9759
9726
|
}
|
|
9760
|
-
set$
|
|
9727
|
+
set$6(editorUid, oldInstance.newState, newEditor);
|
|
9761
9728
|
// TODO if possible, rendering should be sync
|
|
9762
9729
|
const commands = await renderEditor(editorUid);
|
|
9763
9730
|
newEditor.commands = commands;
|
|
@@ -9782,12 +9749,15 @@ const commandMap = {
|
|
|
9782
9749
|
'Editor.addCursorAbove': addCursorAbove,
|
|
9783
9750
|
'Editor.addCursorBelow': addCursorBelow,
|
|
9784
9751
|
'Editor.applyEdit': applyEdit,
|
|
9752
|
+
'Editor.applyEdit2': applyEdits2,
|
|
9785
9753
|
'Editor.braceCompletion': braceCompletion,
|
|
9786
9754
|
'Editor.cancelSelection': cancelSelection,
|
|
9787
9755
|
'Editor.closeCodeGenerator': closeCodeGenerator,
|
|
9788
9756
|
'Editor.closeFind': closeFind,
|
|
9757
|
+
'Editor.closeFind2': closeFind2,
|
|
9789
9758
|
'Editor.closeRename': closeRename,
|
|
9790
9759
|
'Editor.closeSourceAction': closeSourceAction,
|
|
9760
|
+
'Editor.closeWidget2': closeWidget2,
|
|
9791
9761
|
'Editor.compositionEnd': compositionEnd,
|
|
9792
9762
|
'Editor.compositionStart': compositionStart,
|
|
9793
9763
|
'Editor.compositionUpdate': compositionUpdate,
|
|
@@ -9819,9 +9789,6 @@ const commandMap = {
|
|
|
9819
9789
|
'Editor.deleteRight': deleteCharacterRight,
|
|
9820
9790
|
'Editor.deleteWordLeft': deleteWordLeft,
|
|
9821
9791
|
'Editor.deleteWordPartLeft': deleteWordPartLeft,
|
|
9822
|
-
'Editor.applyEdit2': applyEdits2,
|
|
9823
|
-
'Editor.closeFind2': closeFind2,
|
|
9824
|
-
'Editor.closeWidget2': closeWidget2,
|
|
9825
9792
|
'Editor.deleteWordPartRight': deleteWordPartRight,
|
|
9826
9793
|
'Editor.deleteWordRight': deleteWordRight,
|
|
9827
9794
|
'Editor.executeWidgetCommand': executeWidgetCommand,
|
|
@@ -9843,10 +9810,10 @@ const commandMap = {
|
|
|
9843
9810
|
'Editor.goToTypeDefinition': goToTypeDefinition,
|
|
9844
9811
|
'Editor.handleBeforeInput': handleBeforeInput,
|
|
9845
9812
|
'Editor.handleBeforeInputFromContentEditable': handleBeforeInputFromContentEditable,
|
|
9846
|
-
'Editor.handleBlur': handleBlur,
|
|
9813
|
+
'Editor.handleBlur': handleBlur$1,
|
|
9847
9814
|
'Editor.handleContextMenu': handleContextMenu,
|
|
9848
9815
|
'Editor.handleDoubleClick': handleDoubleClick,
|
|
9849
|
-
'Editor.handleFocus': handleFocus,
|
|
9816
|
+
'Editor.handleFocus': handleFocus$1,
|
|
9850
9817
|
'Editor.handleMouseDown': handleMouseDown,
|
|
9851
9818
|
'Editor.handleMouseMove': handleMouseMove,
|
|
9852
9819
|
'Editor.handleMouseMoveWithAltKey': handleMouseMoveWithAltKey,
|
|
@@ -9879,21 +9846,6 @@ const commandMap = {
|
|
|
9879
9846
|
'Editor.openCodeGenerator': openCodeGenerator,
|
|
9880
9847
|
'Editor.openColorPicker': openColorPicker,
|
|
9881
9848
|
'Editor.openCompletion': openCompletion,
|
|
9882
|
-
'EditorCompletion.closeDetails': closeDetails,
|
|
9883
|
-
'EditorCompletion.focusFirst': focusFirst,
|
|
9884
|
-
'EditorCompletion.focusIndex': focusIndex$1,
|
|
9885
|
-
'EditorCompletion.focusNext': focusNext$1,
|
|
9886
|
-
'EditorCompletion.focusPrevious': focusPrevious,
|
|
9887
|
-
'EditorCompletion.handleEditorBlur': handleEditorBlur,
|
|
9888
|
-
'EditorCompletion.handleEditorClick': handleEditorClick,
|
|
9889
|
-
'EditorCompletion.handleEditorDeleteLeft': handleEditorDeleteLeft$1,
|
|
9890
|
-
'EditorCompletion.handleEditorType': handleEditorType$1,
|
|
9891
|
-
'EditorCompletion.handleWheel': handleWheel,
|
|
9892
|
-
'EditorCompletion.openDetails': openDetails,
|
|
9893
|
-
'EditorCompletion.selectCurrent': selectCurrent,
|
|
9894
|
-
'EditorCompletion.close': close,
|
|
9895
|
-
'EditorCompletion.selectIndex': selectIndex,
|
|
9896
|
-
'EditorCompletion.toggleDetails': toggleDetails,
|
|
9897
9849
|
'Editor.openFind': openFind,
|
|
9898
9850
|
'Editor.openFind2': openFind2,
|
|
9899
9851
|
'Editor.openRename': openRename,
|
|
@@ -9921,11 +9873,13 @@ const commandMap = {
|
|
|
9921
9873
|
'Editor.selectWord': selectWord,
|
|
9922
9874
|
'Editor.selectWordLeft': selectWordLeft,
|
|
9923
9875
|
'Editor.selectWordRight': selectWordRight,
|
|
9876
|
+
'Editor.setDebugEnabled': setDebugEnabled,
|
|
9924
9877
|
'Editor.setDecorations': setDecorations,
|
|
9925
9878
|
'Editor.setDelta': setDelta,
|
|
9926
9879
|
'Editor.setDeltaY': setDeltaY,
|
|
9927
9880
|
'Editor.setLanguageId': setLanguageId,
|
|
9928
9881
|
'Editor.setSelections': setSelections,
|
|
9882
|
+
'Editor.setSelections2': setSelections2,
|
|
9929
9883
|
'Editor.showHover': showHover,
|
|
9930
9884
|
'Editor.showHover2': showHover2,
|
|
9931
9885
|
'Editor.showSourceActions': showSourceActions,
|
|
@@ -9940,9 +9894,41 @@ const commandMap = {
|
|
|
9940
9894
|
'Editor.undo': undo,
|
|
9941
9895
|
'Editor.unIndent': editorUnindent,
|
|
9942
9896
|
'Editor.updateDiagnostics': updateDiagnostics,
|
|
9897
|
+
'EditorCompletion.close': close$1,
|
|
9898
|
+
'EditorCompletion.closeDetails': closeDetails,
|
|
9899
|
+
'EditorCompletion.focusFirst': focusFirst,
|
|
9900
|
+
'EditorCompletion.focusIndex': focusIndex$1,
|
|
9901
|
+
'EditorCompletion.focusNext': focusNext$2,
|
|
9902
|
+
'EditorCompletion.focusPrevious': focusPrevious$1,
|
|
9903
|
+
'EditorCompletion.handleEditorBlur': handleEditorBlur,
|
|
9904
|
+
'EditorCompletion.handleEditorClick': handleEditorClick,
|
|
9905
|
+
'EditorCompletion.handleEditorDeleteLeft': handleEditorDeleteLeft$1,
|
|
9906
|
+
'EditorCompletion.handleEditorType': handleEditorType$1,
|
|
9907
|
+
'EditorCompletion.handleWheel': handleWheel,
|
|
9908
|
+
'EditorCompletion.openDetails': openDetails,
|
|
9909
|
+
'EditorCompletion.selectCurrent': selectCurrent,
|
|
9910
|
+
'EditorCompletion.selectIndex': selectIndex,
|
|
9911
|
+
'EditorCompletion.toggleDetails': toggleDetails,
|
|
9943
9912
|
'EditorSourceActions.focusNext': focusNext,
|
|
9944
|
-
'FindWidget.close': close
|
|
9913
|
+
'FindWidget.close': close,
|
|
9914
|
+
'FindWidget.focusCloseButton': focusCloseButton,
|
|
9915
|
+
'FindWidget.focusFind': focusFind,
|
|
9916
|
+
'FindWidget.focusNext': focusNext$1,
|
|
9917
|
+
'FindWidget.focusNextMatchButton': focusNextMatchButton,
|
|
9918
|
+
'FindWidget.focusPrevious': focusPrevious,
|
|
9919
|
+
'FindWidget.focusPreviousMatchButton': focusPreviousMatchButton,
|
|
9920
|
+
'FindWidget.focusReplace': focusReplace,
|
|
9921
|
+
'FindWidget.focusReplaceAllButton': focusReplaceAllButton,
|
|
9922
|
+
'FindWidget.focusReplaceButton': focusReplaceButton,
|
|
9923
|
+
'FindWidget.focusToggleReplace': focusToggleReplace,
|
|
9924
|
+
'FindWidget.handleBlur': handleBlur,
|
|
9925
|
+
'FindWidget.handleFocus': handleFocus,
|
|
9926
|
+
'FindWidget.handleInput': handleInput,
|
|
9927
|
+
'FindWidget.handleReplaceFocus': handleReplaceFocus,
|
|
9928
|
+
'FindWidget.handleReplaceInput': handleReplaceInput,
|
|
9929
|
+
'FindWidget.handleToggleReplaceFocus': handleToggleReplaceFocus,
|
|
9945
9930
|
'FindWidget.loadContent': loadContent$1,
|
|
9931
|
+
'FindWidget.toggleReplace': toggleReplace,
|
|
9946
9932
|
'Font.ensure': ensure,
|
|
9947
9933
|
'Hover.getHoverInfo': getEditorHoverInfo,
|
|
9948
9934
|
'Hover.handleSashPointerDown': handleSashPointerDown,
|
|
@@ -9955,59 +9941,11 @@ const commandMap = {
|
|
|
9955
9941
|
};
|
|
9956
9942
|
wrapCommands(commandMap);
|
|
9957
9943
|
|
|
9958
|
-
const MessagePort$1 = 1;
|
|
9959
|
-
const ModuleWorker = 2;
|
|
9960
|
-
const ReferencePort = 3;
|
|
9961
|
-
const ModuleWorkerAndMessagePort = 8;
|
|
9962
|
-
const Auto = () => {
|
|
9963
|
-
// @ts-ignore
|
|
9964
|
-
if (globalThis.acceptPort) {
|
|
9965
|
-
return MessagePort$1;
|
|
9966
|
-
}
|
|
9967
|
-
// @ts-ignore
|
|
9968
|
-
if (globalThis.acceptReferencePort) {
|
|
9969
|
-
return ReferencePort;
|
|
9970
|
-
}
|
|
9971
|
-
return ModuleWorkerAndMessagePort;
|
|
9972
|
-
};
|
|
9973
|
-
|
|
9974
|
-
const getModule = method => {
|
|
9975
|
-
switch (method) {
|
|
9976
|
-
case ModuleWorker:
|
|
9977
|
-
return IpcChildWithModuleWorker$1;
|
|
9978
|
-
case ModuleWorkerAndMessagePort:
|
|
9979
|
-
return IpcChildWithModuleWorkerAndMessagePort$1;
|
|
9980
|
-
case MessagePort$1:
|
|
9981
|
-
return IpcChildWithMessagePort$1;
|
|
9982
|
-
default:
|
|
9983
|
-
throw new Error('unexpected ipc type');
|
|
9984
|
-
}
|
|
9985
|
-
};
|
|
9986
|
-
|
|
9987
|
-
// @ts-ignore
|
|
9988
|
-
const listen$1 = async ({
|
|
9989
|
-
method
|
|
9990
|
-
}) => {
|
|
9991
|
-
const module = await getModule(method);
|
|
9992
|
-
// @ts-ignore
|
|
9993
|
-
const rawIpc = await module.listen();
|
|
9994
|
-
// @ts-ignore
|
|
9995
|
-
if (module.signal) {
|
|
9996
|
-
// @ts-ignore
|
|
9997
|
-
module.signal(rawIpc);
|
|
9998
|
-
}
|
|
9999
|
-
// @ts-ignore
|
|
10000
|
-
const ipc = module.wrap(rawIpc);
|
|
10001
|
-
return ipc;
|
|
10002
|
-
};
|
|
10003
|
-
|
|
10004
9944
|
const listen = async () => {
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
method: Auto()
|
|
9945
|
+
const rpc = await WebWorkerRpcClient.create({
|
|
9946
|
+
commandMap: commandMap
|
|
10008
9947
|
});
|
|
10009
|
-
|
|
10010
|
-
listen$5(ipc);
|
|
9948
|
+
set$8(rpc);
|
|
10011
9949
|
};
|
|
10012
9950
|
|
|
10013
9951
|
const removeWidget = widget => {
|
|
@@ -10068,10 +10006,10 @@ const renderFocus = {
|
|
|
10068
10006
|
return [Focus, '.CodeGeneratorInput', newState.focusSource];
|
|
10069
10007
|
}
|
|
10070
10008
|
};
|
|
10071
|
-
const render$
|
|
10072
|
-
const renderFull$
|
|
10009
|
+
const render$8 = [renderContent$1, renderBounds$2, renderFocus];
|
|
10010
|
+
const renderFull$2 = (oldState, newState) => {
|
|
10073
10011
|
const commands = [];
|
|
10074
|
-
for (const item of render$
|
|
10012
|
+
for (const item of render$8) {
|
|
10075
10013
|
if (!item.isEqual(oldState, newState)) {
|
|
10076
10014
|
commands.push(item.apply(oldState, newState));
|
|
10077
10015
|
}
|
|
@@ -10079,8 +10017,8 @@ const renderFull$3 = (oldState, newState) => {
|
|
|
10079
10017
|
return commands;
|
|
10080
10018
|
};
|
|
10081
10019
|
|
|
10082
|
-
const render$
|
|
10083
|
-
const commands = renderFull$
|
|
10020
|
+
const render$7 = widget => {
|
|
10021
|
+
const commands = renderFull$2(widget.oldState, widget.newState);
|
|
10084
10022
|
const wrappedCommands = [];
|
|
10085
10023
|
const {
|
|
10086
10024
|
uid
|
|
@@ -10095,27 +10033,27 @@ const render$8 = widget => {
|
|
|
10095
10033
|
}
|
|
10096
10034
|
return wrappedCommands;
|
|
10097
10035
|
};
|
|
10098
|
-
const add$
|
|
10099
|
-
return addWidget$1(widget, 'EditorCodeGenerator', render$
|
|
10036
|
+
const add$5 = widget => {
|
|
10037
|
+
return addWidget$1(widget, 'EditorCodeGenerator', render$7);
|
|
10100
10038
|
};
|
|
10101
|
-
const remove$
|
|
10039
|
+
const remove$5 = removeWidget;
|
|
10102
10040
|
|
|
10103
10041
|
const EditorCodeGeneratorWidget = {
|
|
10104
10042
|
__proto__: null,
|
|
10105
|
-
add: add$
|
|
10106
|
-
remove: remove$
|
|
10107
|
-
render: render$
|
|
10043
|
+
add: add$5,
|
|
10044
|
+
remove: remove$5,
|
|
10045
|
+
render: render$7
|
|
10108
10046
|
};
|
|
10109
10047
|
|
|
10110
|
-
const renderFull$
|
|
10048
|
+
const renderFull$1 = (oldState, newState) => {
|
|
10111
10049
|
const commands = [...newState.commands];
|
|
10112
10050
|
// @ts-ignore
|
|
10113
10051
|
newState.commands = [];
|
|
10114
10052
|
return commands;
|
|
10115
10053
|
};
|
|
10116
10054
|
|
|
10117
|
-
const render$
|
|
10118
|
-
const commands = renderFull$
|
|
10055
|
+
const render$6 = widget => {
|
|
10056
|
+
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
10119
10057
|
const wrappedCommands = [];
|
|
10120
10058
|
const {
|
|
10121
10059
|
uid
|
|
@@ -10129,18 +10067,18 @@ const render$7 = widget => {
|
|
|
10129
10067
|
}
|
|
10130
10068
|
return wrappedCommands;
|
|
10131
10069
|
};
|
|
10132
|
-
const add$
|
|
10133
|
-
return addWidget$1(widget, 'ColorPicker', render$
|
|
10070
|
+
const add$4 = widget => {
|
|
10071
|
+
return addWidget$1(widget, 'ColorPicker', render$6);
|
|
10134
10072
|
};
|
|
10135
|
-
const remove$
|
|
10136
|
-
const Commands
|
|
10073
|
+
const remove$4 = removeWidget;
|
|
10074
|
+
const Commands = {};
|
|
10137
10075
|
|
|
10138
10076
|
const EditorColorPickerWidget = {
|
|
10139
10077
|
__proto__: null,
|
|
10140
|
-
Commands
|
|
10141
|
-
add: add$
|
|
10142
|
-
remove: remove$
|
|
10143
|
-
render: render$
|
|
10078
|
+
Commands,
|
|
10079
|
+
add: add$4,
|
|
10080
|
+
remove: remove$4,
|
|
10081
|
+
render: render$6
|
|
10144
10082
|
};
|
|
10145
10083
|
|
|
10146
10084
|
const getCompletionDetailVirtualDom = content => {
|
|
@@ -10198,9 +10136,9 @@ const renderBounds$1 = {
|
|
|
10198
10136
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
10199
10137
|
}
|
|
10200
10138
|
};
|
|
10201
|
-
const render$
|
|
10202
|
-
const renderFull
|
|
10203
|
-
return renderParts(render$
|
|
10139
|
+
const render$5 = [renderContent, renderBounds$1];
|
|
10140
|
+
const renderFull = (oldState, newState) => {
|
|
10141
|
+
return renderParts(render$5, oldState, newState);
|
|
10204
10142
|
};
|
|
10205
10143
|
|
|
10206
10144
|
const getWidgetState = (editor, id) => {
|
|
@@ -10219,8 +10157,8 @@ const getCompletionState = editor => {
|
|
|
10219
10157
|
return getWidgetState(editor, Completion);
|
|
10220
10158
|
};
|
|
10221
10159
|
|
|
10222
|
-
const render$
|
|
10223
|
-
const commands = renderFull
|
|
10160
|
+
const render$4 = widget => {
|
|
10161
|
+
const commands = renderFull(widget.oldState, widget.newState);
|
|
10224
10162
|
const wrappedCommands = [];
|
|
10225
10163
|
const {
|
|
10226
10164
|
uid
|
|
@@ -10234,10 +10172,10 @@ const render$5 = widget => {
|
|
|
10234
10172
|
}
|
|
10235
10173
|
return wrappedCommands;
|
|
10236
10174
|
};
|
|
10237
|
-
const add$
|
|
10238
|
-
return addWidget$1(widget, 'EditorCompletionDetails', render$
|
|
10175
|
+
const add$3 = widget => {
|
|
10176
|
+
return addWidget$1(widget, 'EditorCompletionDetails', render$4);
|
|
10239
10177
|
};
|
|
10240
|
-
const remove$
|
|
10178
|
+
const remove$3 = removeWidget;
|
|
10241
10179
|
const handleEditorType = (editor, state) => {
|
|
10242
10180
|
const completionState = getCompletionState(editor);
|
|
10243
10181
|
if (!completionState) {
|
|
@@ -10269,47 +10207,9 @@ const handleEditorDeleteLeft = (editor, state) => {
|
|
|
10269
10207
|
|
|
10270
10208
|
const EditorCompletionDetailWidget = {
|
|
10271
10209
|
__proto__: null,
|
|
10272
|
-
add: add$
|
|
10210
|
+
add: add$3,
|
|
10273
10211
|
handleEditorDeleteLeft,
|
|
10274
10212
|
handleEditorType,
|
|
10275
|
-
remove: remove$4,
|
|
10276
|
-
render: render$5
|
|
10277
|
-
};
|
|
10278
|
-
|
|
10279
|
-
const renderFull = (oldState, newState) => {
|
|
10280
|
-
const commands = [...newState.commands];
|
|
10281
|
-
// @ts-ignore
|
|
10282
|
-
newState.commands = [];
|
|
10283
|
-
return commands;
|
|
10284
|
-
};
|
|
10285
|
-
|
|
10286
|
-
const render$4 = widget => {
|
|
10287
|
-
const commands = renderFull(widget.oldState, widget.newState);
|
|
10288
|
-
const wrappedCommands = [];
|
|
10289
|
-
const {
|
|
10290
|
-
uid
|
|
10291
|
-
} = widget.newState;
|
|
10292
|
-
for (const command of commands) {
|
|
10293
|
-
if (command[0] === SetDom2 || command[0] === SetCss || command[0] === AppendToBody || command[0] === SetBounds2 || command[0] === RegisterEventListeners || command[0] === SetSelectionByName || command[0] === SetValueByName || command[0] === SetFocusContext || command[0] === SetUid || command[0] === 'Viewlet.focusSelector') {
|
|
10294
|
-
wrappedCommands.push(command);
|
|
10295
|
-
} else {
|
|
10296
|
-
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
10297
|
-
}
|
|
10298
|
-
}
|
|
10299
|
-
return wrappedCommands;
|
|
10300
|
-
};
|
|
10301
|
-
const add$3 = widget => {
|
|
10302
|
-
return addWidget$1(widget, 'FindWidget', render$4);
|
|
10303
|
-
};
|
|
10304
|
-
const remove$3 = widget => {
|
|
10305
|
-
return [['Viewlet.dispose', widget.newState.uid]];
|
|
10306
|
-
};
|
|
10307
|
-
const Commands = {};
|
|
10308
|
-
|
|
10309
|
-
const EditorFindWidget = {
|
|
10310
|
-
__proto__: null,
|
|
10311
|
-
Commands,
|
|
10312
|
-
add: add$3,
|
|
10313
10213
|
remove: remove$3,
|
|
10314
10214
|
render: render$4
|
|
10315
10215
|
};
|
|
@@ -10505,14 +10405,14 @@ const EditorSourceActionWidget = {
|
|
|
10505
10405
|
};
|
|
10506
10406
|
|
|
10507
10407
|
const registerWidgets = () => {
|
|
10508
|
-
set$
|
|
10509
|
-
set$
|
|
10510
|
-
set$
|
|
10511
|
-
set$
|
|
10512
|
-
set$
|
|
10513
|
-
set$
|
|
10514
|
-
set$
|
|
10515
|
-
set$
|
|
10408
|
+
set$7(ColorPicker, EditorColorPickerWidget);
|
|
10409
|
+
set$7(Completion, EditorCompletionWidget);
|
|
10410
|
+
set$7(CompletionDetail, EditorCompletionDetailWidget);
|
|
10411
|
+
set$7(Find, EditorFindWidget);
|
|
10412
|
+
set$7(Hover, EditorHoverWidget);
|
|
10413
|
+
set$7(Rename, EditorRenameWidget);
|
|
10414
|
+
set$7(SourceAction$1, EditorSourceActionWidget);
|
|
10415
|
+
set$7(CodeGenerator, EditorCodeGeneratorWidget);
|
|
10516
10416
|
};
|
|
10517
10417
|
|
|
10518
10418
|
const handleUnhandledRejection = event => {
|