@lvce-editor/source-control-worker 2.19.0 → 2.23.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/sourceControlWorkerMain.js +149 -112
- package/package.json +2 -2
|
@@ -231,8 +231,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
231
231
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
232
232
|
const message = lines[messageIndex];
|
|
233
233
|
return {
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
235
|
+
message
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
238
|
const isModuleNotFoundError = stderr => {
|
|
@@ -255,14 +255,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
255
255
|
const getNativeModuleErrorMessage = stderr => {
|
|
256
256
|
const message = getMessageCodeBlock(stderr);
|
|
257
257
|
return {
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
259
|
+
message: `Incompatible native node module: ${message}`
|
|
260
260
|
};
|
|
261
261
|
};
|
|
262
262
|
const getModuleSyntaxError = () => {
|
|
263
263
|
return {
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
265
|
+
message: `ES Modules are not supported in electron`
|
|
266
266
|
};
|
|
267
267
|
};
|
|
268
268
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -281,8 +281,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
281
281
|
rest
|
|
282
282
|
} = getDetails(lines);
|
|
283
283
|
return {
|
|
284
|
-
message: actualMessage,
|
|
285
284
|
code: '',
|
|
285
|
+
message: actualMessage,
|
|
286
286
|
stack: rest
|
|
287
287
|
};
|
|
288
288
|
};
|
|
@@ -292,8 +292,8 @@ class IpcError extends VError {
|
|
|
292
292
|
if (stdout || stderr) {
|
|
293
293
|
// @ts-ignore
|
|
294
294
|
const {
|
|
295
|
-
message,
|
|
296
295
|
code,
|
|
296
|
+
message,
|
|
297
297
|
stack
|
|
298
298
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
299
299
|
const cause = new Error(message);
|
|
@@ -354,8 +354,8 @@ const wrap$f = global => {
|
|
|
354
354
|
};
|
|
355
355
|
const waitForFirstMessage = async port => {
|
|
356
356
|
const {
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
promise,
|
|
358
|
+
resolve
|
|
359
359
|
} = Promise.withResolvers();
|
|
360
360
|
port.addEventListener('message', resolve, {
|
|
361
361
|
once: true
|
|
@@ -375,8 +375,8 @@ const listen$6 = async () => {
|
|
|
375
375
|
const type = firstMessage.params[0];
|
|
376
376
|
if (type === 'message-port') {
|
|
377
377
|
parentIpc.send({
|
|
378
|
-
jsonrpc: '2.0',
|
|
379
378
|
id: firstMessage.id,
|
|
379
|
+
jsonrpc: '2.0',
|
|
380
380
|
result: null
|
|
381
381
|
});
|
|
382
382
|
parentIpc.dispose();
|
|
@@ -433,8 +433,8 @@ const removeListener = (emitter, type, callback) => {
|
|
|
433
433
|
};
|
|
434
434
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
435
435
|
const {
|
|
436
|
-
|
|
437
|
-
|
|
436
|
+
promise,
|
|
437
|
+
resolve
|
|
438
438
|
} = Promise.withResolvers();
|
|
439
439
|
const listenerMap = Object.create(null);
|
|
440
440
|
const cleanup = value => {
|
|
@@ -446,8 +446,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
446
446
|
for (const [event, type] of Object.entries(eventMap)) {
|
|
447
447
|
const listener = event => {
|
|
448
448
|
cleanup({
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
event,
|
|
450
|
+
type
|
|
451
451
|
});
|
|
452
452
|
};
|
|
453
453
|
addListener(eventEmitter, event, listener);
|
|
@@ -457,8 +457,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
457
457
|
};
|
|
458
458
|
const Message$1 = 3;
|
|
459
459
|
const create$5$1 = async ({
|
|
460
|
-
|
|
461
|
-
|
|
460
|
+
isMessagePortOpen,
|
|
461
|
+
messagePort
|
|
462
462
|
}) => {
|
|
463
463
|
if (!isMessagePort(messagePort)) {
|
|
464
464
|
throw new IpcError('port must be of type MessagePort');
|
|
@@ -471,8 +471,8 @@ const create$5$1 = async ({
|
|
|
471
471
|
});
|
|
472
472
|
messagePort.start();
|
|
473
473
|
const {
|
|
474
|
-
|
|
475
|
-
|
|
474
|
+
event,
|
|
475
|
+
type
|
|
476
476
|
} = await eventPromise;
|
|
477
477
|
if (type !== Message$1) {
|
|
478
478
|
throw new IpcError('Failed to wait for ipc message');
|
|
@@ -1018,26 +1018,11 @@ const WebWorkerRpcClient = {
|
|
|
1018
1018
|
create: create$2
|
|
1019
1019
|
};
|
|
1020
1020
|
|
|
1021
|
-
const None$1 = 'none';
|
|
1022
|
-
const ToolBar = 'toolbar';
|
|
1023
|
-
const Tree$1 = 'tree';
|
|
1024
|
-
const TreeItem$1 = 'treeitem';
|
|
1025
|
-
|
|
1026
|
-
const Badge = 'Badge';
|
|
1027
|
-
const SourceControlBadge = 'SourceControlBadge';
|
|
1028
|
-
|
|
1029
1021
|
const Directory = 3;
|
|
1030
1022
|
const DirectoryExpanded = 4;
|
|
1031
1023
|
const File = 7;
|
|
1032
1024
|
|
|
1033
|
-
const Button$2 =
|
|
1034
|
-
const Div = 4;
|
|
1035
|
-
const Span = 8;
|
|
1036
|
-
const Text = 12;
|
|
1037
|
-
const Img = 17;
|
|
1038
|
-
const TextArea = 62;
|
|
1039
|
-
|
|
1040
|
-
const Button$1 = 'event.button';
|
|
1025
|
+
const Button$2 = 'event.button';
|
|
1041
1026
|
const ClientX = 'event.clientX';
|
|
1042
1027
|
const ClientY = 'event.clientY';
|
|
1043
1028
|
const DeltaMode = 'event.deltaMode';
|
|
@@ -1045,21 +1030,17 @@ const DeltaY = 'event.deltaY';
|
|
|
1045
1030
|
const TargetName = 'event.target.name';
|
|
1046
1031
|
const TargetValue = 'event.target.value';
|
|
1047
1032
|
|
|
1048
|
-
const Enter = 3;
|
|
1049
|
-
|
|
1050
1033
|
const User = 1;
|
|
1051
1034
|
const Script = 2;
|
|
1052
1035
|
|
|
1053
|
-
const CtrlCmd = 1 << 11 >>> 0;
|
|
1054
|
-
|
|
1055
1036
|
const SourceControl$1 = 22;
|
|
1056
1037
|
|
|
1057
|
-
const None = 0;
|
|
1038
|
+
const None$1 = 0;
|
|
1058
1039
|
|
|
1059
1040
|
const ExtensionHostWorker = 44;
|
|
1041
|
+
const IconThemeWorker = 7009;
|
|
1060
1042
|
const RendererWorker = 1;
|
|
1061
1043
|
const SourceControlWorker = 66;
|
|
1062
|
-
const IconThemeWorker = 7009;
|
|
1063
1044
|
|
|
1064
1045
|
const SetCss = 'Viewlet.setCss';
|
|
1065
1046
|
const SetDom2 = 'Viewlet.setDom2';
|
|
@@ -1067,7 +1048,7 @@ const SetFocusContext = 'Viewlet.setFocusContext';
|
|
|
1067
1048
|
const SetValueByName = 'Viewlet.setValueByName';
|
|
1068
1049
|
|
|
1069
1050
|
const List = 1;
|
|
1070
|
-
const Tree = 2;
|
|
1051
|
+
const Tree$1 = 2;
|
|
1071
1052
|
|
|
1072
1053
|
const FocusSourceControlInput = 24;
|
|
1073
1054
|
|
|
@@ -1081,6 +1062,10 @@ const get$2 = id => {
|
|
|
1081
1062
|
|
|
1082
1063
|
const create$1 = rpcId => {
|
|
1083
1064
|
return {
|
|
1065
|
+
async dispose() {
|
|
1066
|
+
const rpc = get$2(rpcId);
|
|
1067
|
+
await rpc.dispose();
|
|
1068
|
+
},
|
|
1084
1069
|
// @ts-ignore
|
|
1085
1070
|
invoke(method, ...params) {
|
|
1086
1071
|
const rpc = get$2(rpcId);
|
|
@@ -1095,22 +1080,20 @@ const create$1 = rpcId => {
|
|
|
1095
1080
|
},
|
|
1096
1081
|
set(rpc) {
|
|
1097
1082
|
set$4(rpcId, rpc);
|
|
1098
|
-
},
|
|
1099
|
-
async dispose() {
|
|
1100
|
-
const rpc = get$2(rpcId);
|
|
1101
|
-
await rpc.dispose();
|
|
1102
1083
|
}
|
|
1103
1084
|
};
|
|
1104
1085
|
};
|
|
1105
1086
|
|
|
1106
1087
|
const {
|
|
1107
1088
|
invoke: invoke$1,
|
|
1108
|
-
set: set$3
|
|
1089
|
+
set: set$3
|
|
1090
|
+
} = create$1(ExtensionHostWorker);
|
|
1109
1091
|
|
|
1110
1092
|
const {
|
|
1111
1093
|
invoke,
|
|
1112
1094
|
invokeAndTransfer,
|
|
1113
|
-
set: set$2
|
|
1095
|
+
set: set$2
|
|
1096
|
+
} = create$1(RendererWorker);
|
|
1114
1097
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1115
1098
|
number(uid);
|
|
1116
1099
|
number(menuId);
|
|
@@ -1126,8 +1109,8 @@ const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
|
1126
1109
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1127
1110
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1128
1111
|
};
|
|
1129
|
-
const activateByEvent$1 = event => {
|
|
1130
|
-
return invoke('ExtensionHostManagement.activateByEvent', event);
|
|
1112
|
+
const activateByEvent$1 = (event, assetDir, platform) => {
|
|
1113
|
+
return invoke('ExtensionHostManagement.activateByEvent', event, assetDir, platform);
|
|
1131
1114
|
};
|
|
1132
1115
|
const sendMessagePortToTextMeasurementWorker$1 = async port => {
|
|
1133
1116
|
const command = 'TextMeasurement.handleMessagePort';
|
|
@@ -1142,7 +1125,8 @@ const openUri$1 = async (uri, focus, options) => {
|
|
|
1142
1125
|
};
|
|
1143
1126
|
|
|
1144
1127
|
const {
|
|
1145
|
-
set: set$1
|
|
1128
|
+
set: set$1
|
|
1129
|
+
} = create$1(IconThemeWorker);
|
|
1146
1130
|
|
|
1147
1131
|
const toCommandId = key => {
|
|
1148
1132
|
const dotIndex = key.indexOf('.');
|
|
@@ -1381,16 +1365,21 @@ const getFinalDeltaY = (height, itemHeight, itemsLength) => {
|
|
|
1381
1365
|
return finalDeltaY;
|
|
1382
1366
|
};
|
|
1383
1367
|
|
|
1384
|
-
const activateByEvent = event => {
|
|
1385
|
-
|
|
1368
|
+
const activateByEvent = (event, assetDir, platform) => {
|
|
1369
|
+
string(event);
|
|
1370
|
+
string(assetDir);
|
|
1371
|
+
number(platform);
|
|
1372
|
+
return activateByEvent$1(event, assetDir, platform);
|
|
1386
1373
|
};
|
|
1387
1374
|
|
|
1388
1375
|
const executeProvider = async ({
|
|
1376
|
+
assetDir,
|
|
1389
1377
|
event,
|
|
1390
1378
|
method,
|
|
1391
|
-
params
|
|
1379
|
+
params,
|
|
1380
|
+
platform
|
|
1392
1381
|
}) => {
|
|
1393
|
-
await activateByEvent(event);
|
|
1382
|
+
await activateByEvent(event, assetDir, platform);
|
|
1394
1383
|
// @ts-ignore
|
|
1395
1384
|
const result = await invoke$1(method, ...params);
|
|
1396
1385
|
return result;
|
|
@@ -1403,42 +1392,54 @@ const SourceControlGetEnabledProviderIds = 'ExtensionHostSourceControl.getEnable
|
|
|
1403
1392
|
const SourceControlGetFileBefore = 'ExtensionHostSourceControl.getFileBefore';
|
|
1404
1393
|
const SourceControlGetGroups = 'ExtensionHostSourceControl.getGroups';
|
|
1405
1394
|
|
|
1406
|
-
const acceptInput$2 = async (providerId, text) => {
|
|
1395
|
+
const acceptInput$2 = async (providerId, text, assetDir, platform) => {
|
|
1407
1396
|
return executeProvider({
|
|
1397
|
+
assetDir,
|
|
1408
1398
|
event: 'none',
|
|
1409
1399
|
method: SourceControlAcceptInput,
|
|
1410
|
-
params: [providerId, text]
|
|
1400
|
+
params: [providerId, text],
|
|
1401
|
+
platform
|
|
1411
1402
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1412
1403
|
});
|
|
1413
1404
|
};
|
|
1414
|
-
const getFileDecorations$1 = (providerId, uris) => {
|
|
1405
|
+
const getFileDecorations$1 = (providerId, uris, assetDir, platform) => {
|
|
1406
|
+
string(assetDir);
|
|
1407
|
+
number(platform);
|
|
1415
1408
|
return executeProvider({
|
|
1409
|
+
assetDir,
|
|
1416
1410
|
event: 'none',
|
|
1417
1411
|
method: SourceControlGetFileDecorations,
|
|
1418
|
-
params: [providerId, uris]
|
|
1412
|
+
params: [providerId, uris],
|
|
1413
|
+
platform
|
|
1419
1414
|
});
|
|
1420
1415
|
};
|
|
1421
|
-
const getFileBefore$1 = (providerId, path) => {
|
|
1416
|
+
const getFileBefore$1 = (providerId, path, assetDir, platform) => {
|
|
1422
1417
|
return executeProvider({
|
|
1418
|
+
assetDir,
|
|
1423
1419
|
event: 'none',
|
|
1424
1420
|
method: SourceControlGetFileBefore,
|
|
1425
|
-
params: [providerId, path]
|
|
1421
|
+
params: [providerId, path],
|
|
1422
|
+
platform
|
|
1426
1423
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1427
1424
|
});
|
|
1428
1425
|
};
|
|
1429
|
-
const getGroups$2 = (providerId, path) => {
|
|
1426
|
+
const getGroups$2 = (providerId, path, assetDir, platform) => {
|
|
1430
1427
|
return executeProvider({
|
|
1428
|
+
assetDir,
|
|
1431
1429
|
event: 'none',
|
|
1432
1430
|
method: SourceControlGetGroups,
|
|
1433
|
-
params: [providerId, path]
|
|
1431
|
+
params: [providerId, path],
|
|
1432
|
+
platform
|
|
1434
1433
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1435
1434
|
});
|
|
1436
1435
|
};
|
|
1437
|
-
const getEnabledProviderIds$1 = (scheme, root) => {
|
|
1436
|
+
const getEnabledProviderIds$1 = (scheme, root, assetDir, platform) => {
|
|
1438
1437
|
return executeProvider({
|
|
1438
|
+
assetDir,
|
|
1439
1439
|
event: `onSourceControl:${scheme}`,
|
|
1440
1440
|
method: SourceControlGetEnabledProviderIds,
|
|
1441
|
-
params: [scheme, root]
|
|
1441
|
+
params: [scheme, root],
|
|
1442
|
+
platform
|
|
1442
1443
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1443
1444
|
});
|
|
1444
1445
|
};
|
|
@@ -1448,24 +1449,24 @@ const getIconDefinitions$1 = async providerId => {
|
|
|
1448
1449
|
return result;
|
|
1449
1450
|
};
|
|
1450
1451
|
|
|
1451
|
-
const acceptInput$1 = (providerId, text) => {
|
|
1452
|
+
const acceptInput$1 = (providerId, text, assetDir, platform) => {
|
|
1452
1453
|
string(providerId);
|
|
1453
1454
|
string(text);
|
|
1454
|
-
return acceptInput$2(providerId, text);
|
|
1455
|
+
return acceptInput$2(providerId, text, assetDir, platform);
|
|
1455
1456
|
};
|
|
1456
|
-
const getFileDecorations = (providerId, uris) => {
|
|
1457
|
-
return getFileDecorations$1(providerId, uris);
|
|
1457
|
+
const getFileDecorations = (providerId, uris, assetDir, platform) => {
|
|
1458
|
+
return getFileDecorations$1(providerId, uris, assetDir, platform);
|
|
1458
1459
|
};
|
|
1459
|
-
const getFileBefore = (providerId, file) => {
|
|
1460
|
-
return getFileBefore$1(providerId, file);
|
|
1460
|
+
const getFileBefore = (providerId, file, assetDir, platform) => {
|
|
1461
|
+
return getFileBefore$1(providerId, file, assetDir, platform);
|
|
1461
1462
|
};
|
|
1462
|
-
const getEnabledProviderIds = (scheme, root) => {
|
|
1463
|
+
const getEnabledProviderIds = (scheme, root, assetDir, platform) => {
|
|
1463
1464
|
string(scheme);
|
|
1464
1465
|
string(root);
|
|
1465
|
-
return getEnabledProviderIds$1(scheme, root);
|
|
1466
|
+
return getEnabledProviderIds$1(scheme, root, assetDir, platform);
|
|
1466
1467
|
};
|
|
1467
|
-
const getGroups$1 = (providerId, root) => {
|
|
1468
|
-
return getGroups$2(providerId, root);
|
|
1468
|
+
const getGroups$1 = (providerId, root, assetDir, platform) => {
|
|
1469
|
+
return getGroups$2(providerId, root, assetDir, platform);
|
|
1469
1470
|
};
|
|
1470
1471
|
const getIconDefinitions = async providerIds => {
|
|
1471
1472
|
try {
|
|
@@ -1478,11 +1479,10 @@ const getIconDefinitions = async providerIds => {
|
|
|
1478
1479
|
}
|
|
1479
1480
|
};
|
|
1480
1481
|
|
|
1481
|
-
const getGroups = async enabledProviderIds => {
|
|
1482
|
+
const getGroups = async (enabledProviderIds, root, assetDir, platform) => {
|
|
1482
1483
|
const allGroups = [];
|
|
1483
1484
|
for (const providerId of enabledProviderIds) {
|
|
1484
|
-
|
|
1485
|
-
const groups = await getGroups$1(providerId);
|
|
1485
|
+
const groups = await getGroups$1(providerId, root, assetDir, platform);
|
|
1486
1486
|
allGroups.push(...groups);
|
|
1487
1487
|
}
|
|
1488
1488
|
return {
|
|
@@ -1491,28 +1491,28 @@ const getGroups = async enabledProviderIds => {
|
|
|
1491
1491
|
};
|
|
1492
1492
|
};
|
|
1493
1493
|
|
|
1494
|
-
const getTextHeight = async (input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight) => {
|
|
1494
|
+
const getTextHeight = async (input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight, inputPadding) => {
|
|
1495
1495
|
try {
|
|
1496
1496
|
if (!input) {
|
|
1497
|
-
return lineHeight;
|
|
1497
|
+
return lineHeight + inputPadding * 2;
|
|
1498
1498
|
}
|
|
1499
1499
|
const actualInput = input;
|
|
1500
1500
|
// TODO line height could also be like 1.5
|
|
1501
1501
|
const lineHeightPx = `${lineHeight}px`;
|
|
1502
1502
|
// @ts-ignore
|
|
1503
1503
|
const height = await invoke(`MeasureTextHeight.measureTextBlockHeight`, actualInput, fontFamily, fontSize, lineHeightPx, width);
|
|
1504
|
-
return height;
|
|
1504
|
+
return height + inputPadding * 2;
|
|
1505
1505
|
} catch {
|
|
1506
1506
|
// fallback
|
|
1507
1507
|
const lines = input.split('\n');
|
|
1508
1508
|
const lineCount = lines.length;
|
|
1509
|
-
const inputHeight = lineCount * lineHeight;
|
|
1509
|
+
const inputHeight = lineCount * lineHeight + inputPadding * 2;
|
|
1510
1510
|
return inputHeight;
|
|
1511
1511
|
}
|
|
1512
1512
|
};
|
|
1513
1513
|
|
|
1514
|
-
const getInputHeight = async (input, width, fontFamily, fontWeight, fontSize, letterSpacing, lineHeight) => {
|
|
1515
|
-
const height = await getTextHeight(input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight);
|
|
1514
|
+
const getInputHeight = async (input, width, fontFamily, fontWeight, fontSize, letterSpacing, lineHeight, inputPadding) => {
|
|
1515
|
+
const height = await getTextHeight(input, width, fontFamily, fontSize, fontWeight, letterSpacing, lineHeight, inputPadding);
|
|
1516
1516
|
return height;
|
|
1517
1517
|
};
|
|
1518
1518
|
|
|
@@ -1710,6 +1710,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1710
1710
|
inputFontWeight,
|
|
1711
1711
|
inputLetterSpacing,
|
|
1712
1712
|
inputLineHeight,
|
|
1713
|
+
inputPadding,
|
|
1713
1714
|
itemHeight,
|
|
1714
1715
|
minimumSliderSize,
|
|
1715
1716
|
width,
|
|
@@ -1720,12 +1721,16 @@ const loadContent = async (state, savedState) => {
|
|
|
1720
1721
|
const {
|
|
1721
1722
|
inputValue
|
|
1722
1723
|
} = restoreState(savedState);
|
|
1723
|
-
const
|
|
1724
|
+
const {
|
|
1725
|
+
assetDir,
|
|
1726
|
+
platform
|
|
1727
|
+
} = state;
|
|
1728
|
+
const enabledProviderIds = await getEnabledProviderIds(scheme, root, assetDir, platform);
|
|
1724
1729
|
const iconDefinitions = await getIconDefinitions(enabledProviderIds);
|
|
1725
1730
|
const {
|
|
1726
1731
|
allGroups,
|
|
1727
1732
|
gitRoot
|
|
1728
|
-
} = await getGroups(enabledProviderIds);
|
|
1733
|
+
} = await getGroups(enabledProviderIds, root, assetDir, platform);
|
|
1729
1734
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
1730
1735
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
1731
1736
|
const actionsCache = await requestSourceActions();
|
|
@@ -1744,7 +1749,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1744
1749
|
const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, newFileIconCache);
|
|
1745
1750
|
const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
|
|
1746
1751
|
const inputPlaceholder = messageEnterToCommitOnMaster();
|
|
1747
|
-
const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight);
|
|
1752
|
+
const inputBoxHeight = await getInputHeight(inputValue, width, inputFontFamily, inputFontSize, inputFontWeight, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
1748
1753
|
return {
|
|
1749
1754
|
...state,
|
|
1750
1755
|
actionsCache,
|
|
@@ -1780,15 +1785,17 @@ const warn = (...args) => {
|
|
|
1780
1785
|
|
|
1781
1786
|
const acceptInput = async state => {
|
|
1782
1787
|
const {
|
|
1788
|
+
assetDir,
|
|
1783
1789
|
enabledProviderIds,
|
|
1784
|
-
inputValue
|
|
1790
|
+
inputValue,
|
|
1791
|
+
platform
|
|
1785
1792
|
} = state;
|
|
1786
1793
|
if (enabledProviderIds.length === 0) {
|
|
1787
1794
|
info('[ViewletSourceControl] no source control provider found');
|
|
1788
1795
|
return state;
|
|
1789
1796
|
}
|
|
1790
1797
|
const providerId = enabledProviderIds[0];
|
|
1791
|
-
await acceptInput$1(providerId, inputValue);
|
|
1798
|
+
await acceptInput$1(providerId, inputValue, assetDir, platform);
|
|
1792
1799
|
const newState = await loadContent(state, {});
|
|
1793
1800
|
return {
|
|
1794
1801
|
...newState,
|
|
@@ -1805,10 +1812,11 @@ const {
|
|
|
1805
1812
|
wrapGetter
|
|
1806
1813
|
} = create();
|
|
1807
1814
|
|
|
1808
|
-
const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
1815
|
+
const create2 = (id, uri, x, y, width, height, workspacePath, platform, assetDir) => {
|
|
1809
1816
|
const state = {
|
|
1810
1817
|
actionsCache: Object.create(null),
|
|
1811
1818
|
allGroups: [],
|
|
1819
|
+
assetDir,
|
|
1812
1820
|
badgeCount: 0,
|
|
1813
1821
|
decorationIcons: [],
|
|
1814
1822
|
deltaY: 0,
|
|
@@ -1833,6 +1841,7 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1833
1841
|
inputFontWeight: 400,
|
|
1834
1842
|
inputLetterSpacing: 0,
|
|
1835
1843
|
inputLineHeight: 20,
|
|
1844
|
+
inputPadding: 2,
|
|
1836
1845
|
inputPlaceholder: '',
|
|
1837
1846
|
inputSource: 0,
|
|
1838
1847
|
inputValue: '',
|
|
@@ -1844,6 +1853,7 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
|
1844
1853
|
merge: [],
|
|
1845
1854
|
minimumSliderSize: 20,
|
|
1846
1855
|
minLineY: 0,
|
|
1856
|
+
platform,
|
|
1847
1857
|
providerId: '',
|
|
1848
1858
|
root: '',
|
|
1849
1859
|
scrollBarActive: false,
|
|
@@ -1918,6 +1928,25 @@ const getInfo = uid => {
|
|
|
1918
1928
|
return newState.allGroups;
|
|
1919
1929
|
};
|
|
1920
1930
|
|
|
1931
|
+
const None = 'none';
|
|
1932
|
+
const ToolBar = 'toolbar';
|
|
1933
|
+
const Tree = 'tree';
|
|
1934
|
+
const TreeItem$1 = 'treeitem';
|
|
1935
|
+
|
|
1936
|
+
const Badge = 'Badge';
|
|
1937
|
+
const SourceControlBadge = 'SourceControlBadge';
|
|
1938
|
+
|
|
1939
|
+
const Button$1 = 1;
|
|
1940
|
+
const Div = 4;
|
|
1941
|
+
const Span = 8;
|
|
1942
|
+
const Text = 12;
|
|
1943
|
+
const Img = 17;
|
|
1944
|
+
const TextArea = 62;
|
|
1945
|
+
|
|
1946
|
+
const Enter = 3;
|
|
1947
|
+
|
|
1948
|
+
const CtrlCmd = 1 << 11 >>> 0;
|
|
1949
|
+
|
|
1921
1950
|
const mergeClassNames = (...classNames) => {
|
|
1922
1951
|
return classNames.filter(Boolean).join(' ');
|
|
1923
1952
|
};
|
|
@@ -1941,42 +1970,42 @@ const getKeyBindings = () => {
|
|
|
1941
1970
|
const getMenuEntries = () => {
|
|
1942
1971
|
return [{
|
|
1943
1972
|
command: /* TODO */'-1',
|
|
1944
|
-
flags: None,
|
|
1973
|
+
flags: None$1,
|
|
1945
1974
|
id: '',
|
|
1946
1975
|
label: openChanges()
|
|
1947
1976
|
}, {
|
|
1948
1977
|
command: /* TODO */'-1',
|
|
1949
|
-
flags: None,
|
|
1978
|
+
flags: None$1,
|
|
1950
1979
|
id: '',
|
|
1951
1980
|
label: openFile()
|
|
1952
1981
|
}, {
|
|
1953
1982
|
command: /* TODO */'-1',
|
|
1954
|
-
flags: None,
|
|
1983
|
+
flags: None$1,
|
|
1955
1984
|
id: '',
|
|
1956
1985
|
label: openFileHead()
|
|
1957
1986
|
}, {
|
|
1958
1987
|
command: /* TODO */'-1',
|
|
1959
|
-
flags: None,
|
|
1988
|
+
flags: None$1,
|
|
1960
1989
|
id: '',
|
|
1961
1990
|
label: discardChanges()
|
|
1962
1991
|
}, {
|
|
1963
1992
|
command: /* TODO */'-1',
|
|
1964
|
-
flags: None,
|
|
1993
|
+
flags: None$1,
|
|
1965
1994
|
id: '',
|
|
1966
1995
|
label: stageChanges()
|
|
1967
1996
|
}, {
|
|
1968
1997
|
command: /* TODO */'-1',
|
|
1969
|
-
flags: None,
|
|
1998
|
+
flags: None$1,
|
|
1970
1999
|
id: '',
|
|
1971
2000
|
label: addToGitignore()
|
|
1972
2001
|
}, {
|
|
1973
2002
|
command: /* TODO */'-1',
|
|
1974
|
-
flags: None,
|
|
2003
|
+
flags: None$1,
|
|
1975
2004
|
id: '',
|
|
1976
2005
|
label: revealInExplorerView()
|
|
1977
2006
|
}, {
|
|
1978
2007
|
command: /* TODO */'-1',
|
|
1979
|
-
flags: None,
|
|
2008
|
+
flags: None$1,
|
|
1980
2009
|
id: '',
|
|
1981
2010
|
label: openContainingFolder()
|
|
1982
2011
|
}];
|
|
@@ -1998,18 +2027,21 @@ const Refresh$1 = 'Refresh';
|
|
|
1998
2027
|
const refresh = async state => {
|
|
1999
2028
|
const {
|
|
2000
2029
|
actionsCache,
|
|
2030
|
+
assetDir,
|
|
2001
2031
|
enabledProviderIds,
|
|
2002
2032
|
fileIconCache,
|
|
2003
2033
|
height,
|
|
2004
2034
|
iconDefinitions,
|
|
2005
2035
|
itemHeight,
|
|
2006
2036
|
minimumSliderSize,
|
|
2037
|
+
platform,
|
|
2038
|
+
root,
|
|
2007
2039
|
splitButtonEnabled
|
|
2008
2040
|
} = state;
|
|
2009
2041
|
const {
|
|
2010
2042
|
allGroups,
|
|
2011
2043
|
gitRoot
|
|
2012
|
-
} = await getGroups(enabledProviderIds);
|
|
2044
|
+
} = await getGroups(enabledProviderIds, root, assetDir, platform);
|
|
2013
2045
|
const expandedGroups = restoreExpandedGroups(allGroups);
|
|
2014
2046
|
const displayItems = getDisplayItems(allGroups, expandedGroups, iconDefinitions);
|
|
2015
2047
|
const badgeCount = allGroups.reduce((sum, group) => sum + group.items.length, 0);
|
|
@@ -2043,7 +2075,7 @@ const refresh = async state => {
|
|
|
2043
2075
|
const viewAsTree = state => {
|
|
2044
2076
|
return {
|
|
2045
2077
|
...state,
|
|
2046
|
-
viewMode: Tree
|
|
2078
|
+
viewMode: Tree$1
|
|
2047
2079
|
};
|
|
2048
2080
|
};
|
|
2049
2081
|
|
|
@@ -2062,11 +2094,13 @@ const handleActionClick = async (state, actionName) => {
|
|
|
2062
2094
|
}
|
|
2063
2095
|
};
|
|
2064
2096
|
|
|
2065
|
-
const executeCommand = (id, ...args) => {
|
|
2097
|
+
const executeCommand = (id, assetDir, platform, ...args) => {
|
|
2066
2098
|
return executeProvider({
|
|
2099
|
+
assetDir,
|
|
2067
2100
|
event: `onCommand:${id}`,
|
|
2068
2101
|
method: CommandExecute,
|
|
2069
|
-
params: [id, ...args]
|
|
2102
|
+
params: [id, ...args],
|
|
2103
|
+
platform
|
|
2070
2104
|
});
|
|
2071
2105
|
};
|
|
2072
2106
|
|
|
@@ -2079,7 +2113,7 @@ const handleButtonClick = async (state, clickedIndex) => {
|
|
|
2079
2113
|
if (!button) {
|
|
2080
2114
|
return state;
|
|
2081
2115
|
}
|
|
2082
|
-
await executeCommand(button.command, item.file);
|
|
2116
|
+
await executeCommand(button.command, state.assetDir, state.platform, item.file);
|
|
2083
2117
|
const newState = await loadContent(state, {});
|
|
2084
2118
|
return newState;
|
|
2085
2119
|
};
|
|
@@ -2114,7 +2148,7 @@ const handleClickSourceControlButtons = async (state, index, name) => {
|
|
|
2114
2148
|
const {
|
|
2115
2149
|
file
|
|
2116
2150
|
} = item;
|
|
2117
|
-
await executeCommand(button.command, file);
|
|
2151
|
+
await executeCommand(button.command, state.assetDir, state.platform, file);
|
|
2118
2152
|
const newState = await refresh(state);
|
|
2119
2153
|
return newState;
|
|
2120
2154
|
};
|
|
@@ -2188,13 +2222,15 @@ const openDiffEditor = async (before, afterPath, width) => {
|
|
|
2188
2222
|
|
|
2189
2223
|
const handleClickFile = async (state, item) => {
|
|
2190
2224
|
const {
|
|
2225
|
+
assetDir,
|
|
2191
2226
|
enabledProviderIds,
|
|
2227
|
+
platform,
|
|
2192
2228
|
root
|
|
2193
2229
|
} = state;
|
|
2194
2230
|
const providerId = enabledProviderIds[0];
|
|
2195
2231
|
const absolutePath = `${root}/${item.file}`;
|
|
2196
2232
|
// TODO handle error
|
|
2197
|
-
const [fileBefore] = await Promise.all([getFileBefore(providerId, item.file), readFile(absolutePath)]);
|
|
2233
|
+
const [fileBefore] = await Promise.all([getFileBefore(providerId, item.file, assetDir, platform), readFile(absolutePath)]);
|
|
2198
2234
|
|
|
2199
2235
|
// TODO diff editor should determine width by itself
|
|
2200
2236
|
await openDiffEditor(fileBefore, absolutePath);
|
|
@@ -2259,9 +2295,10 @@ const handleInput = async (state, value, inputSource = User) => {
|
|
|
2259
2295
|
inputFontWeight,
|
|
2260
2296
|
inputLetterSpacing,
|
|
2261
2297
|
inputLineHeight,
|
|
2298
|
+
inputPadding,
|
|
2262
2299
|
width
|
|
2263
2300
|
} = state;
|
|
2264
|
-
const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight);
|
|
2301
|
+
const inputBoxHeight = await getInputHeight(value, width, inputFontFamily, inputFontWeight, inputFontSize, inputLetterSpacing, inputLineHeight, inputPadding);
|
|
2265
2302
|
return {
|
|
2266
2303
|
...state,
|
|
2267
2304
|
inputBoxHeight,
|
|
@@ -2507,7 +2544,7 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
2507
2544
|
return {
|
|
2508
2545
|
childCount: 0,
|
|
2509
2546
|
className: `MaskIcon MaskIcon${icon}`,
|
|
2510
|
-
role: None
|
|
2547
|
+
role: None,
|
|
2511
2548
|
type
|
|
2512
2549
|
};
|
|
2513
2550
|
};
|
|
@@ -2523,7 +2560,7 @@ const getButtonVirtualDom = button => {
|
|
|
2523
2560
|
className: SourceControlButton,
|
|
2524
2561
|
name: label,
|
|
2525
2562
|
title: label,
|
|
2526
|
-
type: Button$
|
|
2563
|
+
type: Button$1
|
|
2527
2564
|
}, getIconVirtualDom(icon, Span)];
|
|
2528
2565
|
};
|
|
2529
2566
|
|
|
@@ -2595,7 +2632,7 @@ const getFileIconVirtualDom = icon => {
|
|
|
2595
2632
|
return {
|
|
2596
2633
|
childCount: 0,
|
|
2597
2634
|
className: FileIcon,
|
|
2598
|
-
role: None
|
|
2635
|
+
role: None,
|
|
2599
2636
|
src: icon,
|
|
2600
2637
|
type: Img
|
|
2601
2638
|
};
|
|
@@ -2684,7 +2721,7 @@ const getSourceControlListVirtualDom = items => {
|
|
|
2684
2721
|
onClick: HandleClickAt,
|
|
2685
2722
|
onPointerOut: HandleMouseOutAt,
|
|
2686
2723
|
onPointerOver: HandleMouseOverAt,
|
|
2687
|
-
role: Tree
|
|
2724
|
+
role: Tree,
|
|
2688
2725
|
type: Div
|
|
2689
2726
|
}, ...items.flatMap(getSourceControlItemVirtualDom)];
|
|
2690
2727
|
};
|
|
@@ -2829,7 +2866,7 @@ const getActionButtonVirtualDom = action => {
|
|
|
2829
2866
|
className: IconButton,
|
|
2830
2867
|
name: label,
|
|
2831
2868
|
title: id,
|
|
2832
|
-
type: Button$
|
|
2869
|
+
type: Button$1
|
|
2833
2870
|
}, getIconVirtualDom(icon)];
|
|
2834
2871
|
};
|
|
2835
2872
|
|
|
@@ -2890,7 +2927,7 @@ const renderEventListeners = () => {
|
|
|
2890
2927
|
params: ['handleInput', TargetValue]
|
|
2891
2928
|
}, {
|
|
2892
2929
|
name: HandleContextMenu,
|
|
2893
|
-
params: ['handleContextMenu', Button$
|
|
2930
|
+
params: ['handleContextMenu', Button$2, ClientX, ClientY],
|
|
2894
2931
|
preventDefault: true
|
|
2895
2932
|
}, {
|
|
2896
2933
|
name: HandleWheel,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/source-control-worker",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "Source Control Worker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lvce Editor"
|
|
7
7
|
],
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/lvce-editor/source-control-
|
|
10
|
+
"url": "git+https://github.com/lvce-editor/source-control-view.git"
|
|
11
11
|
},
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"author": "Lvce Editor",
|