@lvce-editor/file-search-worker 3.0.0 → 3.2.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/fileSearchWorkerMain.js +1939 -930
- package/package.json +1 -1
|
@@ -1,3 +1,387 @@
|
|
|
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;
|
|
9
|
+
};
|
|
10
|
+
const getCombinedMessage = (error, message) => {
|
|
11
|
+
const stringifiedError = normalizeLine(`${error}`);
|
|
12
|
+
if (message) {
|
|
13
|
+
return `${message}: ${stringifiedError}`;
|
|
14
|
+
}
|
|
15
|
+
return stringifiedError;
|
|
16
|
+
};
|
|
17
|
+
const NewLine$2 = '\n';
|
|
18
|
+
const getNewLineIndex$1 = (string, startIndex = undefined) => {
|
|
19
|
+
return string.indexOf(NewLine$2, startIndex);
|
|
20
|
+
};
|
|
21
|
+
const mergeStacks = (parent, child) => {
|
|
22
|
+
if (!child) {
|
|
23
|
+
return parent;
|
|
24
|
+
}
|
|
25
|
+
const parentNewLineIndex = getNewLineIndex$1(parent);
|
|
26
|
+
const childNewLineIndex = getNewLineIndex$1(child);
|
|
27
|
+
if (childNewLineIndex === -1) {
|
|
28
|
+
return parent;
|
|
29
|
+
}
|
|
30
|
+
const parentFirstLine = parent.slice(0, parentNewLineIndex);
|
|
31
|
+
const childRest = child.slice(childNewLineIndex);
|
|
32
|
+
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
33
|
+
if (parentFirstLine.includes(childFirstLine)) {
|
|
34
|
+
return parentFirstLine + childRest;
|
|
35
|
+
}
|
|
36
|
+
return child;
|
|
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
|
+
}
|
|
56
|
+
|
|
57
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
58
|
+
if (!value) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (isTransferrable(value)) {
|
|
62
|
+
transferrables.push(value);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
for (const item of value) {
|
|
67
|
+
walkValue(item, transferrables, isTransferrable);
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (typeof value === 'object') {
|
|
72
|
+
for (const property of Object.values(value)) {
|
|
73
|
+
walkValue(property, transferrables, isTransferrable);
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const isMessagePort = value => {
|
|
79
|
+
return value && value instanceof MessagePort;
|
|
80
|
+
};
|
|
81
|
+
const isMessagePortMain = value => {
|
|
82
|
+
return value && value.constructor && value.constructor.name === 'MessagePortMain';
|
|
83
|
+
};
|
|
84
|
+
const isOffscreenCanvas = value => {
|
|
85
|
+
return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
|
|
86
|
+
};
|
|
87
|
+
const isInstanceOf = (value, constructorName) => {
|
|
88
|
+
return value?.constructor?.name === constructorName;
|
|
89
|
+
};
|
|
90
|
+
const isSocket = value => {
|
|
91
|
+
return isInstanceOf(value, 'Socket');
|
|
92
|
+
};
|
|
93
|
+
const transferrables = [isMessagePort, isMessagePortMain, isOffscreenCanvas, isSocket];
|
|
94
|
+
const isTransferrable = value => {
|
|
95
|
+
for (const fn of transferrables) {
|
|
96
|
+
if (fn(value)) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
};
|
|
102
|
+
const getTransferrables = value => {
|
|
103
|
+
const transferrables = [];
|
|
104
|
+
walkValue(value, transferrables, isTransferrable);
|
|
105
|
+
return transferrables;
|
|
106
|
+
};
|
|
107
|
+
const attachEvents = that => {
|
|
108
|
+
const handleMessage = (...args) => {
|
|
109
|
+
const data = that.getData(...args);
|
|
110
|
+
that.dispatchEvent(new MessageEvent('message', {
|
|
111
|
+
data
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
that.onMessage(handleMessage);
|
|
115
|
+
const handleClose = event => {
|
|
116
|
+
that.dispatchEvent(new Event('close'));
|
|
117
|
+
};
|
|
118
|
+
that.onClose(handleClose);
|
|
119
|
+
};
|
|
120
|
+
class Ipc extends EventTarget {
|
|
121
|
+
constructor(rawIpc) {
|
|
122
|
+
super();
|
|
123
|
+
this._rawIpc = rawIpc;
|
|
124
|
+
attachEvents(this);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
128
|
+
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
129
|
+
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
130
|
+
const NewLine$1 = '\n';
|
|
131
|
+
const joinLines$1 = lines => {
|
|
132
|
+
return lines.join(NewLine$1);
|
|
133
|
+
};
|
|
134
|
+
const splitLines$2 = lines => {
|
|
135
|
+
return lines.split(NewLine$1);
|
|
136
|
+
};
|
|
137
|
+
const isModuleNotFoundMessage = line => {
|
|
138
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
139
|
+
};
|
|
140
|
+
const getModuleNotFoundError = stderr => {
|
|
141
|
+
const lines = splitLines$2(stderr);
|
|
142
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
143
|
+
const message = lines[messageIndex];
|
|
144
|
+
return {
|
|
145
|
+
message,
|
|
146
|
+
code: ERR_MODULE_NOT_FOUND
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
150
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
151
|
+
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
152
|
+
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
153
|
+
const RE_AT = /^\s+at/;
|
|
154
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
155
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
156
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
157
|
+
};
|
|
158
|
+
const isMessageCodeBlockStartIndex = line => {
|
|
159
|
+
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
160
|
+
};
|
|
161
|
+
const isMessageCodeBlockEndIndex = line => {
|
|
162
|
+
return RE_MESSAGE_CODE_BLOCK_END.test(line);
|
|
163
|
+
};
|
|
164
|
+
const getMessageCodeBlock = stderr => {
|
|
165
|
+
const lines = splitLines$2(stderr);
|
|
166
|
+
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
167
|
+
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
168
|
+
const relevantLines = lines.slice(startIndex, endIndex);
|
|
169
|
+
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
170
|
+
return relevantMessage;
|
|
171
|
+
};
|
|
172
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
173
|
+
const message = getMessageCodeBlock(stderr);
|
|
174
|
+
return {
|
|
175
|
+
message: `Incompatible native node module: ${message}`,
|
|
176
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
const isModulesSyntaxError = stderr => {
|
|
180
|
+
if (!stderr) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
184
|
+
};
|
|
185
|
+
const getModuleSyntaxError = () => {
|
|
186
|
+
return {
|
|
187
|
+
message: `ES Modules are not supported in electron`,
|
|
188
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
const isModuleNotFoundError = stderr => {
|
|
192
|
+
if (!stderr) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
196
|
+
};
|
|
197
|
+
const isNormalStackLine = line => {
|
|
198
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
199
|
+
};
|
|
200
|
+
const getDetails = lines => {
|
|
201
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
202
|
+
if (index === -1) {
|
|
203
|
+
return {
|
|
204
|
+
actualMessage: joinLines$1(lines),
|
|
205
|
+
rest: []
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
let lastIndex = index - 1;
|
|
209
|
+
while (++lastIndex < lines.length) {
|
|
210
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
actualMessage: lines[index - 1],
|
|
216
|
+
rest: lines.slice(index, lastIndex)
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
220
|
+
if (isUnhelpfulNativeModuleError(stderr)) {
|
|
221
|
+
return getNativeModuleErrorMessage(stderr);
|
|
222
|
+
}
|
|
223
|
+
if (isModulesSyntaxError(stderr)) {
|
|
224
|
+
return getModuleSyntaxError();
|
|
225
|
+
}
|
|
226
|
+
if (isModuleNotFoundError(stderr)) {
|
|
227
|
+
return getModuleNotFoundError(stderr);
|
|
228
|
+
}
|
|
229
|
+
const lines = splitLines$2(stderr);
|
|
230
|
+
const {
|
|
231
|
+
actualMessage,
|
|
232
|
+
rest
|
|
233
|
+
} = getDetails(lines);
|
|
234
|
+
return {
|
|
235
|
+
message: `${actualMessage}`,
|
|
236
|
+
code: '',
|
|
237
|
+
stack: rest
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
class IpcError extends VError {
|
|
241
|
+
// @ts-ignore
|
|
242
|
+
constructor(betterMessage, stdout = '', stderr = '') {
|
|
243
|
+
if (stdout || stderr) {
|
|
244
|
+
// @ts-ignore
|
|
245
|
+
const {
|
|
246
|
+
message,
|
|
247
|
+
code,
|
|
248
|
+
stack
|
|
249
|
+
} = getHelpfulChildProcessError(stdout, stderr);
|
|
250
|
+
const cause = new Error(message);
|
|
251
|
+
// @ts-ignore
|
|
252
|
+
cause.code = code;
|
|
253
|
+
cause.stack = stack;
|
|
254
|
+
super(cause, betterMessage);
|
|
255
|
+
} else {
|
|
256
|
+
super(betterMessage);
|
|
257
|
+
}
|
|
258
|
+
// @ts-ignore
|
|
259
|
+
this.name = 'IpcError';
|
|
260
|
+
// @ts-ignore
|
|
261
|
+
this.stdout = stdout;
|
|
262
|
+
// @ts-ignore
|
|
263
|
+
this.stderr = stderr;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const readyMessage = 'ready';
|
|
267
|
+
const getData$2 = event => {
|
|
268
|
+
return event.data;
|
|
269
|
+
};
|
|
270
|
+
const listen$6 = () => {
|
|
271
|
+
// @ts-ignore
|
|
272
|
+
if (typeof WorkerGlobalScope === 'undefined') {
|
|
273
|
+
throw new TypeError('module is not in web worker scope');
|
|
274
|
+
}
|
|
275
|
+
return globalThis;
|
|
276
|
+
};
|
|
277
|
+
const signal$6 = global => {
|
|
278
|
+
global.postMessage(readyMessage);
|
|
279
|
+
};
|
|
280
|
+
class IpcChildWithModuleWorker extends Ipc {
|
|
281
|
+
getData(event) {
|
|
282
|
+
return getData$2(event);
|
|
283
|
+
}
|
|
284
|
+
send(message) {
|
|
285
|
+
// @ts-ignore
|
|
286
|
+
this._rawIpc.postMessage(message);
|
|
287
|
+
}
|
|
288
|
+
sendAndTransfer(message) {
|
|
289
|
+
const transfer = getTransferrables(message);
|
|
290
|
+
// @ts-ignore
|
|
291
|
+
this._rawIpc.postMessage(message, transfer);
|
|
292
|
+
}
|
|
293
|
+
dispose() {
|
|
294
|
+
// ignore
|
|
295
|
+
}
|
|
296
|
+
onClose(callback) {
|
|
297
|
+
// ignore
|
|
298
|
+
}
|
|
299
|
+
onMessage(callback) {
|
|
300
|
+
this._rawIpc.addEventListener('message', callback);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const wrap$d = global => {
|
|
304
|
+
return new IpcChildWithModuleWorker(global);
|
|
305
|
+
};
|
|
306
|
+
const withResolvers = () => {
|
|
307
|
+
let _resolve;
|
|
308
|
+
const promise = new Promise(resolve => {
|
|
309
|
+
_resolve = resolve;
|
|
310
|
+
});
|
|
311
|
+
return {
|
|
312
|
+
resolve: _resolve,
|
|
313
|
+
promise
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
const waitForFirstMessage = async port => {
|
|
317
|
+
const {
|
|
318
|
+
resolve,
|
|
319
|
+
promise
|
|
320
|
+
} = withResolvers();
|
|
321
|
+
port.addEventListener('message', resolve, {
|
|
322
|
+
once: true
|
|
323
|
+
});
|
|
324
|
+
const event = await promise;
|
|
325
|
+
// @ts-ignore
|
|
326
|
+
return event.data;
|
|
327
|
+
};
|
|
328
|
+
const listen$5 = async () => {
|
|
329
|
+
const parentIpcRaw = listen$6();
|
|
330
|
+
signal$6(parentIpcRaw);
|
|
331
|
+
const parentIpc = wrap$d(parentIpcRaw);
|
|
332
|
+
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
333
|
+
if (firstMessage.method !== 'initialize') {
|
|
334
|
+
throw new IpcError('unexpected first message');
|
|
335
|
+
}
|
|
336
|
+
const type = firstMessage.params[0];
|
|
337
|
+
if (type === 'message-port') {
|
|
338
|
+
parentIpc.send({
|
|
339
|
+
jsonrpc: '2.0',
|
|
340
|
+
id: firstMessage.id,
|
|
341
|
+
result: null
|
|
342
|
+
});
|
|
343
|
+
parentIpc.dispose();
|
|
344
|
+
const port = firstMessage.params[1];
|
|
345
|
+
return port;
|
|
346
|
+
}
|
|
347
|
+
return globalThis;
|
|
348
|
+
};
|
|
349
|
+
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
350
|
+
constructor(port) {
|
|
351
|
+
super(port);
|
|
352
|
+
}
|
|
353
|
+
getData(event) {
|
|
354
|
+
return getData$2(event);
|
|
355
|
+
}
|
|
356
|
+
send(message) {
|
|
357
|
+
this._rawIpc.postMessage(message);
|
|
358
|
+
}
|
|
359
|
+
sendAndTransfer(message) {
|
|
360
|
+
const transfer = getTransferrables(message);
|
|
361
|
+
this._rawIpc.postMessage(message, transfer);
|
|
362
|
+
}
|
|
363
|
+
dispose() {
|
|
364
|
+
if (this._rawIpc.close) {
|
|
365
|
+
this._rawIpc.close();
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
onClose(callback) {
|
|
369
|
+
// ignore
|
|
370
|
+
}
|
|
371
|
+
onMessage(callback) {
|
|
372
|
+
this._rawIpc.addEventListener('message', callback);
|
|
373
|
+
this._rawIpc.start();
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
const wrap$c = port => {
|
|
377
|
+
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
378
|
+
};
|
|
379
|
+
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
380
|
+
__proto__: null,
|
|
381
|
+
listen: listen$5,
|
|
382
|
+
wrap: wrap$c
|
|
383
|
+
};
|
|
384
|
+
|
|
1
385
|
const Two = '2.0';
|
|
2
386
|
const create$4 = (method, params) => {
|
|
3
387
|
return {
|
|
@@ -6,23 +390,21 @@ const create$4 = (method, params) => {
|
|
|
6
390
|
params
|
|
7
391
|
};
|
|
8
392
|
};
|
|
9
|
-
const
|
|
10
|
-
callbacks: Object.create(null)
|
|
11
|
-
};
|
|
393
|
+
const callbacks = Object.create(null);
|
|
12
394
|
const set = (id, fn) => {
|
|
13
|
-
|
|
395
|
+
callbacks[id] = fn;
|
|
14
396
|
};
|
|
15
397
|
const get = id => {
|
|
16
|
-
return
|
|
398
|
+
return callbacks[id];
|
|
17
399
|
};
|
|
18
400
|
const remove$2 = id => {
|
|
19
|
-
delete
|
|
401
|
+
delete callbacks[id];
|
|
20
402
|
};
|
|
21
403
|
let id = 0;
|
|
22
404
|
const create$3 = () => {
|
|
23
405
|
return ++id;
|
|
24
406
|
};
|
|
25
|
-
const warn = (...args) => {
|
|
407
|
+
const warn$1 = (...args) => {
|
|
26
408
|
console.warn(...args);
|
|
27
409
|
};
|
|
28
410
|
const registerPromise = () => {
|
|
@@ -41,7 +423,7 @@ const resolve = (id, response) => {
|
|
|
41
423
|
const fn = get(id);
|
|
42
424
|
if (!fn) {
|
|
43
425
|
console.log(response);
|
|
44
|
-
warn(`callback ${id} may already be disposed`);
|
|
426
|
+
warn$1(`callback ${id} may already be disposed`);
|
|
45
427
|
return;
|
|
46
428
|
}
|
|
47
429
|
fn(response);
|
|
@@ -69,7 +451,7 @@ class JsonRpcError extends Error {
|
|
|
69
451
|
this.name = 'JsonRpcError';
|
|
70
452
|
}
|
|
71
453
|
}
|
|
72
|
-
const NewLine
|
|
454
|
+
const NewLine = '\n';
|
|
73
455
|
const DomException = 'DOMException';
|
|
74
456
|
const ReferenceError$1 = 'ReferenceError';
|
|
75
457
|
const SyntaxError$1 = 'SyntaxError';
|
|
@@ -114,40 +496,40 @@ const constructError = (message, type, name) => {
|
|
|
114
496
|
}
|
|
115
497
|
return new ErrorConstructor(message);
|
|
116
498
|
};
|
|
117
|
-
const getNewLineIndex
|
|
118
|
-
return string.indexOf(NewLine
|
|
499
|
+
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
500
|
+
return string.indexOf(NewLine, startIndex);
|
|
119
501
|
};
|
|
120
502
|
const getParentStack = error => {
|
|
121
503
|
let parentStack = error.stack || error.data || error.message || '';
|
|
122
504
|
if (parentStack.startsWith(' at')) {
|
|
123
|
-
parentStack = error.message + NewLine
|
|
505
|
+
parentStack = error.message + NewLine + parentStack;
|
|
124
506
|
}
|
|
125
507
|
return parentStack;
|
|
126
508
|
};
|
|
127
|
-
const joinLines
|
|
128
|
-
return lines.join(NewLine
|
|
509
|
+
const joinLines = lines => {
|
|
510
|
+
return lines.join(NewLine);
|
|
129
511
|
};
|
|
130
512
|
const MethodNotFound = -32601;
|
|
131
|
-
const Custom = -32001;
|
|
132
|
-
const splitLines$
|
|
133
|
-
return lines.split(NewLine
|
|
513
|
+
const Custom$1 = -32001;
|
|
514
|
+
const splitLines$1 = lines => {
|
|
515
|
+
return lines.split(NewLine);
|
|
134
516
|
};
|
|
135
517
|
const restoreJsonRpcError = error => {
|
|
136
518
|
if (error && error instanceof Error) {
|
|
137
519
|
return error;
|
|
138
520
|
}
|
|
139
|
-
const currentStack = joinLines
|
|
521
|
+
const currentStack = joinLines(splitLines$1(new Error().stack || '').slice(1));
|
|
140
522
|
if (error && error.code && error.code === MethodNotFound) {
|
|
141
523
|
const restoredError = new JsonRpcError(error.message);
|
|
142
524
|
const parentStack = getParentStack(error);
|
|
143
|
-
restoredError.stack = parentStack + NewLine
|
|
525
|
+
restoredError.stack = parentStack + NewLine + currentStack;
|
|
144
526
|
return restoredError;
|
|
145
527
|
}
|
|
146
528
|
if (error && error.message) {
|
|
147
529
|
const restoredError = constructError(error.message, error.type, error.name);
|
|
148
530
|
if (error.data) {
|
|
149
531
|
if (error.data.stack && error.data.type && error.message) {
|
|
150
|
-
restoredError.stack = error.data.type + ': ' + error.message + NewLine
|
|
532
|
+
restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
|
|
151
533
|
} else if (error.data.stack) {
|
|
152
534
|
restoredError.stack = error.data.stack;
|
|
153
535
|
}
|
|
@@ -167,7 +549,7 @@ const restoreJsonRpcError = error => {
|
|
|
167
549
|
if (error.stack) {
|
|
168
550
|
const lowerStack = restoredError.stack || '';
|
|
169
551
|
// @ts-ignore
|
|
170
|
-
const indexNewLine = getNewLineIndex
|
|
552
|
+
const indexNewLine = getNewLineIndex(lowerStack);
|
|
171
553
|
const parentStack = getParentStack(error);
|
|
172
554
|
// @ts-ignore
|
|
173
555
|
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
@@ -213,7 +595,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
213
595
|
};
|
|
214
596
|
}
|
|
215
597
|
return {
|
|
216
|
-
code: Custom,
|
|
598
|
+
code: Custom$1,
|
|
217
599
|
message: prettyError.message,
|
|
218
600
|
data: {
|
|
219
601
|
stack: prettyError.stack,
|
|
@@ -224,7 +606,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
224
606
|
}
|
|
225
607
|
};
|
|
226
608
|
};
|
|
227
|
-
const create$1
|
|
609
|
+
const create$1 = (message, error) => {
|
|
228
610
|
return {
|
|
229
611
|
jsonrpc: Two,
|
|
230
612
|
id: message.id,
|
|
@@ -235,9 +617,9 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
|
|
|
235
617
|
const prettyError = preparePrettyError(error);
|
|
236
618
|
logError(error, prettyError);
|
|
237
619
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
238
|
-
return create$1
|
|
620
|
+
return create$1(message, errorProperty);
|
|
239
621
|
};
|
|
240
|
-
const create = (message, result) => {
|
|
622
|
+
const create$5 = (message, result) => {
|
|
241
623
|
return {
|
|
242
624
|
jsonrpc: Two,
|
|
243
625
|
id: message.id,
|
|
@@ -246,7 +628,7 @@ const create = (message, result) => {
|
|
|
246
628
|
};
|
|
247
629
|
const getSuccessResponse = (message, result) => {
|
|
248
630
|
const resultProperty = result ?? null;
|
|
249
|
-
return create(message, resultProperty);
|
|
631
|
+
return create$5(message, resultProperty);
|
|
250
632
|
};
|
|
251
633
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
252
634
|
try {
|
|
@@ -353,7 +735,7 @@ const register = commandMap => {
|
|
|
353
735
|
const getCommand = key => {
|
|
354
736
|
return commands[key];
|
|
355
737
|
};
|
|
356
|
-
const execute = (command, ...args) => {
|
|
738
|
+
const execute$1 = (command, ...args) => {
|
|
357
739
|
const fn = getCommand(command);
|
|
358
740
|
if (!fn) {
|
|
359
741
|
throw new Error(`command not found ${command}`);
|
|
@@ -361,774 +743,1104 @@ const execute = (command, ...args) => {
|
|
|
361
743
|
return fn(...args);
|
|
362
744
|
};
|
|
363
745
|
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
746
|
+
const createRpc = ipc => {
|
|
747
|
+
const rpc = {
|
|
748
|
+
/**
|
|
749
|
+
* @deprecated
|
|
750
|
+
*/
|
|
751
|
+
send(method, ...params) {
|
|
752
|
+
send(ipc, method, ...params);
|
|
753
|
+
},
|
|
754
|
+
invoke(method, ...params) {
|
|
755
|
+
return invoke$2(ipc, method, ...params);
|
|
756
|
+
},
|
|
757
|
+
invokeAndTransfer(method, ...params) {
|
|
758
|
+
return invokeAndTransfer(ipc, method, ...params);
|
|
759
|
+
}
|
|
377
760
|
};
|
|
378
|
-
|
|
761
|
+
return rpc;
|
|
379
762
|
};
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
763
|
+
const requiresSocket = () => {
|
|
764
|
+
return false;
|
|
765
|
+
};
|
|
766
|
+
const preparePrettyError = error => {
|
|
767
|
+
return error;
|
|
768
|
+
};
|
|
769
|
+
const logError = () => {
|
|
770
|
+
// handled by renderer worker
|
|
771
|
+
};
|
|
772
|
+
const handleMessage = event => {
|
|
773
|
+
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
774
|
+
return handleJsonRpcMessage(event.target, event.data, execute$1, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
775
|
+
};
|
|
776
|
+
const handleIpc = ipc => {
|
|
777
|
+
if ('addEventListener' in ipc) {
|
|
778
|
+
ipc.addEventListener('message', handleMessage);
|
|
779
|
+
} else if ('on' in ipc) {
|
|
780
|
+
// deprecated
|
|
781
|
+
ipc.on('message', handleMessage);
|
|
395
782
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
783
|
+
};
|
|
784
|
+
const listen$1 = async (module, options) => {
|
|
785
|
+
const rawIpc = await module.listen(options);
|
|
786
|
+
if (module.signal) {
|
|
787
|
+
module.signal(rawIpc);
|
|
401
788
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
789
|
+
const ipc = module.wrap(rawIpc);
|
|
790
|
+
return ipc;
|
|
791
|
+
};
|
|
792
|
+
const create = async ({
|
|
793
|
+
commandMap
|
|
794
|
+
}) => {
|
|
795
|
+
// TODO create a commandMap per rpc instance
|
|
796
|
+
register(commandMap);
|
|
797
|
+
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
798
|
+
handleIpc(ipc);
|
|
799
|
+
const rpc = createRpc(ipc);
|
|
800
|
+
return rpc;
|
|
801
|
+
};
|
|
802
|
+
const WebWorkerRpcClient = {
|
|
803
|
+
__proto__: null,
|
|
804
|
+
create
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
const assetDir = '';
|
|
808
|
+
|
|
809
|
+
const Directory$1 = 3;
|
|
810
|
+
const File$2 = 7;
|
|
811
|
+
|
|
812
|
+
const fileMapUrl = `${assetDir}/config/fileMap.json`;
|
|
813
|
+
|
|
814
|
+
const getJson = async url => {
|
|
815
|
+
try {
|
|
816
|
+
const response = await fetch(url);
|
|
817
|
+
if (!response.ok) {
|
|
818
|
+
throw new Error(response.statusText);
|
|
405
819
|
}
|
|
406
|
-
|
|
820
|
+
const text = await response.json();
|
|
821
|
+
return text;
|
|
822
|
+
} catch (error) {
|
|
823
|
+
throw new VError(error, `Failed to request json for ${url}`);
|
|
407
824
|
}
|
|
408
825
|
};
|
|
409
|
-
|
|
410
|
-
|
|
826
|
+
|
|
827
|
+
const getText = async url => {
|
|
828
|
+
try {
|
|
829
|
+
const response = await fetch(url);
|
|
830
|
+
if (!response.ok) {
|
|
831
|
+
throw new Error(response.statusText);
|
|
832
|
+
}
|
|
833
|
+
const text = await response.text();
|
|
834
|
+
return text;
|
|
835
|
+
} catch (error) {
|
|
836
|
+
throw new VError(error, `Failed to request text for ${url}`);
|
|
837
|
+
}
|
|
411
838
|
};
|
|
412
|
-
|
|
413
|
-
|
|
839
|
+
|
|
840
|
+
const Slash$1 = '/';
|
|
841
|
+
|
|
842
|
+
const Slash = Slash$1;
|
|
843
|
+
|
|
844
|
+
// TODO move all of this to an extension
|
|
845
|
+
|
|
846
|
+
const readFile$1 = async uri => {
|
|
847
|
+
const fetchUri = `${assetDir}${uri}`;
|
|
848
|
+
const text = await getText(fetchUri);
|
|
849
|
+
return text;
|
|
414
850
|
};
|
|
415
|
-
const
|
|
416
|
-
|
|
851
|
+
const writeFile$1 = () => {
|
|
852
|
+
throw new Error('not implemented');
|
|
417
853
|
};
|
|
418
|
-
const
|
|
419
|
-
|
|
854
|
+
const mkdir$1 = () => {
|
|
855
|
+
throw new Error('not implemented');
|
|
420
856
|
};
|
|
421
|
-
const
|
|
422
|
-
|
|
857
|
+
const remove$1 = () => {
|
|
858
|
+
throw new Error('not implemented');
|
|
423
859
|
};
|
|
424
|
-
const
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
860
|
+
const readDirWithFileTypes$1 = async uri => {
|
|
861
|
+
const fileList = await getJson(fileMapUrl);
|
|
862
|
+
const dirents = [];
|
|
863
|
+
for (const fileUri of fileList) {
|
|
864
|
+
if (fileUri.startsWith(uri)) {
|
|
865
|
+
const rest = fileUri.slice(uri.length + 1);
|
|
866
|
+
if (rest.includes(Slash)) {
|
|
867
|
+
const name = rest.slice(0, rest.indexOf(Slash));
|
|
868
|
+
if (dirents.some(dirent => dirent.name === name)) {
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
dirents.push({
|
|
872
|
+
type: Directory$1,
|
|
873
|
+
name
|
|
874
|
+
});
|
|
875
|
+
} else {
|
|
876
|
+
dirents.push({
|
|
877
|
+
type: File$2,
|
|
878
|
+
name: rest
|
|
879
|
+
});
|
|
880
|
+
}
|
|
429
881
|
}
|
|
430
882
|
}
|
|
431
|
-
return
|
|
432
|
-
};
|
|
433
|
-
const getTransferrables = value => {
|
|
434
|
-
const transferrables = [];
|
|
435
|
-
walkValue(value, transferrables, isTransferrable);
|
|
436
|
-
return transferrables;
|
|
883
|
+
return dirents;
|
|
437
884
|
};
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
if (typeof WorkerGlobalScope === 'undefined') {
|
|
441
|
-
throw new TypeError('module is not in web worker scope');
|
|
442
|
-
}
|
|
443
|
-
return globalThis;
|
|
885
|
+
const chmod$1 = () => {
|
|
886
|
+
throw new Error('[memfs] chmod not implemented');
|
|
444
887
|
};
|
|
445
|
-
const
|
|
446
|
-
|
|
888
|
+
const getBlob$1 = async uri => {
|
|
889
|
+
const content = await readFile$1(uri);
|
|
890
|
+
const blob = new Blob([content]);
|
|
891
|
+
return blob;
|
|
447
892
|
};
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
893
|
+
|
|
894
|
+
class FileNotFoundError extends Error {
|
|
895
|
+
constructor(uri) {
|
|
896
|
+
super(`File not found: ${uri}`);
|
|
897
|
+
this.code = 'ENOENT';
|
|
451
898
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
const ApplicationJson = 'application/json';
|
|
902
|
+
const AudioMpeg = 'audio/mpeg';
|
|
903
|
+
const FontTtf = 'font/ttf';
|
|
904
|
+
const ImagePng = 'image/png';
|
|
905
|
+
const ImageSvgXml = 'image/svg+xml';
|
|
906
|
+
const TextCss = 'text/css';
|
|
907
|
+
const TextHtml = 'text/html';
|
|
908
|
+
const TextJavaScript = 'text/javascript';
|
|
909
|
+
const TextPlain = 'text/plain';
|
|
910
|
+
const VideoWebm = 'video/webm';
|
|
911
|
+
|
|
912
|
+
const getMimeType = fileExtension => {
|
|
913
|
+
switch (fileExtension) {
|
|
914
|
+
case '.html':
|
|
915
|
+
return TextHtml;
|
|
916
|
+
case '.css':
|
|
917
|
+
return TextCss;
|
|
918
|
+
case '.ttf':
|
|
919
|
+
return FontTtf;
|
|
920
|
+
case '.js':
|
|
921
|
+
case '.mjs':
|
|
922
|
+
case '.ts':
|
|
923
|
+
return TextJavaScript;
|
|
924
|
+
case '.svg':
|
|
925
|
+
return ImageSvgXml;
|
|
926
|
+
case '.png':
|
|
927
|
+
return ImagePng;
|
|
928
|
+
case '.json':
|
|
929
|
+
case '.map':
|
|
930
|
+
return ApplicationJson;
|
|
931
|
+
case '.mp3':
|
|
932
|
+
return AudioMpeg;
|
|
933
|
+
case '.webm':
|
|
934
|
+
return VideoWebm;
|
|
935
|
+
case '.txt':
|
|
936
|
+
return TextPlain;
|
|
937
|
+
default:
|
|
938
|
+
return '';
|
|
455
939
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
940
|
+
};
|
|
941
|
+
|
|
942
|
+
const dirname = (pathSeparator, path) => {
|
|
943
|
+
const index = path.lastIndexOf(pathSeparator);
|
|
944
|
+
if (index === -1) {
|
|
945
|
+
return path;
|
|
460
946
|
}
|
|
461
|
-
|
|
462
|
-
|
|
947
|
+
return path.slice(0, index);
|
|
948
|
+
};
|
|
949
|
+
const extname = path => {
|
|
950
|
+
const index = path.lastIndexOf('.');
|
|
951
|
+
if (index === -1) {
|
|
952
|
+
return '';
|
|
463
953
|
}
|
|
464
|
-
|
|
465
|
-
|
|
954
|
+
return path.slice(index);
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
const getContentType = uri => {
|
|
958
|
+
const extension = extname(uri);
|
|
959
|
+
const mime = getMimeType(extension);
|
|
960
|
+
return mime;
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
// TODO move this to an extension?
|
|
964
|
+
|
|
965
|
+
const state$5 = {
|
|
966
|
+
files: Object.create(null)
|
|
967
|
+
};
|
|
968
|
+
const getDirent = uri => {
|
|
969
|
+
return state$5.files[uri];
|
|
970
|
+
};
|
|
971
|
+
const readFile = uri => {
|
|
972
|
+
const dirent = getDirent(uri);
|
|
973
|
+
if (!dirent) {
|
|
974
|
+
throw new FileNotFoundError(uri);
|
|
466
975
|
}
|
|
467
|
-
|
|
468
|
-
|
|
976
|
+
if (dirent.type !== File$2) {
|
|
977
|
+
throw new Error('file is a directory');
|
|
469
978
|
}
|
|
470
|
-
|
|
471
|
-
const wrap$5 = global => {
|
|
472
|
-
return new IpcChildWithModuleWorker(global);
|
|
473
|
-
};
|
|
474
|
-
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
475
|
-
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
476
|
-
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
477
|
-
const NewLine$1 = '\n';
|
|
478
|
-
const joinLines = lines => {
|
|
479
|
-
return lines.join(NewLine$1);
|
|
979
|
+
return dirent.content;
|
|
480
980
|
};
|
|
481
|
-
const
|
|
482
|
-
|
|
981
|
+
const ensureParentDir = uri => {
|
|
982
|
+
const startIndex = 0;
|
|
983
|
+
let endIndex = uri.indexOf(Slash);
|
|
984
|
+
while (endIndex >= 0) {
|
|
985
|
+
const part = uri.slice(startIndex, endIndex + 1);
|
|
986
|
+
state$5.files[part] = {
|
|
987
|
+
type: Directory$1,
|
|
988
|
+
content: ''
|
|
989
|
+
};
|
|
990
|
+
endIndex = uri.indexOf(Slash, endIndex + 1);
|
|
991
|
+
}
|
|
483
992
|
};
|
|
484
|
-
const
|
|
485
|
-
|
|
993
|
+
const writeFile = (uri, content) => {
|
|
994
|
+
const dirent = getDirent(uri);
|
|
995
|
+
if (dirent) {
|
|
996
|
+
dirent.content = content;
|
|
997
|
+
} else {
|
|
998
|
+
ensureParentDir(uri);
|
|
999
|
+
state$5.files[uri] = {
|
|
1000
|
+
type: File$2,
|
|
1001
|
+
content
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
486
1004
|
};
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
1005
|
+
const mkdir = uri => {
|
|
1006
|
+
if (!uri.endsWith(Slash)) {
|
|
1007
|
+
uri += Slash;
|
|
1008
|
+
}
|
|
1009
|
+
ensureParentDir(uri);
|
|
1010
|
+
state$5.files[uri] = {
|
|
1011
|
+
type: Directory$1,
|
|
1012
|
+
content: ''
|
|
494
1013
|
};
|
|
495
1014
|
};
|
|
496
|
-
const
|
|
497
|
-
const
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
1015
|
+
const remove = uri => {
|
|
1016
|
+
const toDelete = [];
|
|
1017
|
+
for (const key of Object.keys(state$5.files)) {
|
|
1018
|
+
if (key.startsWith(uri)) {
|
|
1019
|
+
toDelete.push(key);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
for (const key of toDelete) {
|
|
1023
|
+
delete state$5.files[key];
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
const readDirWithFileTypes = uri => {
|
|
1027
|
+
if (!uri.endsWith(Slash)) {
|
|
1028
|
+
uri += Slash;
|
|
1029
|
+
}
|
|
1030
|
+
const dirents = [];
|
|
1031
|
+
for (const [key, value] of Object.entries(state$5.files)) {
|
|
1032
|
+
if (key.startsWith(uri)) {
|
|
1033
|
+
// @ts-ignore
|
|
1034
|
+
switch (value.type) {
|
|
1035
|
+
case Directory$1:
|
|
1036
|
+
if (!key.slice(0, -1).includes(Slash, uri.length) && key !== `${uri}/` && key !== uri) {
|
|
1037
|
+
dirents.push({
|
|
1038
|
+
// @ts-ignore
|
|
1039
|
+
type: value.type,
|
|
1040
|
+
name: key.slice(uri.length, -1)
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
break;
|
|
1044
|
+
case File$2:
|
|
1045
|
+
if (!key.includes(Slash, uri.length + 1)) {
|
|
1046
|
+
dirents.push({
|
|
1047
|
+
// @ts-ignore
|
|
1048
|
+
type: value.type,
|
|
1049
|
+
name: key.slice(uri.length)
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
return dirents;
|
|
1057
|
+
};
|
|
1058
|
+
const getBlob = uri => {
|
|
1059
|
+
const content = readFile(uri);
|
|
1060
|
+
const contentType = getContentType(uri);
|
|
1061
|
+
const blob = new Blob([content], {
|
|
1062
|
+
type: contentType
|
|
1063
|
+
});
|
|
1064
|
+
return blob;
|
|
504
1065
|
};
|
|
505
|
-
const
|
|
506
|
-
|
|
1066
|
+
const getBlobUrl = uri => {
|
|
1067
|
+
const blob = getBlob(uri);
|
|
1068
|
+
const url = URL.createObjectURL(blob);
|
|
1069
|
+
return url;
|
|
507
1070
|
};
|
|
508
|
-
const
|
|
509
|
-
|
|
1071
|
+
const chmod = () => {
|
|
1072
|
+
throw new Error('[memfs] chmod not implemented');
|
|
510
1073
|
};
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
514
|
-
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
515
|
-
const relevantLines = lines.slice(startIndex, endIndex);
|
|
516
|
-
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
517
|
-
return relevantMessage;
|
|
1074
|
+
const getFiles = () => {
|
|
1075
|
+
return state$5.files;
|
|
518
1076
|
};
|
|
519
|
-
|
|
520
|
-
|
|
1077
|
+
|
|
1078
|
+
const emptyMatches = [];
|
|
1079
|
+
|
|
1080
|
+
const convertToPick = item => {
|
|
521
1081
|
return {
|
|
522
|
-
|
|
523
|
-
|
|
1082
|
+
pick: item,
|
|
1083
|
+
matches: emptyMatches
|
|
524
1084
|
};
|
|
525
1085
|
};
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
1086
|
+
|
|
1087
|
+
const Diagonal = 1;
|
|
1088
|
+
const Left = 2;
|
|
1089
|
+
|
|
1090
|
+
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1091
|
+
|
|
1092
|
+
const createTable = size => {
|
|
1093
|
+
const table = [];
|
|
1094
|
+
for (let i = 0; i < size; i++) {
|
|
1095
|
+
const row = new Uint8Array(size);
|
|
1096
|
+
table.push(row);
|
|
529
1097
|
}
|
|
530
|
-
return
|
|
531
|
-
};
|
|
532
|
-
const getModuleSyntaxError = () => {
|
|
533
|
-
return {
|
|
534
|
-
message: `ES Modules are not supported in electron`,
|
|
535
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
536
|
-
};
|
|
1098
|
+
return table;
|
|
537
1099
|
};
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
1100
|
+
const EmptyMatches = [];
|
|
1101
|
+
const Dash = '-';
|
|
1102
|
+
const Dot = '.';
|
|
1103
|
+
const EmptyString = '';
|
|
1104
|
+
const Space = ' ';
|
|
1105
|
+
const Underline = '_';
|
|
1106
|
+
const T = 't';
|
|
1107
|
+
const isLowerCase = char => {
|
|
1108
|
+
return char === char.toLowerCase();
|
|
543
1109
|
};
|
|
544
|
-
const
|
|
545
|
-
return
|
|
1110
|
+
const isUpperCase = char => {
|
|
1111
|
+
return char === char.toUpperCase();
|
|
546
1112
|
};
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
1113
|
+
|
|
1114
|
+
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1115
|
+
const isGap = (columnCharBefore, columnChar) => {
|
|
1116
|
+
switch (columnCharBefore) {
|
|
1117
|
+
case Dash:
|
|
1118
|
+
case Underline:
|
|
1119
|
+
case EmptyString:
|
|
1120
|
+
case T:
|
|
1121
|
+
case Space:
|
|
1122
|
+
case Dot:
|
|
1123
|
+
return true;
|
|
554
1124
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
1125
|
+
if (isLowerCase(columnCharBefore) && isUpperCase(columnChar)) {
|
|
1126
|
+
return true;
|
|
560
1127
|
}
|
|
561
|
-
return
|
|
562
|
-
actualMessage: lines[index - 1],
|
|
563
|
-
rest: lines.slice(index, lastIndex)
|
|
564
|
-
};
|
|
1128
|
+
return false;
|
|
565
1129
|
};
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
1130
|
+
|
|
1131
|
+
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1132
|
+
const getScore = (rowCharLow, rowChar, columnCharBefore, columnCharLow, columnChar, isDiagonalMatch) => {
|
|
1133
|
+
if (rowCharLow !== columnCharLow) {
|
|
1134
|
+
return -1;
|
|
569
1135
|
}
|
|
570
|
-
|
|
571
|
-
|
|
1136
|
+
const isMatch = rowChar === columnChar;
|
|
1137
|
+
if (isMatch) {
|
|
1138
|
+
if (isDiagonalMatch) {
|
|
1139
|
+
return 8;
|
|
1140
|
+
}
|
|
1141
|
+
if (isGap(columnCharBefore, columnChar)) {
|
|
1142
|
+
return 8;
|
|
1143
|
+
}
|
|
1144
|
+
return 5;
|
|
572
1145
|
}
|
|
573
|
-
if (
|
|
574
|
-
return
|
|
1146
|
+
if (isGap(columnCharBefore, columnChar)) {
|
|
1147
|
+
return 8;
|
|
575
1148
|
}
|
|
576
|
-
|
|
577
|
-
const {
|
|
578
|
-
actualMessage,
|
|
579
|
-
rest
|
|
580
|
-
} = getDetails(lines);
|
|
581
|
-
return {
|
|
582
|
-
message: `${actualMessage}`,
|
|
583
|
-
code: '',
|
|
584
|
-
stack: rest
|
|
585
|
-
};
|
|
1149
|
+
return 5;
|
|
586
1150
|
};
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
1151
|
+
|
|
1152
|
+
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1153
|
+
|
|
1154
|
+
const isPatternInWord = (patternLow, patternPos, patternLen, wordLow, wordPos, wordLen) => {
|
|
1155
|
+
while (patternPos < patternLen && wordPos < wordLen) {
|
|
1156
|
+
if (patternLow[patternPos] === wordLow[wordPos]) {
|
|
1157
|
+
patternPos += 1;
|
|
1158
|
+
}
|
|
1159
|
+
wordPos += 1;
|
|
593
1160
|
}
|
|
594
|
-
return
|
|
1161
|
+
return patternPos === patternLen; // pattern must be exhausted
|
|
595
1162
|
};
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
1163
|
+
|
|
1164
|
+
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1165
|
+
const traceHighlights = (table, arrows, patternLength, wordLength) => {
|
|
1166
|
+
let row = patternLength;
|
|
1167
|
+
let column = wordLength;
|
|
1168
|
+
const matches = [];
|
|
1169
|
+
while (row >= 1 && column >= 1) {
|
|
1170
|
+
const arrow = arrows[row][column];
|
|
1171
|
+
if (arrow === Left) {
|
|
1172
|
+
column--;
|
|
1173
|
+
} else if (arrow === Diagonal) {
|
|
1174
|
+
row--;
|
|
1175
|
+
column--;
|
|
1176
|
+
const start = column + 1;
|
|
1177
|
+
while (row >= 1 && column >= 1) {
|
|
1178
|
+
const arrow = arrows[row][column];
|
|
1179
|
+
if (arrow === Left) {
|
|
1180
|
+
break;
|
|
1181
|
+
}
|
|
1182
|
+
if (arrow === Diagonal) {
|
|
1183
|
+
row--;
|
|
1184
|
+
column--;
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
const end = column;
|
|
1188
|
+
matches.unshift(end, start);
|
|
1189
|
+
}
|
|
600
1190
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
const NewLine$2 = '\n';
|
|
604
|
-
const getNewLineIndex$1 = (string, startIndex = undefined) => {
|
|
605
|
-
return string.indexOf(NewLine$2, startIndex);
|
|
1191
|
+
matches.unshift(table[patternLength][wordLength - 1]);
|
|
1192
|
+
return matches;
|
|
606
1193
|
};
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
if (parentFirstLine.includes(childFirstLine)) {
|
|
620
|
-
return parentFirstLine + childRest;
|
|
1194
|
+
|
|
1195
|
+
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1196
|
+
const gridSize = 128;
|
|
1197
|
+
const table = createTable(gridSize);
|
|
1198
|
+
const arrows = createTable(gridSize);
|
|
1199
|
+
const fuzzySearch = (pattern, word) => {
|
|
1200
|
+
const patternLength = Math.min(pattern.length, gridSize - 1);
|
|
1201
|
+
const wordLength = Math.min(word.length, gridSize - 1);
|
|
1202
|
+
const patternLower = pattern.toLowerCase();
|
|
1203
|
+
const wordLower = word.toLowerCase();
|
|
1204
|
+
if (!isPatternInWord(patternLower, 0, patternLength, wordLower, 0, wordLength)) {
|
|
1205
|
+
return EmptyMatches;
|
|
621
1206
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
1207
|
+
let strongMatch = false;
|
|
1208
|
+
for (let row = 1; row < patternLength + 1; row++) {
|
|
1209
|
+
const rowChar = pattern[row - 1];
|
|
1210
|
+
const rowCharLow = patternLower[row - 1];
|
|
1211
|
+
for (let column = 1; column < wordLength + 1; column++) {
|
|
1212
|
+
const columnChar = word[column - 1];
|
|
1213
|
+
const columnCharLow = wordLower[column - 1];
|
|
1214
|
+
const columnCharBefore = word[column - 2] || '';
|
|
1215
|
+
const isDiagonalMatch = arrows[row - 1][column - 1] === Diagonal;
|
|
1216
|
+
const score = getScore(rowCharLow, rowChar, columnCharBefore, columnCharLow, columnChar, isDiagonalMatch);
|
|
1217
|
+
if (row === 1 && score > 5) {
|
|
1218
|
+
strongMatch = true;
|
|
1219
|
+
}
|
|
1220
|
+
let diagonalScore = score + table[row - 1][column - 1];
|
|
1221
|
+
if (isDiagonalMatch && score !== -1) {
|
|
1222
|
+
diagonalScore += 2;
|
|
1223
|
+
}
|
|
1224
|
+
const leftScore = table[row][column - 1];
|
|
1225
|
+
if (leftScore > diagonalScore) {
|
|
1226
|
+
table[row][column] = leftScore;
|
|
1227
|
+
arrows[row][column] = Left;
|
|
1228
|
+
} else {
|
|
1229
|
+
table[row][column] = diagonalScore;
|
|
1230
|
+
arrows[row][column] = Diagonal;
|
|
1231
|
+
}
|
|
639
1232
|
}
|
|
640
1233
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
// @ts-ignore
|
|
644
|
-
constructor(betterMessage, stdout = '', stderr = '') {
|
|
645
|
-
if (stdout || stderr) {
|
|
646
|
-
// @ts-ignore
|
|
647
|
-
const {
|
|
648
|
-
message,
|
|
649
|
-
code,
|
|
650
|
-
stack
|
|
651
|
-
} = getHelpfulChildProcessError(stdout, stderr);
|
|
652
|
-
const cause = new Error(message);
|
|
653
|
-
// @ts-ignore
|
|
654
|
-
cause.code = code;
|
|
655
|
-
cause.stack = stack;
|
|
656
|
-
super(cause, betterMessage);
|
|
657
|
-
} else {
|
|
658
|
-
super(betterMessage);
|
|
659
|
-
}
|
|
660
|
-
// @ts-ignore
|
|
661
|
-
this.name = 'IpcError';
|
|
662
|
-
// @ts-ignore
|
|
663
|
-
this.stdout = stdout;
|
|
664
|
-
// @ts-ignore
|
|
665
|
-
this.stderr = stderr;
|
|
1234
|
+
if (!strongMatch) {
|
|
1235
|
+
return EmptyMatches;
|
|
666
1236
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
let _resolve;
|
|
670
|
-
const promise = new Promise(resolve => {
|
|
671
|
-
_resolve = resolve;
|
|
672
|
-
});
|
|
673
|
-
return {
|
|
674
|
-
resolve: _resolve,
|
|
675
|
-
promise
|
|
676
|
-
};
|
|
1237
|
+
const highlights = traceHighlights(table, arrows, patternLength, wordLength);
|
|
1238
|
+
return highlights;
|
|
677
1239
|
};
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
} = withResolvers();
|
|
683
|
-
port.addEventListener('message', resolve, {
|
|
684
|
-
once: true
|
|
685
|
-
});
|
|
686
|
-
const event = await promise;
|
|
687
|
-
// @ts-ignore
|
|
688
|
-
return event.data;
|
|
1240
|
+
|
|
1241
|
+
const filterQuickPickItem = (pattern, word) => {
|
|
1242
|
+
const matches = fuzzySearch(pattern, word);
|
|
1243
|
+
return matches;
|
|
689
1244
|
};
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const parentIpc = wrap$5(parentIpcRaw);
|
|
694
|
-
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
695
|
-
if (firstMessage.method !== 'initialize') {
|
|
696
|
-
throw new IpcError('unexpected first message');
|
|
697
|
-
}
|
|
698
|
-
const type = firstMessage.params[0];
|
|
699
|
-
if (type === 'message-port') {
|
|
700
|
-
parentIpc.send({
|
|
701
|
-
jsonrpc: '2.0',
|
|
702
|
-
id: firstMessage.id,
|
|
703
|
-
result: null
|
|
704
|
-
});
|
|
705
|
-
parentIpc.dispose();
|
|
706
|
-
const port = firstMessage.params[1];
|
|
707
|
-
return port;
|
|
708
|
-
}
|
|
709
|
-
return globalThis;
|
|
1245
|
+
|
|
1246
|
+
const getBaseName = path => {
|
|
1247
|
+
return path.slice(path.lastIndexOf('/') + 1);
|
|
710
1248
|
};
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
getData(event) {
|
|
716
|
-
return getData$1(event);
|
|
717
|
-
}
|
|
718
|
-
send(message) {
|
|
719
|
-
this._rawIpc.postMessage(message);
|
|
720
|
-
}
|
|
721
|
-
sendAndTransfer(message) {
|
|
722
|
-
const transfer = getTransferrables(message);
|
|
723
|
-
this._rawIpc.postMessage(message, transfer);
|
|
1249
|
+
|
|
1250
|
+
const filterQuickPickItems = (items, value) => {
|
|
1251
|
+
if (!value) {
|
|
1252
|
+
return items.map(convertToPick);
|
|
724
1253
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
1254
|
+
const results = [];
|
|
1255
|
+
for (const item of items) {
|
|
1256
|
+
const baseName = getBaseName(item);
|
|
1257
|
+
const matches = filterQuickPickItem(value, baseName);
|
|
1258
|
+
if (matches.length > 0) {
|
|
1259
|
+
results.push({
|
|
1260
|
+
pick: item,
|
|
1261
|
+
matches
|
|
1262
|
+
});
|
|
728
1263
|
}
|
|
729
1264
|
}
|
|
730
|
-
|
|
731
|
-
// ignore
|
|
732
|
-
}
|
|
733
|
-
onMessage(callback) {
|
|
734
|
-
this._rawIpc.addEventListener('message', callback);
|
|
735
|
-
this._rawIpc.start();
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
const wrap$4 = port => {
|
|
739
|
-
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
1265
|
+
return results;
|
|
740
1266
|
};
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
1267
|
+
|
|
1268
|
+
const Enter = 3;
|
|
1269
|
+
const Escape = 8;
|
|
1270
|
+
const PageUp = 10;
|
|
1271
|
+
const PageDown = 11;
|
|
1272
|
+
const UpArrow = 14;
|
|
1273
|
+
const DownArrow = 16;
|
|
1274
|
+
|
|
1275
|
+
const FocusQuickPickInput = 20;
|
|
1276
|
+
|
|
1277
|
+
const getKeyBindings = () => {
|
|
1278
|
+
return [{
|
|
1279
|
+
key: Escape,
|
|
1280
|
+
command: 'Viewlet.closeWidget',
|
|
1281
|
+
args: ['QuickPick'],
|
|
1282
|
+
when: FocusQuickPickInput
|
|
1283
|
+
}, {
|
|
1284
|
+
key: UpArrow,
|
|
1285
|
+
command: 'QuickPick.focusPrevious',
|
|
1286
|
+
when: FocusQuickPickInput
|
|
1287
|
+
}, {
|
|
1288
|
+
key: DownArrow,
|
|
1289
|
+
command: 'QuickPick.focusNext',
|
|
1290
|
+
when: FocusQuickPickInput
|
|
1291
|
+
}, {
|
|
1292
|
+
key: PageUp,
|
|
1293
|
+
command: 'QuickPick.focusFirst',
|
|
1294
|
+
when: FocusQuickPickInput
|
|
1295
|
+
}, {
|
|
1296
|
+
key: PageDown,
|
|
1297
|
+
command: 'QuickPick.focusLast',
|
|
1298
|
+
when: FocusQuickPickInput
|
|
1299
|
+
}, {
|
|
1300
|
+
key: Enter,
|
|
1301
|
+
command: 'QuickPick.selectCurrentIndex',
|
|
1302
|
+
when: FocusQuickPickInput
|
|
1303
|
+
}];
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
// TODO support file icons
|
|
1307
|
+
const getFolderIcon = () => {
|
|
1308
|
+
return '';
|
|
745
1309
|
};
|
|
746
1310
|
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
invokeAndTransfer(method, ...params) {
|
|
759
|
-
return invokeAndTransfer(ipc, method, ...params);
|
|
760
|
-
}
|
|
1311
|
+
const Hide = 'hide';
|
|
1312
|
+
const KeepOpen = '';
|
|
1313
|
+
|
|
1314
|
+
const emptyObject = {};
|
|
1315
|
+
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1316
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1317
|
+
if (placeholders === emptyObject) {
|
|
1318
|
+
return key;
|
|
1319
|
+
}
|
|
1320
|
+
const replacer = (match, rest) => {
|
|
1321
|
+
return placeholders[rest];
|
|
761
1322
|
};
|
|
762
|
-
return
|
|
1323
|
+
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
763
1324
|
};
|
|
764
|
-
|
|
765
|
-
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* @enum {string}
|
|
1328
|
+
*/
|
|
1329
|
+
const UiStrings = {
|
|
1330
|
+
Files: 'Files',
|
|
1331
|
+
GoToFile: 'Go to file',
|
|
1332
|
+
NoMatchingColorThemesFound: 'No matching color themes found',
|
|
1333
|
+
NoMatchingResults: 'No matching results',
|
|
1334
|
+
NoRecentlyOpenedFoldersFound: 'No recently opened folders found',
|
|
1335
|
+
NoResults: 'No Results',
|
|
1336
|
+
NoSymbolFound: 'No symbol found',
|
|
1337
|
+
NoWorkspaceSymbolsFound: 'no workspace symbols found',
|
|
1338
|
+
OpenRecent: 'Open Recent',
|
|
1339
|
+
SelectColorTheme: 'Select Color Theme',
|
|
1340
|
+
SelectToOpen: 'Select to open',
|
|
1341
|
+
ShowAndRunCommands: 'Show And Run Commands',
|
|
1342
|
+
TypeNameOfCommandToRun: 'Type the name of a command to run.',
|
|
1343
|
+
TypeTheNameOfAViewToOpen: 'Type the name of a view, output channel or terminal to open.'
|
|
766
1344
|
};
|
|
767
|
-
const
|
|
768
|
-
return
|
|
1345
|
+
const noMatchingColorThemesFound = () => {
|
|
1346
|
+
return i18nString(UiStrings.NoMatchingColorThemesFound);
|
|
769
1347
|
};
|
|
770
|
-
const
|
|
771
|
-
|
|
1348
|
+
const selectColorTheme = () => {
|
|
1349
|
+
return i18nString(UiStrings.SelectColorTheme);
|
|
772
1350
|
};
|
|
773
|
-
const
|
|
774
|
-
return
|
|
1351
|
+
const typeNameofCommandToRun = () => {
|
|
1352
|
+
return i18nString(UiStrings.TypeNameOfCommandToRun);
|
|
775
1353
|
};
|
|
776
|
-
const
|
|
777
|
-
|
|
1354
|
+
const showAndRunCommands = () => {
|
|
1355
|
+
return i18nString(UiStrings.ShowAndRunCommands);
|
|
778
1356
|
};
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
const listen$1 = async () => {
|
|
782
|
-
const module = IpcChildWithModuleWorkerAndMessagePort$1;
|
|
783
|
-
const rawIpc = await module.listen();
|
|
784
|
-
const ipc = module.wrap(rawIpc);
|
|
785
|
-
return ipc;
|
|
1357
|
+
const noMatchingResults = () => {
|
|
1358
|
+
return i18nString(UiStrings.NoMatchingResults);
|
|
786
1359
|
};
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
}) => {
|
|
790
|
-
// TODO create a commandMap per rpc instance
|
|
791
|
-
register(commandMap);
|
|
792
|
-
const ipc = await listen$1();
|
|
793
|
-
handleIpc(ipc);
|
|
794
|
-
const rpc = createRpc(ipc);
|
|
795
|
-
return rpc;
|
|
1360
|
+
const files = () => {
|
|
1361
|
+
return i18nString(UiStrings.Files);
|
|
796
1362
|
};
|
|
797
|
-
const
|
|
798
|
-
|
|
799
|
-
|
|
1363
|
+
const goToFile = () => {
|
|
1364
|
+
return i18nString(UiStrings.GoToFile);
|
|
1365
|
+
};
|
|
1366
|
+
const noResults = () => {
|
|
1367
|
+
return i18nString(UiStrings.NoResults);
|
|
1368
|
+
};
|
|
1369
|
+
const selectToOpen = () => {
|
|
1370
|
+
return i18nString(UiStrings.SelectToOpen);
|
|
1371
|
+
};
|
|
1372
|
+
const openRecent = () => {
|
|
1373
|
+
return i18nString(UiStrings.OpenRecent);
|
|
1374
|
+
};
|
|
1375
|
+
const noRecentlyOpenedFoldersFound = () => {
|
|
1376
|
+
return i18nString(UiStrings.NoRecentlyOpenedFoldersFound);
|
|
1377
|
+
};
|
|
1378
|
+
const noSymbolFound = () => {
|
|
1379
|
+
return i18nString(UiStrings.NoSymbolFound);
|
|
1380
|
+
};
|
|
1381
|
+
const noWorkspaceSymbolsFound = () => {
|
|
1382
|
+
return i18nString(UiStrings.NoWorkspaceSymbolsFound);
|
|
800
1383
|
};
|
|
801
1384
|
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
const Directory$1 = 3;
|
|
805
|
-
const File$1 = 7;
|
|
806
|
-
|
|
807
|
-
const fileMapUrl = `${assetDir}/config/fileMap.json`;
|
|
808
|
-
|
|
809
|
-
const normalizeLine = line => {
|
|
810
|
-
if (line.startsWith('Error: ')) {
|
|
811
|
-
return line.slice('Error: '.length);
|
|
812
|
-
}
|
|
813
|
-
if (line.startsWith('VError: ')) {
|
|
814
|
-
return line.slice('VError: '.length);
|
|
815
|
-
}
|
|
816
|
-
return line;
|
|
1385
|
+
const state$4 = {
|
|
1386
|
+
rpc: undefined
|
|
817
1387
|
};
|
|
818
|
-
const
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
}
|
|
823
|
-
return stringifiedError;
|
|
1388
|
+
const invoke$1 = (method, ...params) => {
|
|
1389
|
+
const rpc = state$4.rpc;
|
|
1390
|
+
// @ts-ignore
|
|
1391
|
+
return rpc.invoke(method, ...params);
|
|
824
1392
|
};
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
return string.indexOf(NewLine, startIndex);
|
|
1393
|
+
const setRpc = rpc => {
|
|
1394
|
+
state$4.rpc = rpc;
|
|
828
1395
|
};
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
const parentNewLineIndex = getNewLineIndex(parent);
|
|
834
|
-
const childNewLineIndex = getNewLineIndex(child);
|
|
835
|
-
if (childNewLineIndex === -1) {
|
|
836
|
-
return parent;
|
|
837
|
-
}
|
|
838
|
-
const parentFirstLine = parent.slice(0, parentNewLineIndex);
|
|
839
|
-
const childRest = child.slice(childNewLineIndex);
|
|
840
|
-
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
841
|
-
if (parentFirstLine.includes(childFirstLine)) {
|
|
842
|
-
return parentFirstLine + childRest;
|
|
843
|
-
}
|
|
844
|
-
return child;
|
|
1396
|
+
|
|
1397
|
+
// TODO this should be in FileSystem module
|
|
1398
|
+
const pathBaseName = path => {
|
|
1399
|
+
return path.slice(path.lastIndexOf('/') + 1);
|
|
845
1400
|
};
|
|
846
|
-
class VError extends Error {
|
|
847
|
-
constructor(error, message) {
|
|
848
|
-
const combinedMessage = getCombinedMessage(error, message);
|
|
849
|
-
super(combinedMessage);
|
|
850
|
-
this.name = 'VError';
|
|
851
|
-
if (error instanceof Error) {
|
|
852
|
-
this.stack = mergeStacks(this.stack, error.stack);
|
|
853
|
-
}
|
|
854
|
-
if (error.codeFrame) {
|
|
855
|
-
// @ts-ignore
|
|
856
|
-
this.codeFrame = error.codeFrame;
|
|
857
|
-
}
|
|
858
|
-
if (error.code) {
|
|
859
|
-
// @ts-ignore
|
|
860
|
-
this.code = error.code;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
1401
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
const text = await response.json();
|
|
872
|
-
return text;
|
|
873
|
-
} catch (error) {
|
|
874
|
-
throw new VError(error, `Failed to request json for ${url}`);
|
|
1402
|
+
// TODO this should be in FileSystem module
|
|
1403
|
+
const pathDirName = path => {
|
|
1404
|
+
const pathSeparator = '/';
|
|
1405
|
+
const index = path.lastIndexOf(pathSeparator);
|
|
1406
|
+
if (index === -1) {
|
|
1407
|
+
return '';
|
|
875
1408
|
}
|
|
1409
|
+
return path.slice(0, index);
|
|
876
1410
|
};
|
|
877
1411
|
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1412
|
+
const getRecentlyOpened = () => {
|
|
1413
|
+
return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1414
|
+
};
|
|
1415
|
+
const openWorkspaceFolder = uri => {
|
|
1416
|
+
return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
|
|
1417
|
+
};
|
|
1418
|
+
const getPlaceholder$b = () => {
|
|
1419
|
+
return selectToOpen();
|
|
1420
|
+
};
|
|
1421
|
+
const getLabel$5 = () => {
|
|
1422
|
+
return openRecent();
|
|
1423
|
+
};
|
|
1424
|
+
const getHelpEntries$9 = () => {
|
|
1425
|
+
return [];
|
|
1426
|
+
};
|
|
1427
|
+
const getNoResults$a = () => {
|
|
1428
|
+
return {
|
|
1429
|
+
label: noRecentlyOpenedFoldersFound()
|
|
1430
|
+
};
|
|
889
1431
|
};
|
|
890
1432
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1433
|
+
// TODO could also change api so that getPicks returns an array of anything
|
|
1434
|
+
// and the transformPick gets the label for each pick
|
|
1435
|
+
// This would make the code more module since the code for getting the picks
|
|
1436
|
+
// would be more independent of the specific data format of the quickpick provider
|
|
894
1437
|
|
|
895
|
-
|
|
1438
|
+
const getPicks$b = async () => {
|
|
1439
|
+
const recentlyOpened = await getRecentlyOpened();
|
|
1440
|
+
return recentlyOpened;
|
|
1441
|
+
};
|
|
896
1442
|
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
|
|
1443
|
+
// TODO selectPick should be independent of show/hide
|
|
1444
|
+
const selectPick$b = async pick => {
|
|
1445
|
+
const path = pick;
|
|
1446
|
+
await openWorkspaceFolder(path);
|
|
1447
|
+
return {
|
|
1448
|
+
command: Hide
|
|
1449
|
+
};
|
|
901
1450
|
};
|
|
902
|
-
const
|
|
903
|
-
|
|
1451
|
+
const getFilterValue$a = value => {
|
|
1452
|
+
return pathBaseName(value);
|
|
904
1453
|
};
|
|
905
|
-
const
|
|
906
|
-
|
|
1454
|
+
const getPickFilterValue$6 = pick => {
|
|
1455
|
+
return pathBaseName(pick);
|
|
907
1456
|
};
|
|
908
|
-
const
|
|
909
|
-
|
|
1457
|
+
const getPickLabel$5 = pick => {
|
|
1458
|
+
return pathBaseName(pick);
|
|
910
1459
|
};
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
const dirents = [];
|
|
914
|
-
for (const fileUri of fileList) {
|
|
915
|
-
if (fileUri.startsWith(uri)) {
|
|
916
|
-
const rest = fileUri.slice(uri.length + 1);
|
|
917
|
-
if (rest.includes(Slash)) {
|
|
918
|
-
const name = rest.slice(0, rest.indexOf(Slash));
|
|
919
|
-
if (dirents.some(dirent => dirent.name === name)) {
|
|
920
|
-
continue;
|
|
921
|
-
}
|
|
922
|
-
dirents.push({
|
|
923
|
-
type: Directory$1,
|
|
924
|
-
name
|
|
925
|
-
});
|
|
926
|
-
} else {
|
|
927
|
-
dirents.push({
|
|
928
|
-
type: File$1,
|
|
929
|
-
name: rest
|
|
930
|
-
});
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
return dirents;
|
|
1460
|
+
const getPickDescription$3 = pick => {
|
|
1461
|
+
return pathDirName(pick);
|
|
935
1462
|
};
|
|
936
|
-
const
|
|
937
|
-
|
|
1463
|
+
const getPickIcon$5 = () => {
|
|
1464
|
+
return '';
|
|
938
1465
|
};
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
const blob = new Blob([content]);
|
|
942
|
-
return blob;
|
|
1466
|
+
const getPickFileIcon$2 = () => {
|
|
1467
|
+
return getFolderIcon();
|
|
943
1468
|
};
|
|
944
1469
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1470
|
+
const QuickPickEntriesOpenRecent = {
|
|
1471
|
+
__proto__: null,
|
|
1472
|
+
getFilterValue: getFilterValue$a,
|
|
1473
|
+
getHelpEntries: getHelpEntries$9,
|
|
1474
|
+
getLabel: getLabel$5,
|
|
1475
|
+
getNoResults: getNoResults$a,
|
|
1476
|
+
getPickDescription: getPickDescription$3,
|
|
1477
|
+
getPickFileIcon: getPickFileIcon$2,
|
|
1478
|
+
getPickFilterValue: getPickFilterValue$6,
|
|
1479
|
+
getPickIcon: getPickIcon$5,
|
|
1480
|
+
getPickLabel: getPickLabel$5,
|
|
1481
|
+
getPicks: getPicks$b,
|
|
1482
|
+
getPlaceholder: getPlaceholder$b,
|
|
1483
|
+
selectPick: selectPick$b
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
const CommandPalette = 'quickPick://commandPalette';
|
|
1487
|
+
const File$1 = 'quickPick://file';
|
|
1488
|
+
const EveryThing = 'quickPick://everything';
|
|
1489
|
+
const Number$1 = 'quickPick://number';
|
|
1490
|
+
const Recent = 'quickPick://recent';
|
|
1491
|
+
const ColorTheme = 'quickPick://color-theme';
|
|
1492
|
+
const Symbol$2 = 'quickPick://symbol';
|
|
1493
|
+
const View$1 = 'quickPick://view';
|
|
1494
|
+
const WorkspaceSymbol$1 = 'quickPick://workspace-symbol';
|
|
1495
|
+
const Custom = 'quickPick://custom';
|
|
1496
|
+
|
|
1497
|
+
const loadQuickPickEntries = moduleId => {
|
|
1498
|
+
switch (moduleId) {
|
|
1499
|
+
case Recent:
|
|
1500
|
+
return QuickPickEntriesOpenRecent;
|
|
1501
|
+
default:
|
|
1502
|
+
throw new Error(`unknown module "${moduleId}"`);
|
|
949
1503
|
}
|
|
950
|
-
}
|
|
1504
|
+
};
|
|
951
1505
|
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
const ImagePng = 'image/png';
|
|
956
|
-
const ImageSvgXml = 'image/svg+xml';
|
|
957
|
-
const TextCss = 'text/css';
|
|
958
|
-
const TextHtml = 'text/html';
|
|
959
|
-
const TextJavaScript = 'text/javascript';
|
|
960
|
-
const TextPlain = 'text/plain';
|
|
961
|
-
const VideoWebm = 'video/webm';
|
|
1506
|
+
const getColorThemeNames = async () => {
|
|
1507
|
+
return invoke$1(/* Ajax.getJson */'ColorTheme.getColorThemeNames');
|
|
1508
|
+
};
|
|
962
1509
|
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1510
|
+
const setColorTheme = id => {
|
|
1511
|
+
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1512
|
+
};
|
|
1513
|
+
const getPlaceholder$a = () => {
|
|
1514
|
+
return selectColorTheme();
|
|
1515
|
+
};
|
|
1516
|
+
const getLabel$4 = () => {
|
|
1517
|
+
return selectColorTheme();
|
|
1518
|
+
};
|
|
1519
|
+
const getPicks$a = async searchValue => {
|
|
1520
|
+
const colorThemeNames = await getColorThemeNames();
|
|
1521
|
+
return colorThemeNames;
|
|
1522
|
+
};
|
|
1523
|
+
const selectPick$a = async pick => {
|
|
1524
|
+
await setColorTheme(/* colorThemeId */pick);
|
|
1525
|
+
return {
|
|
1526
|
+
command: Hide
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
const focusPick = async pick => {
|
|
1530
|
+
await setColorTheme(/* colorThemeId */pick);
|
|
1531
|
+
};
|
|
1532
|
+
const getFilterValue$9 = value => {
|
|
1533
|
+
return value;
|
|
1534
|
+
};
|
|
1535
|
+
const getNoResults$9 = () => {
|
|
1536
|
+
return {
|
|
1537
|
+
label: noMatchingColorThemesFound()
|
|
1538
|
+
};
|
|
1539
|
+
};
|
|
1540
|
+
const getPickFilterValue$5 = pick => {
|
|
1541
|
+
return pick;
|
|
1542
|
+
};
|
|
1543
|
+
const getPickLabel$4 = pick => {
|
|
1544
|
+
return pick;
|
|
1545
|
+
};
|
|
1546
|
+
const getPickIcon$4 = pick => {
|
|
1547
|
+
return '';
|
|
991
1548
|
};
|
|
992
1549
|
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1550
|
+
const QuickPickEntriesColorTheme = {
|
|
1551
|
+
__proto__: null,
|
|
1552
|
+
focusPick,
|
|
1553
|
+
getFilterValue: getFilterValue$9,
|
|
1554
|
+
getLabel: getLabel$4,
|
|
1555
|
+
getNoResults: getNoResults$9,
|
|
1556
|
+
getPickFilterValue: getPickFilterValue$5,
|
|
1557
|
+
getPickIcon: getPickIcon$4,
|
|
1558
|
+
getPickLabel: getPickLabel$4,
|
|
1559
|
+
getPicks: getPicks$a,
|
|
1560
|
+
getPlaceholder: getPlaceholder$a,
|
|
1561
|
+
selectPick: selectPick$a,
|
|
1562
|
+
setColorTheme
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
const Tag$1 = 'Tag';
|
|
1566
|
+
const Cloud$1 = 'Cloud';
|
|
1567
|
+
const SourceControl$1 = 'SourceControl';
|
|
1568
|
+
const None$1 = '';
|
|
1569
|
+
|
|
1570
|
+
const SourceControl = 1;
|
|
1571
|
+
const Cloud = 2;
|
|
1572
|
+
const Tag = 3;
|
|
1573
|
+
|
|
1574
|
+
const name$8 = 'custom';
|
|
1575
|
+
const state$3 = {
|
|
1576
|
+
args: []
|
|
999
1577
|
};
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1578
|
+
const setArgs = args => {
|
|
1579
|
+
state$3.args = args;
|
|
1580
|
+
};
|
|
1581
|
+
const getPlaceholder$9 = () => {
|
|
1582
|
+
return '';
|
|
1583
|
+
};
|
|
1584
|
+
const getLabel$3 = () => {
|
|
1585
|
+
return 'Custom';
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
// TODO help entries should not be here
|
|
1589
|
+
const getHelpEntries$8 = () => {
|
|
1590
|
+
return [];
|
|
1591
|
+
};
|
|
1592
|
+
const getNoResults$8 = () => {
|
|
1593
|
+
return {
|
|
1594
|
+
label: noMatchingResults()
|
|
1595
|
+
};
|
|
1596
|
+
};
|
|
1597
|
+
const getPicks$9 = async searchValue => {
|
|
1598
|
+
const items = state$3.args[1] || [];
|
|
1599
|
+
return items;
|
|
1600
|
+
};
|
|
1601
|
+
const selectPick$9 = async pick => {
|
|
1602
|
+
const {
|
|
1603
|
+
args
|
|
1604
|
+
} = state$3;
|
|
1605
|
+
const resolve = args[2];
|
|
1606
|
+
resolve(pick);
|
|
1607
|
+
return {
|
|
1608
|
+
command: Hide
|
|
1609
|
+
};
|
|
1610
|
+
};
|
|
1611
|
+
const getFilterValue$8 = value => {
|
|
1612
|
+
return value;
|
|
1613
|
+
};
|
|
1614
|
+
const getPickFilterValue$4 = pick => {
|
|
1615
|
+
return pick;
|
|
1616
|
+
};
|
|
1617
|
+
const getPickLabel$3 = pick => {
|
|
1618
|
+
return pick.label;
|
|
1619
|
+
};
|
|
1620
|
+
const getPickDescription$2 = pick => {
|
|
1621
|
+
return pick.description || '';
|
|
1622
|
+
};
|
|
1623
|
+
const convertIcon = icon => {
|
|
1624
|
+
switch (icon) {
|
|
1625
|
+
case SourceControl:
|
|
1626
|
+
return SourceControl$1;
|
|
1627
|
+
case Cloud:
|
|
1628
|
+
return Cloud$1;
|
|
1629
|
+
case Tag:
|
|
1630
|
+
return Tag$1;
|
|
1631
|
+
default:
|
|
1632
|
+
return None$1;
|
|
1004
1633
|
}
|
|
1005
|
-
|
|
1634
|
+
};
|
|
1635
|
+
const getPickIcon$3 = pick => {
|
|
1636
|
+
return convertIcon(pick.icon);
|
|
1006
1637
|
};
|
|
1007
1638
|
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1639
|
+
const QuickPickEntriesCustom = {
|
|
1640
|
+
__proto__: null,
|
|
1641
|
+
getFilterValue: getFilterValue$8,
|
|
1642
|
+
getHelpEntries: getHelpEntries$8,
|
|
1643
|
+
getLabel: getLabel$3,
|
|
1644
|
+
getNoResults: getNoResults$8,
|
|
1645
|
+
getPickDescription: getPickDescription$2,
|
|
1646
|
+
getPickFilterValue: getPickFilterValue$4,
|
|
1647
|
+
getPickIcon: getPickIcon$3,
|
|
1648
|
+
getPickLabel: getPickLabel$3,
|
|
1649
|
+
getPicks: getPicks$9,
|
|
1650
|
+
getPlaceholder: getPlaceholder$9,
|
|
1651
|
+
name: name$8,
|
|
1652
|
+
selectPick: selectPick$9,
|
|
1653
|
+
setArgs,
|
|
1654
|
+
state: state$3
|
|
1655
|
+
};
|
|
1656
|
+
|
|
1657
|
+
const name$7 = 'noop';
|
|
1658
|
+
const getPlaceholder$8 = () => {
|
|
1659
|
+
return '';
|
|
1660
|
+
};
|
|
1661
|
+
const getHelpEntries$7 = () => {
|
|
1662
|
+
return [];
|
|
1663
|
+
};
|
|
1664
|
+
const getNoResults$7 = () => {
|
|
1665
|
+
return noResults();
|
|
1666
|
+
};
|
|
1667
|
+
const getPicks$8 = async value => {
|
|
1668
|
+
return [];
|
|
1669
|
+
};
|
|
1670
|
+
const selectPick$8 = async item => {
|
|
1671
|
+
return {
|
|
1672
|
+
command: Hide
|
|
1673
|
+
};
|
|
1674
|
+
};
|
|
1675
|
+
const getFilterValue$7 = value => {
|
|
1676
|
+
return value;
|
|
1677
|
+
};
|
|
1678
|
+
const getPickFilterValue$3 = pick => {
|
|
1679
|
+
return pick;
|
|
1012
1680
|
};
|
|
1013
1681
|
|
|
1014
|
-
|
|
1682
|
+
const QuickPickNoop = {
|
|
1683
|
+
__proto__: null,
|
|
1684
|
+
getFilterValue: getFilterValue$7,
|
|
1685
|
+
getHelpEntries: getHelpEntries$7,
|
|
1686
|
+
getNoResults: getNoResults$7,
|
|
1687
|
+
getPickFilterValue: getPickFilterValue$3,
|
|
1688
|
+
getPicks: getPicks$8,
|
|
1689
|
+
getPlaceholder: getPlaceholder$8,
|
|
1690
|
+
name: name$7,
|
|
1691
|
+
selectPick: selectPick$8
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1694
|
+
const Command = '>';
|
|
1695
|
+
const Symbol$1 = '@';
|
|
1696
|
+
const WorkspaceSymbol = '#';
|
|
1697
|
+
const GoToLine = ':';
|
|
1698
|
+
const View = 'view ';
|
|
1699
|
+
const None = '';
|
|
1700
|
+
|
|
1701
|
+
const handleError = async (error, notify = true, prefix = '') => {
|
|
1702
|
+
console.error(error);
|
|
1703
|
+
};
|
|
1704
|
+
const showErrorDialog = async () => {};
|
|
1705
|
+
const warn = (...args) => {
|
|
1706
|
+
console.warn(...args);
|
|
1707
|
+
};
|
|
1015
1708
|
|
|
1016
1709
|
const state$2 = {
|
|
1017
|
-
|
|
1710
|
+
menuEntries: []
|
|
1018
1711
|
};
|
|
1019
|
-
const
|
|
1020
|
-
return state$2.
|
|
1712
|
+
const getAll = () => {
|
|
1713
|
+
return state$2.menuEntries;
|
|
1021
1714
|
};
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}
|
|
1027
|
-
if (dirent.type !== File$1) {
|
|
1028
|
-
throw new Error('file is a directory');
|
|
1029
|
-
}
|
|
1030
|
-
return dirent.content;
|
|
1715
|
+
|
|
1716
|
+
const name$6 = 'command';
|
|
1717
|
+
const getPlaceholder$7 = () => {
|
|
1718
|
+
return typeNameofCommandToRun();
|
|
1031
1719
|
};
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
state$2.files[part] = {
|
|
1038
|
-
type: Directory$1,
|
|
1039
|
-
content: ''
|
|
1040
|
-
};
|
|
1041
|
-
endIndex = uri.indexOf(Slash, endIndex + 1);
|
|
1042
|
-
}
|
|
1720
|
+
const helpEntries = () => {
|
|
1721
|
+
return [{
|
|
1722
|
+
description: showAndRunCommands(),
|
|
1723
|
+
category: 'global commands'
|
|
1724
|
+
}];
|
|
1043
1725
|
};
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
if (dirent) {
|
|
1047
|
-
dirent.content = content;
|
|
1048
|
-
} else {
|
|
1049
|
-
ensureParentDir(uri);
|
|
1050
|
-
state$2.files[uri] = {
|
|
1051
|
-
type: File$1,
|
|
1052
|
-
content
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1726
|
+
const getLabel$2 = () => {
|
|
1727
|
+
return '';
|
|
1055
1728
|
};
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1058
|
-
|
|
1729
|
+
const getNoResults$6 = () => {
|
|
1730
|
+
return {
|
|
1731
|
+
label: noMatchingResults()
|
|
1732
|
+
};
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
// TODO combine Ajax with cache (specify strategy: cacheFirst, networkFirst)
|
|
1736
|
+
const getBuiltinPicks = async () => {
|
|
1737
|
+
const builtinPicks = getAll();
|
|
1738
|
+
return builtinPicks;
|
|
1739
|
+
};
|
|
1740
|
+
const prefixIdWithExt = item => {
|
|
1741
|
+
if (!item.label) {
|
|
1742
|
+
warn('[QuickPick] item has missing label', item);
|
|
1059
1743
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1744
|
+
if (!item.id) {
|
|
1745
|
+
warn('[QuickPick] item has missing id', item);
|
|
1746
|
+
}
|
|
1747
|
+
return {
|
|
1748
|
+
...item,
|
|
1749
|
+
id: `ext.${item.id}`,
|
|
1750
|
+
label: item.label || item.id
|
|
1064
1751
|
};
|
|
1065
1752
|
};
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1753
|
+
const getExtensionPicks = async () => {
|
|
1754
|
+
try {
|
|
1755
|
+
// TODO don't call this every time
|
|
1756
|
+
const extensionPicks = await invoke$1('ExtensionHostCommands.getCommands');
|
|
1757
|
+
if (!extensionPicks) {
|
|
1758
|
+
return [];
|
|
1071
1759
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1760
|
+
const mappedPicks = extensionPicks.map(prefixIdWithExt);
|
|
1761
|
+
return mappedPicks;
|
|
1762
|
+
} catch (error) {
|
|
1763
|
+
console.error(`Failed to get extension picks: ${error}`);
|
|
1764
|
+
return [];
|
|
1075
1765
|
}
|
|
1076
1766
|
};
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1767
|
+
|
|
1768
|
+
// TODO send strings to renderer process only once for next occurrence send uint16array of ids of strings
|
|
1769
|
+
|
|
1770
|
+
const getPicks$7 = async () => {
|
|
1771
|
+
const builtinPicks = await getBuiltinPicks();
|
|
1772
|
+
const extensionPicks = await getExtensionPicks();
|
|
1773
|
+
return [...builtinPicks, ...extensionPicks];
|
|
1774
|
+
};
|
|
1775
|
+
const shouldHide = item => {
|
|
1776
|
+
if (item.id === 'Viewlet.openWidget' && item.args[0] === 'QuickPick') {
|
|
1777
|
+
return false;
|
|
1080
1778
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
name: key.slice(uri.length, -1)
|
|
1092
|
-
});
|
|
1093
|
-
}
|
|
1094
|
-
break;
|
|
1095
|
-
case File$1:
|
|
1096
|
-
if (!key.includes(Slash, uri.length + 1)) {
|
|
1097
|
-
dirents.push({
|
|
1098
|
-
// @ts-ignore
|
|
1099
|
-
type: value.type,
|
|
1100
|
-
name: key.slice(uri.length)
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
break;
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1779
|
+
return true;
|
|
1780
|
+
};
|
|
1781
|
+
const selectPickBuiltin = async item => {
|
|
1782
|
+
const args = item.args || [];
|
|
1783
|
+
// TODO ids should be all numbers for efficiency -> also directly can call command
|
|
1784
|
+
await invoke$1(item.id, ...args);
|
|
1785
|
+
if (shouldHide(item)) {
|
|
1786
|
+
return {
|
|
1787
|
+
command: Hide
|
|
1788
|
+
};
|
|
1106
1789
|
}
|
|
1107
|
-
return
|
|
1790
|
+
return {
|
|
1791
|
+
command: KeepOpen
|
|
1792
|
+
};
|
|
1108
1793
|
};
|
|
1109
|
-
const
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1794
|
+
const selectPickExtension = async item => {
|
|
1795
|
+
const id = item.id.slice(4); // TODO lots of string allocation with 'ext.' find a better way to separate builtin commands from extension commands
|
|
1796
|
+
try {
|
|
1797
|
+
await invoke$1('ExtensionHostCommands.executeCommand', id);
|
|
1798
|
+
} catch (error) {
|
|
1799
|
+
await handleError(error, false);
|
|
1800
|
+
// @ts-ignore
|
|
1801
|
+
await showErrorDialog();
|
|
1802
|
+
}
|
|
1803
|
+
return {
|
|
1804
|
+
command: Hide
|
|
1805
|
+
};
|
|
1116
1806
|
};
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1807
|
+
const selectPick$7 = async item => {
|
|
1808
|
+
if (item.id.startsWith('ext.')) {
|
|
1809
|
+
return selectPickExtension(item);
|
|
1810
|
+
}
|
|
1811
|
+
return selectPickBuiltin(item);
|
|
1121
1812
|
};
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1813
|
+
const getFilterValue$6 = value => {
|
|
1814
|
+
return value;
|
|
1124
1815
|
};
|
|
1125
|
-
const
|
|
1126
|
-
return
|
|
1816
|
+
const getPickFilterValue$2 = pick => {
|
|
1817
|
+
return pick.label;
|
|
1818
|
+
};
|
|
1819
|
+
const getPickLabel$2 = pick => {
|
|
1820
|
+
return pick.label;
|
|
1821
|
+
};
|
|
1822
|
+
const getPickIcon$2 = () => {
|
|
1823
|
+
return '';
|
|
1127
1824
|
};
|
|
1128
1825
|
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
|
|
1826
|
+
const QuickPickEntriesCommand = {
|
|
1827
|
+
__proto__: null,
|
|
1828
|
+
getFilterValue: getFilterValue$6,
|
|
1829
|
+
getLabel: getLabel$2,
|
|
1830
|
+
getNoResults: getNoResults$6,
|
|
1831
|
+
getPickFilterValue: getPickFilterValue$2,
|
|
1832
|
+
getPickIcon: getPickIcon$2,
|
|
1833
|
+
getPickLabel: getPickLabel$2,
|
|
1834
|
+
getPicks: getPicks$7,
|
|
1835
|
+
getPlaceholder: getPlaceholder$7,
|
|
1836
|
+
helpEntries,
|
|
1837
|
+
name: name$6,
|
|
1838
|
+
selectPick: selectPick$7
|
|
1839
|
+
};
|
|
1840
|
+
|
|
1841
|
+
const execute = async (method, ...params) => {
|
|
1842
|
+
// TODO
|
|
1843
|
+
};
|
|
1132
1844
|
|
|
1133
1845
|
const RE_PROTOCOL = /^([a-z-]+):\/\//;
|
|
1134
1846
|
const getProtocol = uri => {
|
|
@@ -1139,6 +1851,10 @@ const getProtocol = uri => {
|
|
|
1139
1851
|
return '';
|
|
1140
1852
|
};
|
|
1141
1853
|
|
|
1854
|
+
const Memfs = 'memfs';
|
|
1855
|
+
const Html = 'html';
|
|
1856
|
+
const Fetch = 'fetch';
|
|
1857
|
+
|
|
1142
1858
|
const searchFile$4 = async () => {
|
|
1143
1859
|
const files = await getFiles();
|
|
1144
1860
|
const keys = Object.keys(files);
|
|
@@ -1467,264 +2183,77 @@ const state$1 = {
|
|
|
1467
2183
|
const getHandleDb = async () => {
|
|
1468
2184
|
// @ts-ignore
|
|
1469
2185
|
const db = await openDB('handle', state$1.dbVersion, {
|
|
1470
|
-
async upgrade(db) {
|
|
1471
|
-
if (!db.objectStoreNames.contains('file-handles-store')) {
|
|
1472
|
-
await db.createObjectStore('file-handles-store', {});
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
});
|
|
1476
|
-
return db;
|
|
1477
|
-
};
|
|
1478
|
-
const getHandle$1 = async uri => {
|
|
1479
|
-
const handleDb = await getHandleDb();
|
|
1480
|
-
const handle = await handleDb.get('file-handles-store', uri);
|
|
1481
|
-
return handle;
|
|
1482
|
-
};
|
|
1483
|
-
|
|
1484
|
-
const getHandle = async uri => {
|
|
1485
|
-
try {
|
|
1486
|
-
// TODO retrieve handle from state or from indexeddb
|
|
1487
|
-
// TODO if not found, throw error
|
|
1488
|
-
const handle = await getHandle$1(uri);
|
|
1489
|
-
return handle;
|
|
1490
|
-
} catch (error) {
|
|
1491
|
-
throw new VError(error, 'Failed to get handle');
|
|
1492
|
-
}
|
|
1493
|
-
};
|
|
1494
|
-
|
|
1495
|
-
const getDirectoryHandle = async uri => {
|
|
1496
|
-
const handle = await getHandle(uri);
|
|
1497
|
-
if (handle) {
|
|
1498
|
-
return handle;
|
|
1499
|
-
}
|
|
1500
|
-
const dirname$1 = dirname('/', uri);
|
|
1501
|
-
if (uri === dirname$1) {
|
|
1502
|
-
return undefined;
|
|
1503
|
-
}
|
|
1504
|
-
return getDirectoryHandle(dirname$1);
|
|
1505
|
-
};
|
|
1506
|
-
const toIgnore = ['.git', 'node_modules', 'dist', 'dist2'];
|
|
1507
|
-
const searchFilesRecursively = async (all, parent, handle) => {
|
|
1508
|
-
const childHandles = await getChildHandles(handle);
|
|
1509
|
-
const promises = [];
|
|
1510
|
-
for (const childHandle of childHandles) {
|
|
1511
|
-
if (toIgnore.includes(childHandle.name)) {
|
|
1512
|
-
continue;
|
|
1513
|
-
}
|
|
1514
|
-
const absolutePath = parent + '/' + childHandle.name;
|
|
1515
|
-
switch (childHandle.kind) {
|
|
1516
|
-
case Directory:
|
|
1517
|
-
promises.push(searchFilesRecursively(all, absolutePath, childHandle));
|
|
1518
|
-
break;
|
|
1519
|
-
case File:
|
|
1520
|
-
all.push(absolutePath);
|
|
1521
|
-
break;
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
await Promise.all(promises);
|
|
1525
|
-
};
|
|
1526
|
-
const searchFile$2 = async uri => {
|
|
1527
|
-
const path = uri.slice('html://'.length);
|
|
1528
|
-
const handle = await getDirectoryHandle(path);
|
|
1529
|
-
if (!handle) {
|
|
1530
|
-
// @ts-ignore
|
|
1531
|
-
throw new VError(`Folder not found ${uri}`);
|
|
1532
|
-
}
|
|
1533
|
-
const all = [];
|
|
1534
|
-
await searchFilesRecursively(all, '', handle);
|
|
1535
|
-
return all;
|
|
1536
|
-
};
|
|
1537
|
-
|
|
1538
|
-
const SearchFileHtml = {
|
|
1539
|
-
__proto__: null,
|
|
1540
|
-
searchFile: searchFile$2
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
const Diagonal = 1;
|
|
1544
|
-
const Left = 2;
|
|
1545
|
-
|
|
1546
|
-
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1547
|
-
|
|
1548
|
-
const createTable = size => {
|
|
1549
|
-
const table = [];
|
|
1550
|
-
for (let i = 0; i < size; i++) {
|
|
1551
|
-
const row = new Uint8Array(size);
|
|
1552
|
-
table.push(row);
|
|
1553
|
-
}
|
|
1554
|
-
return table;
|
|
1555
|
-
};
|
|
1556
|
-
const EmptyMatches = [];
|
|
1557
|
-
const Dash = '-';
|
|
1558
|
-
const Dot = '.';
|
|
1559
|
-
const EmptyString = '';
|
|
1560
|
-
const Space = ' ';
|
|
1561
|
-
const Underline = '_';
|
|
1562
|
-
const T = 't';
|
|
1563
|
-
const isLowerCase = char => {
|
|
1564
|
-
return char === char.toLowerCase();
|
|
1565
|
-
};
|
|
1566
|
-
const isUpperCase = char => {
|
|
1567
|
-
return char === char.toUpperCase();
|
|
1568
|
-
};
|
|
1569
|
-
|
|
1570
|
-
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1571
|
-
const isGap = (columnCharBefore, columnChar) => {
|
|
1572
|
-
switch (columnCharBefore) {
|
|
1573
|
-
case Dash:
|
|
1574
|
-
case Underline:
|
|
1575
|
-
case EmptyString:
|
|
1576
|
-
case T:
|
|
1577
|
-
case Space:
|
|
1578
|
-
case Dot:
|
|
1579
|
-
return true;
|
|
1580
|
-
}
|
|
1581
|
-
if (isLowerCase(columnCharBefore) && isUpperCase(columnChar)) {
|
|
1582
|
-
return true;
|
|
1583
|
-
}
|
|
1584
|
-
return false;
|
|
1585
|
-
};
|
|
1586
|
-
|
|
1587
|
-
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1588
|
-
const getScore = (rowCharLow, rowChar, columnCharBefore, columnCharLow, columnChar, isDiagonalMatch) => {
|
|
1589
|
-
if (rowCharLow !== columnCharLow) {
|
|
1590
|
-
return -1;
|
|
1591
|
-
}
|
|
1592
|
-
const isMatch = rowChar === columnChar;
|
|
1593
|
-
if (isMatch) {
|
|
1594
|
-
if (isDiagonalMatch) {
|
|
1595
|
-
return 8;
|
|
1596
|
-
}
|
|
1597
|
-
if (isGap(columnCharBefore, columnChar)) {
|
|
1598
|
-
return 8;
|
|
1599
|
-
}
|
|
1600
|
-
return 5;
|
|
1601
|
-
}
|
|
1602
|
-
if (isGap(columnCharBefore, columnChar)) {
|
|
1603
|
-
return 8;
|
|
1604
|
-
}
|
|
1605
|
-
return 5;
|
|
1606
|
-
};
|
|
1607
|
-
|
|
1608
|
-
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1609
|
-
|
|
1610
|
-
const isPatternInWord = (patternLow, patternPos, patternLen, wordLow, wordPos, wordLen) => {
|
|
1611
|
-
while (patternPos < patternLen && wordPos < wordLen) {
|
|
1612
|
-
if (patternLow[patternPos] === wordLow[wordPos]) {
|
|
1613
|
-
patternPos += 1;
|
|
1614
|
-
}
|
|
1615
|
-
wordPos += 1;
|
|
1616
|
-
}
|
|
1617
|
-
return patternPos === patternLen; // pattern must be exhausted
|
|
1618
|
-
};
|
|
1619
|
-
|
|
1620
|
-
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1621
|
-
const traceHighlights = (table, arrows, patternLength, wordLength) => {
|
|
1622
|
-
let row = patternLength;
|
|
1623
|
-
let column = wordLength;
|
|
1624
|
-
const matches = [];
|
|
1625
|
-
while (row >= 1 && column >= 1) {
|
|
1626
|
-
const arrow = arrows[row][column];
|
|
1627
|
-
if (arrow === Left) {
|
|
1628
|
-
column--;
|
|
1629
|
-
} else if (arrow === Diagonal) {
|
|
1630
|
-
row--;
|
|
1631
|
-
column--;
|
|
1632
|
-
const start = column + 1;
|
|
1633
|
-
while (row >= 1 && column >= 1) {
|
|
1634
|
-
const arrow = arrows[row][column];
|
|
1635
|
-
if (arrow === Left) {
|
|
1636
|
-
break;
|
|
1637
|
-
}
|
|
1638
|
-
if (arrow === Diagonal) {
|
|
1639
|
-
row--;
|
|
1640
|
-
column--;
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
const end = column;
|
|
1644
|
-
matches.unshift(end, start);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
matches.unshift(table[patternLength][wordLength - 1]);
|
|
1648
|
-
return matches;
|
|
1649
|
-
};
|
|
1650
|
-
|
|
1651
|
-
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
1652
|
-
const gridSize = 128;
|
|
1653
|
-
const table = createTable(gridSize);
|
|
1654
|
-
const arrows = createTable(gridSize);
|
|
1655
|
-
const fuzzySearch = (pattern, word) => {
|
|
1656
|
-
const patternLength = Math.min(pattern.length, gridSize - 1);
|
|
1657
|
-
const wordLength = Math.min(word.length, gridSize - 1);
|
|
1658
|
-
const patternLower = pattern.toLowerCase();
|
|
1659
|
-
const wordLower = word.toLowerCase();
|
|
1660
|
-
if (!isPatternInWord(patternLower, 0, patternLength, wordLower, 0, wordLength)) {
|
|
1661
|
-
return EmptyMatches;
|
|
1662
|
-
}
|
|
1663
|
-
let strongMatch = false;
|
|
1664
|
-
for (let row = 1; row < patternLength + 1; row++) {
|
|
1665
|
-
const rowChar = pattern[row - 1];
|
|
1666
|
-
const rowCharLow = patternLower[row - 1];
|
|
1667
|
-
for (let column = 1; column < wordLength + 1; column++) {
|
|
1668
|
-
const columnChar = word[column - 1];
|
|
1669
|
-
const columnCharLow = wordLower[column - 1];
|
|
1670
|
-
const columnCharBefore = word[column - 2] || '';
|
|
1671
|
-
const isDiagonalMatch = arrows[row - 1][column - 1] === Diagonal;
|
|
1672
|
-
const score = getScore(rowCharLow, rowChar, columnCharBefore, columnCharLow, columnChar, isDiagonalMatch);
|
|
1673
|
-
if (row === 1 && score > 5) {
|
|
1674
|
-
strongMatch = true;
|
|
1675
|
-
}
|
|
1676
|
-
let diagonalScore = score + table[row - 1][column - 1];
|
|
1677
|
-
if (isDiagonalMatch && score !== -1) {
|
|
1678
|
-
diagonalScore += 2;
|
|
1679
|
-
}
|
|
1680
|
-
const leftScore = table[row][column - 1];
|
|
1681
|
-
if (leftScore > diagonalScore) {
|
|
1682
|
-
table[row][column] = leftScore;
|
|
1683
|
-
arrows[row][column] = Left;
|
|
1684
|
-
} else {
|
|
1685
|
-
table[row][column] = diagonalScore;
|
|
1686
|
-
arrows[row][column] = Diagonal;
|
|
2186
|
+
async upgrade(db) {
|
|
2187
|
+
if (!db.objectStoreNames.contains('file-handles-store')) {
|
|
2188
|
+
await db.createObjectStore('file-handles-store', {});
|
|
1687
2189
|
}
|
|
1688
2190
|
}
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
return EmptyMatches;
|
|
1692
|
-
}
|
|
1693
|
-
const highlights = traceHighlights(table, arrows, patternLength, wordLength);
|
|
1694
|
-
return highlights;
|
|
2191
|
+
});
|
|
2192
|
+
return db;
|
|
1695
2193
|
};
|
|
1696
|
-
|
|
1697
|
-
const
|
|
1698
|
-
const
|
|
1699
|
-
return
|
|
2194
|
+
const getHandle$1 = async uri => {
|
|
2195
|
+
const handleDb = await getHandleDb();
|
|
2196
|
+
const handle = await handleDb.get('file-handles-store', uri);
|
|
2197
|
+
return handle;
|
|
1700
2198
|
};
|
|
1701
2199
|
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
}
|
|
2200
|
+
const getHandle = async uri => {
|
|
2201
|
+
try {
|
|
2202
|
+
// TODO retrieve handle from state or from indexeddb
|
|
2203
|
+
// TODO if not found, throw error
|
|
2204
|
+
const handle = await getHandle$1(uri);
|
|
2205
|
+
return handle;
|
|
2206
|
+
} catch (error) {
|
|
2207
|
+
throw new VError(error, 'Failed to get handle');
|
|
2208
|
+
}
|
|
1711
2209
|
};
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
2210
|
+
|
|
2211
|
+
const getDirectoryHandle = async uri => {
|
|
2212
|
+
const handle = await getHandle(uri);
|
|
2213
|
+
if (handle) {
|
|
2214
|
+
return handle;
|
|
1715
2215
|
}
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
2216
|
+
const dirname$1 = dirname('/', uri);
|
|
2217
|
+
if (uri === dirname$1) {
|
|
2218
|
+
return undefined;
|
|
2219
|
+
}
|
|
2220
|
+
return getDirectoryHandle(dirname$1);
|
|
2221
|
+
};
|
|
2222
|
+
const toIgnore = ['.git', 'node_modules', 'dist', 'dist2'];
|
|
2223
|
+
const searchFilesRecursively = async (all, parent, handle) => {
|
|
2224
|
+
const childHandles = await getChildHandles(handle);
|
|
2225
|
+
const promises = [];
|
|
2226
|
+
for (const childHandle of childHandles) {
|
|
2227
|
+
if (toIgnore.includes(childHandle.name)) {
|
|
2228
|
+
continue;
|
|
2229
|
+
}
|
|
2230
|
+
const absolutePath = parent + '/' + childHandle.name;
|
|
2231
|
+
switch (childHandle.kind) {
|
|
2232
|
+
case Directory:
|
|
2233
|
+
promises.push(searchFilesRecursively(all, absolutePath, childHandle));
|
|
2234
|
+
break;
|
|
2235
|
+
case File:
|
|
2236
|
+
all.push(absolutePath);
|
|
2237
|
+
break;
|
|
1725
2238
|
}
|
|
1726
2239
|
}
|
|
1727
|
-
|
|
2240
|
+
await Promise.all(promises);
|
|
2241
|
+
};
|
|
2242
|
+
const searchFile$2 = async uri => {
|
|
2243
|
+
const path = uri.slice('html://'.length);
|
|
2244
|
+
const handle = await getDirectoryHandle(path);
|
|
2245
|
+
if (!handle) {
|
|
2246
|
+
// @ts-ignore
|
|
2247
|
+
throw new VError(`Folder not found ${uri}`);
|
|
2248
|
+
}
|
|
2249
|
+
const all = [];
|
|
2250
|
+
await searchFilesRecursively(all, '', handle);
|
|
2251
|
+
return all;
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
const SearchFileHtml = {
|
|
2255
|
+
__proto__: null,
|
|
2256
|
+
searchFile: searchFile$2
|
|
1728
2257
|
};
|
|
1729
2258
|
|
|
1730
2259
|
const getFileSearchRipGrepArgs = () => {
|
|
@@ -1732,18 +2261,6 @@ const getFileSearchRipGrepArgs = () => {
|
|
|
1732
2261
|
return ripGrepArgs;
|
|
1733
2262
|
};
|
|
1734
2263
|
|
|
1735
|
-
const state = {
|
|
1736
|
-
rpc: undefined
|
|
1737
|
-
};
|
|
1738
|
-
const invoke$1 = (method, ...params) => {
|
|
1739
|
-
const rpc = state.rpc;
|
|
1740
|
-
// @ts-ignore
|
|
1741
|
-
return rpc.invoke(method, ...params);
|
|
1742
|
-
};
|
|
1743
|
-
const setRpc = rpc => {
|
|
1744
|
-
state.rpc = rpc;
|
|
1745
|
-
};
|
|
1746
|
-
|
|
1747
2264
|
const invoke = (method, ...params) => {
|
|
1748
2265
|
return invoke$1('SearchProcess.invoke', method, ...params);
|
|
1749
2266
|
};
|
|
@@ -1798,6 +2315,494 @@ const searchFile = async (path, value, prepare, assetDir) => {
|
|
|
1798
2315
|
return result;
|
|
1799
2316
|
};
|
|
1800
2317
|
|
|
2318
|
+
const name$5 = 'file';
|
|
2319
|
+
const getPlaceholder$6 = () => {
|
|
2320
|
+
return '';
|
|
2321
|
+
};
|
|
2322
|
+
const getLabel$1 = () => {
|
|
2323
|
+
return files();
|
|
2324
|
+
};
|
|
2325
|
+
|
|
2326
|
+
// TODO help entries should not be here
|
|
2327
|
+
const getHelpEntries$6 = () => {
|
|
2328
|
+
return [{
|
|
2329
|
+
description: goToFile(),
|
|
2330
|
+
category: 'global commands'
|
|
2331
|
+
}];
|
|
2332
|
+
};
|
|
2333
|
+
const getNoResults$5 = () => {
|
|
2334
|
+
return {
|
|
2335
|
+
label: noMatchingResults()
|
|
2336
|
+
};
|
|
2337
|
+
};
|
|
2338
|
+
const getPicks$6 = async searchValue => {
|
|
2339
|
+
{
|
|
2340
|
+
return [];
|
|
2341
|
+
}
|
|
2342
|
+
};
|
|
2343
|
+
const selectPick$6 = async pick => {
|
|
2344
|
+
if (typeof pick === 'object') {
|
|
2345
|
+
pick = pick.pick;
|
|
2346
|
+
}
|
|
2347
|
+
const workspace = '';
|
|
2348
|
+
const absolutePath = `${workspace}/${pick}`;
|
|
2349
|
+
await execute(/* Main.openUri */'Main.openUri', /* uri */absolutePath);
|
|
2350
|
+
return {
|
|
2351
|
+
command: Hide
|
|
2352
|
+
};
|
|
2353
|
+
};
|
|
2354
|
+
const getFilterValue$5 = value => {
|
|
2355
|
+
return value;
|
|
2356
|
+
};
|
|
2357
|
+
const getPickFilterValue$1 = pick => {
|
|
2358
|
+
if (typeof pick === 'object') {
|
|
2359
|
+
pick = pick.pick;
|
|
2360
|
+
}
|
|
2361
|
+
return pick;
|
|
2362
|
+
};
|
|
2363
|
+
const getPickLabel$1 = pick => {
|
|
2364
|
+
if (typeof pick === 'object') {
|
|
2365
|
+
pick = pick.pick;
|
|
2366
|
+
}
|
|
2367
|
+
const baseName = pathBaseName(pick);
|
|
2368
|
+
return baseName;
|
|
2369
|
+
};
|
|
2370
|
+
const getPickDescription$1 = pick => {
|
|
2371
|
+
if (typeof pick === 'object') {
|
|
2372
|
+
pick = pick.pick;
|
|
2373
|
+
}
|
|
2374
|
+
const dirName = pathDirName(pick);
|
|
2375
|
+
return dirName;
|
|
2376
|
+
};
|
|
2377
|
+
const getPickIcon$1 = () => {
|
|
2378
|
+
return '';
|
|
2379
|
+
};
|
|
2380
|
+
const getPickFileIcon$1 = pick => {
|
|
2381
|
+
return '';
|
|
2382
|
+
};
|
|
2383
|
+
const isPrepared$1 = () => {
|
|
2384
|
+
const workspace = '';
|
|
2385
|
+
// TODO protocol should always be defined. For files it should use file protocol
|
|
2386
|
+
const protocol = getProtocol(workspace);
|
|
2387
|
+
return !protocol;
|
|
2388
|
+
};
|
|
2389
|
+
|
|
2390
|
+
const QuickPickEntriesFile = {
|
|
2391
|
+
__proto__: null,
|
|
2392
|
+
getFilterValue: getFilterValue$5,
|
|
2393
|
+
getHelpEntries: getHelpEntries$6,
|
|
2394
|
+
getLabel: getLabel$1,
|
|
2395
|
+
getNoResults: getNoResults$5,
|
|
2396
|
+
getPickDescription: getPickDescription$1,
|
|
2397
|
+
getPickFileIcon: getPickFileIcon$1,
|
|
2398
|
+
getPickFilterValue: getPickFilterValue$1,
|
|
2399
|
+
getPickIcon: getPickIcon$1,
|
|
2400
|
+
getPickLabel: getPickLabel$1,
|
|
2401
|
+
getPicks: getPicks$6,
|
|
2402
|
+
getPlaceholder: getPlaceholder$6,
|
|
2403
|
+
isPrepared: isPrepared$1,
|
|
2404
|
+
name: name$5,
|
|
2405
|
+
selectPick: selectPick$6
|
|
2406
|
+
};
|
|
2407
|
+
|
|
2408
|
+
const name$4 = 'goToLine';
|
|
2409
|
+
const getPlaceholder$5 = () => {
|
|
2410
|
+
return '';
|
|
2411
|
+
};
|
|
2412
|
+
const getHelpEntries$5 = () => {
|
|
2413
|
+
return [];
|
|
2414
|
+
};
|
|
2415
|
+
const getNoResults$4 = () => {
|
|
2416
|
+
return undefined;
|
|
2417
|
+
};
|
|
2418
|
+
const getPicks$5 = async () => {
|
|
2419
|
+
const picks = [{
|
|
2420
|
+
label: '1'
|
|
2421
|
+
}, {
|
|
2422
|
+
label: '2'
|
|
2423
|
+
}, {
|
|
2424
|
+
label: '3'
|
|
2425
|
+
}, {
|
|
2426
|
+
label: '4'
|
|
2427
|
+
}, {
|
|
2428
|
+
label: '5'
|
|
2429
|
+
}, {
|
|
2430
|
+
label: '6'
|
|
2431
|
+
}];
|
|
2432
|
+
return picks;
|
|
2433
|
+
};
|
|
2434
|
+
const selectPick$5 = async item => {
|
|
2435
|
+
const rowIndex = Number.parseInt(item.label);
|
|
2436
|
+
const position = {
|
|
2437
|
+
rowIndex,
|
|
2438
|
+
columnIndex: 5
|
|
2439
|
+
};
|
|
2440
|
+
await execute(/* EditorSetCursor.editorSetCursor */'TODO', /* position */position);
|
|
2441
|
+
// TODO put cursor onto that line
|
|
2442
|
+
return {
|
|
2443
|
+
command: Hide
|
|
2444
|
+
};
|
|
2445
|
+
};
|
|
2446
|
+
const getFilterValue$4 = value => {
|
|
2447
|
+
return value;
|
|
2448
|
+
};
|
|
2449
|
+
|
|
2450
|
+
const QuickPickEntriesGoToLine = {
|
|
2451
|
+
__proto__: null,
|
|
2452
|
+
getFilterValue: getFilterValue$4,
|
|
2453
|
+
getHelpEntries: getHelpEntries$5,
|
|
2454
|
+
getNoResults: getNoResults$4,
|
|
2455
|
+
getPicks: getPicks$5,
|
|
2456
|
+
getPlaceholder: getPlaceholder$5,
|
|
2457
|
+
name: name$4,
|
|
2458
|
+
selectPick: selectPick$5
|
|
2459
|
+
};
|
|
2460
|
+
|
|
2461
|
+
const name$3 = 'symbol';
|
|
2462
|
+
const getPlaceholder$4 = () => {
|
|
2463
|
+
return '';
|
|
2464
|
+
};
|
|
2465
|
+
const getHelpEntries$4 = () => {
|
|
2466
|
+
return [];
|
|
2467
|
+
};
|
|
2468
|
+
const getNoResults$3 = () => {
|
|
2469
|
+
return {
|
|
2470
|
+
label: noSymbolFound()
|
|
2471
|
+
};
|
|
2472
|
+
};
|
|
2473
|
+
const getPicks$4 = async () => {
|
|
2474
|
+
const picks = [];
|
|
2475
|
+
return picks;
|
|
2476
|
+
};
|
|
2477
|
+
const selectPick$4 = async item => {
|
|
2478
|
+
return {
|
|
2479
|
+
command: Hide
|
|
2480
|
+
};
|
|
2481
|
+
};
|
|
2482
|
+
const getFilterValue$3 = value => {
|
|
2483
|
+
return value;
|
|
2484
|
+
};
|
|
2485
|
+
|
|
2486
|
+
const QuickPickEntriesSymbol = {
|
|
2487
|
+
__proto__: null,
|
|
2488
|
+
getFilterValue: getFilterValue$3,
|
|
2489
|
+
getHelpEntries: getHelpEntries$4,
|
|
2490
|
+
getNoResults: getNoResults$3,
|
|
2491
|
+
getPicks: getPicks$4,
|
|
2492
|
+
getPlaceholder: getPlaceholder$4,
|
|
2493
|
+
name: name$3,
|
|
2494
|
+
selectPick: selectPick$4
|
|
2495
|
+
};
|
|
2496
|
+
|
|
2497
|
+
// TODO probably not needed
|
|
2498
|
+
|
|
2499
|
+
const getPlaceholder$3 = () => {
|
|
2500
|
+
return typeNameofCommandToRun();
|
|
2501
|
+
};
|
|
2502
|
+
const getHelpEntries$3 = () => {
|
|
2503
|
+
return undefined;
|
|
2504
|
+
};
|
|
2505
|
+
const getPicks$3 = async () => {
|
|
2506
|
+
// const views = ViewService.getViews()
|
|
2507
|
+
// const picks = views.map(toPick)
|
|
2508
|
+
// return picks
|
|
2509
|
+
return [];
|
|
2510
|
+
};
|
|
2511
|
+
const selectPick$3 = async item => {
|
|
2512
|
+
// Command.execute(/* openView */ 549, /* viewName */ item.label)
|
|
2513
|
+
// return {
|
|
2514
|
+
// command: QuickPickReturnValue.Hide,
|
|
2515
|
+
// }
|
|
2516
|
+
};
|
|
2517
|
+
const getFilterValue$2 = value => {
|
|
2518
|
+
return value;
|
|
2519
|
+
};
|
|
2520
|
+
|
|
2521
|
+
const QuickPickEntriesView = {
|
|
2522
|
+
__proto__: null,
|
|
2523
|
+
getFilterValue: getFilterValue$2,
|
|
2524
|
+
getHelpEntries: getHelpEntries$3,
|
|
2525
|
+
getPicks: getPicks$3,
|
|
2526
|
+
getPlaceholder: getPlaceholder$3,
|
|
2527
|
+
selectPick: selectPick$3
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2530
|
+
const name$2 = 'workspace-symbol';
|
|
2531
|
+
const getPlaceholder$2 = () => {
|
|
2532
|
+
return '';
|
|
2533
|
+
};
|
|
2534
|
+
const getHelpEntries$2 = () => {
|
|
2535
|
+
return [];
|
|
2536
|
+
};
|
|
2537
|
+
const getNoResults$2 = () => {
|
|
2538
|
+
return {
|
|
2539
|
+
label: noWorkspaceSymbolsFound()
|
|
2540
|
+
};
|
|
2541
|
+
};
|
|
2542
|
+
const getPicks$2 = async () => {
|
|
2543
|
+
const picks = [];
|
|
2544
|
+
return picks;
|
|
2545
|
+
};
|
|
2546
|
+
const selectPick$2 = async item => {
|
|
2547
|
+
return {
|
|
2548
|
+
command: Hide
|
|
2549
|
+
};
|
|
2550
|
+
};
|
|
2551
|
+
const getFilterValue$1 = value => {
|
|
2552
|
+
return value;
|
|
2553
|
+
};
|
|
2554
|
+
|
|
2555
|
+
const QuickPickEntriesWorkspaceSymbol = {
|
|
2556
|
+
__proto__: null,
|
|
2557
|
+
getFilterValue: getFilterValue$1,
|
|
2558
|
+
getHelpEntries: getHelpEntries$2,
|
|
2559
|
+
getNoResults: getNoResults$2,
|
|
2560
|
+
getPicks: getPicks$2,
|
|
2561
|
+
getPlaceholder: getPlaceholder$2,
|
|
2562
|
+
name: name$2,
|
|
2563
|
+
selectPick: selectPick$2
|
|
2564
|
+
};
|
|
2565
|
+
|
|
2566
|
+
// TODO avoid global variable
|
|
2567
|
+
|
|
2568
|
+
const state = {
|
|
2569
|
+
// providerId: PROVIDER_NOOP,
|
|
2570
|
+
provider: QuickPickNoop,
|
|
2571
|
+
prefix: 'string-that-should-never-match-another-string'
|
|
2572
|
+
};
|
|
2573
|
+
|
|
2574
|
+
/**
|
|
2575
|
+
* @type {string}
|
|
2576
|
+
*/
|
|
2577
|
+
const name$1 = 'everything';
|
|
2578
|
+
const getPlaceholder$1 = () => {
|
|
2579
|
+
return state.provider.getPlaceholder();
|
|
2580
|
+
};
|
|
2581
|
+
const getLabel = () => {
|
|
2582
|
+
return '';
|
|
2583
|
+
};
|
|
2584
|
+
const getHelpEntries$1 = () => {
|
|
2585
|
+
return state.provider.getHelpEntries();
|
|
2586
|
+
};
|
|
2587
|
+
const getNoResults$1 = () => {
|
|
2588
|
+
return state.provider.getNoResults();
|
|
2589
|
+
};
|
|
2590
|
+
const getPrefix = value => {
|
|
2591
|
+
if (value.startsWith(Command)) {
|
|
2592
|
+
return Command;
|
|
2593
|
+
}
|
|
2594
|
+
if (value.startsWith(Symbol$1)) {
|
|
2595
|
+
return Symbol$1;
|
|
2596
|
+
}
|
|
2597
|
+
if (value.startsWith(WorkspaceSymbol)) {
|
|
2598
|
+
return WorkspaceSymbol;
|
|
2599
|
+
}
|
|
2600
|
+
if (value.startsWith(GoToLine)) {
|
|
2601
|
+
return GoToLine;
|
|
2602
|
+
}
|
|
2603
|
+
if (value.startsWith(View)) {
|
|
2604
|
+
return View;
|
|
2605
|
+
}
|
|
2606
|
+
return None;
|
|
2607
|
+
};
|
|
2608
|
+
const getQuickPickProvider = prefix => {
|
|
2609
|
+
// TODO could use enum for prefix
|
|
2610
|
+
// TODO could use regex to extract prefix
|
|
2611
|
+
// TODO or could check first letter char code (less comparisons)
|
|
2612
|
+
switch (prefix) {
|
|
2613
|
+
case Command:
|
|
2614
|
+
return QuickPickEntriesCommand;
|
|
2615
|
+
case Symbol$1:
|
|
2616
|
+
return QuickPickEntriesSymbol;
|
|
2617
|
+
case WorkspaceSymbol:
|
|
2618
|
+
return QuickPickEntriesWorkspaceSymbol;
|
|
2619
|
+
case GoToLine:
|
|
2620
|
+
return QuickPickEntriesGoToLine;
|
|
2621
|
+
case View:
|
|
2622
|
+
return QuickPickEntriesView;
|
|
2623
|
+
default:
|
|
2624
|
+
return QuickPickEntriesFile;
|
|
2625
|
+
}
|
|
2626
|
+
};
|
|
2627
|
+
const getPicks$1 = async value => {
|
|
2628
|
+
const prefix = getPrefix(value);
|
|
2629
|
+
// TODO race condition
|
|
2630
|
+
if (state.prefix !== prefix) {
|
|
2631
|
+
state.prefix = prefix;
|
|
2632
|
+
// @ts-ignore
|
|
2633
|
+
state.provider = await getQuickPickProvider(prefix);
|
|
2634
|
+
}
|
|
2635
|
+
// TODO this line is a bit duplicated with getFilterValue
|
|
2636
|
+
const slicedValue = value.slice(prefix.length);
|
|
2637
|
+
const picks = await state.provider.getPicks(slicedValue);
|
|
2638
|
+
return picks;
|
|
2639
|
+
};
|
|
2640
|
+
const selectPick$1 = item => {
|
|
2641
|
+
const {
|
|
2642
|
+
provider
|
|
2643
|
+
} = state;
|
|
2644
|
+
return provider.selectPick(item);
|
|
2645
|
+
};
|
|
2646
|
+
const openCommandPalette = () => {
|
|
2647
|
+
// show('>')
|
|
2648
|
+
};
|
|
2649
|
+
const openView = () => {
|
|
2650
|
+
// show('view ')
|
|
2651
|
+
};
|
|
2652
|
+
const getFilterValue = value => {
|
|
2653
|
+
return value.slice(state.prefix.length);
|
|
2654
|
+
};
|
|
2655
|
+
const getPickFilterValue = pick => {
|
|
2656
|
+
const {
|
|
2657
|
+
provider
|
|
2658
|
+
} = state;
|
|
2659
|
+
return provider.getPickFilterValue(pick);
|
|
2660
|
+
};
|
|
2661
|
+
const getPickDescription = pick => {
|
|
2662
|
+
const {
|
|
2663
|
+
provider
|
|
2664
|
+
} = state;
|
|
2665
|
+
// @ts-ignore
|
|
2666
|
+
if (provider.getPickDescription) {
|
|
2667
|
+
// @ts-ignore
|
|
2668
|
+
return provider.getPickDescription(pick);
|
|
2669
|
+
}
|
|
2670
|
+
return '';
|
|
2671
|
+
};
|
|
2672
|
+
const getPickLabel = pick => {
|
|
2673
|
+
const {
|
|
2674
|
+
provider
|
|
2675
|
+
} = state;
|
|
2676
|
+
// @ts-ignore
|
|
2677
|
+
return provider.getPickLabel(pick);
|
|
2678
|
+
};
|
|
2679
|
+
const getPickIcon = pick => {
|
|
2680
|
+
const {
|
|
2681
|
+
provider
|
|
2682
|
+
} = state;
|
|
2683
|
+
// @ts-ignore
|
|
2684
|
+
return provider.getPickIcon(pick);
|
|
2685
|
+
};
|
|
2686
|
+
const getPickFileIcon = pick => {
|
|
2687
|
+
const {
|
|
2688
|
+
provider
|
|
2689
|
+
} = state;
|
|
2690
|
+
// @ts-ignore
|
|
2691
|
+
if (provider.getPickFileIcon) {
|
|
2692
|
+
// @ts-ignore
|
|
2693
|
+
return provider.getPickFileIcon(pick);
|
|
2694
|
+
}
|
|
2695
|
+
return '';
|
|
2696
|
+
};
|
|
2697
|
+
const isPrepared = () => {
|
|
2698
|
+
const {
|
|
2699
|
+
provider
|
|
2700
|
+
} = state;
|
|
2701
|
+
// @ts-ignore
|
|
2702
|
+
if (provider.isPrepared) {
|
|
2703
|
+
// @ts-ignore
|
|
2704
|
+
return provider.isPrepared();
|
|
2705
|
+
}
|
|
2706
|
+
return false;
|
|
2707
|
+
};
|
|
2708
|
+
|
|
2709
|
+
const QuickPickEntriesEverything = {
|
|
2710
|
+
__proto__: null,
|
|
2711
|
+
getFilterValue,
|
|
2712
|
+
getHelpEntries: getHelpEntries$1,
|
|
2713
|
+
getLabel,
|
|
2714
|
+
getNoResults: getNoResults$1,
|
|
2715
|
+
getPickDescription,
|
|
2716
|
+
getPickFileIcon,
|
|
2717
|
+
getPickFilterValue,
|
|
2718
|
+
getPickIcon,
|
|
2719
|
+
getPickLabel,
|
|
2720
|
+
getPicks: getPicks$1,
|
|
2721
|
+
getPlaceholder: getPlaceholder$1,
|
|
2722
|
+
isPrepared,
|
|
2723
|
+
name: name$1,
|
|
2724
|
+
openCommandPalette,
|
|
2725
|
+
openView,
|
|
2726
|
+
selectPick: selectPick$1,
|
|
2727
|
+
state
|
|
2728
|
+
};
|
|
2729
|
+
|
|
2730
|
+
const name = 'number';
|
|
2731
|
+
const getPlaceholder = () => {
|
|
2732
|
+
return '';
|
|
2733
|
+
};
|
|
2734
|
+
const getHelpEntries = () => {
|
|
2735
|
+
return [];
|
|
2736
|
+
};
|
|
2737
|
+
const getNoResults = () => {
|
|
2738
|
+
return {
|
|
2739
|
+
label: noMatchingResults()
|
|
2740
|
+
};
|
|
2741
|
+
};
|
|
2742
|
+
const getPicks = async () => {
|
|
2743
|
+
const picks = [{
|
|
2744
|
+
label: '1'
|
|
2745
|
+
}, {
|
|
2746
|
+
label: '2'
|
|
2747
|
+
}, {
|
|
2748
|
+
label: '3'
|
|
2749
|
+
}, {
|
|
2750
|
+
label: '4'
|
|
2751
|
+
}, {
|
|
2752
|
+
label: '5'
|
|
2753
|
+
}, {
|
|
2754
|
+
label: '6'
|
|
2755
|
+
}, {
|
|
2756
|
+
label: '7'
|
|
2757
|
+
}, {
|
|
2758
|
+
label: '8'
|
|
2759
|
+
}, {
|
|
2760
|
+
label: '9'
|
|
2761
|
+
}, {
|
|
2762
|
+
label: '10'
|
|
2763
|
+
}];
|
|
2764
|
+
return picks;
|
|
2765
|
+
};
|
|
2766
|
+
const selectPick = async item => {
|
|
2767
|
+
return {
|
|
2768
|
+
command: Hide
|
|
2769
|
+
};
|
|
2770
|
+
};
|
|
2771
|
+
|
|
2772
|
+
const QuickPickEntriesNumber = {
|
|
2773
|
+
__proto__: null,
|
|
2774
|
+
getHelpEntries,
|
|
2775
|
+
getNoResults,
|
|
2776
|
+
getPicks,
|
|
2777
|
+
getPlaceholder,
|
|
2778
|
+
name,
|
|
2779
|
+
selectPick
|
|
2780
|
+
};
|
|
2781
|
+
|
|
2782
|
+
const load = moduleId => {
|
|
2783
|
+
switch (moduleId) {
|
|
2784
|
+
case CommandPalette:
|
|
2785
|
+
case File$1:
|
|
2786
|
+
case EveryThing:
|
|
2787
|
+
case WorkspaceSymbol$1:
|
|
2788
|
+
return QuickPickEntriesEverything;
|
|
2789
|
+
case Number$1:
|
|
2790
|
+
return QuickPickEntriesNumber;
|
|
2791
|
+
case Recent:
|
|
2792
|
+
return QuickPickEntriesOpenRecent;
|
|
2793
|
+
case ColorTheme:
|
|
2794
|
+
return QuickPickEntriesColorTheme;
|
|
2795
|
+
case Symbol$2:
|
|
2796
|
+
return QuickPickEntriesSymbol;
|
|
2797
|
+
case View$1:
|
|
2798
|
+
return QuickPickEntriesView;
|
|
2799
|
+
case Custom:
|
|
2800
|
+
return QuickPickEntriesCustom;
|
|
2801
|
+
default:
|
|
2802
|
+
throw new Error(`unknown module "${moduleId}"`);
|
|
2803
|
+
}
|
|
2804
|
+
};
|
|
2805
|
+
|
|
1801
2806
|
const commandMap = {
|
|
1802
2807
|
'FileSystemFetch.chmod': chmod$1,
|
|
1803
2808
|
'FileSystemFetch.getBlob': getBlob$1,
|
|
@@ -1815,6 +2820,10 @@ const commandMap = {
|
|
|
1815
2820
|
'FileSystemMemory.readFile': readFile,
|
|
1816
2821
|
'FileSystemMemory.remove': remove,
|
|
1817
2822
|
'FileSystemMemory.writeFile': writeFile,
|
|
2823
|
+
'QuickPick.getKeyBindings': getKeyBindings,
|
|
2824
|
+
'QuickPick.loadEntries': loadQuickPickEntries,
|
|
2825
|
+
'QuickPick.loadEntries2': load,
|
|
2826
|
+
'SearchFile.filter': filterQuickPickItems,
|
|
1818
2827
|
'SearchFile.searchFile': searchFile,
|
|
1819
2828
|
'SearchFile.searchFileWithFetch': searchFile$3,
|
|
1820
2829
|
'SearchFile.searchFileWithHtml': searchFile$2,
|