@lvce-editor/source-control-worker 2.14.0 → 2.15.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 +344 -307
- package/package.json +1 -1
|
@@ -1229,276 +1229,6 @@ const terminate = () => {
|
|
|
1229
1229
|
globalThis.close();
|
|
1230
1230
|
};
|
|
1231
1231
|
|
|
1232
|
-
const {
|
|
1233
|
-
get: get$1,
|
|
1234
|
-
set,
|
|
1235
|
-
wrapCommand,
|
|
1236
|
-
getCommandIds,
|
|
1237
|
-
registerCommands,
|
|
1238
|
-
wrapGetter
|
|
1239
|
-
} = create();
|
|
1240
|
-
|
|
1241
|
-
const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
1242
|
-
const state = {
|
|
1243
|
-
actionsCache: Object.create(null),
|
|
1244
|
-
allGroups: [],
|
|
1245
|
-
deltaY: 0,
|
|
1246
|
-
enabledProviderIds: [],
|
|
1247
|
-
fileIconCache: Object.create(null),
|
|
1248
|
-
finalDeltaY: 0,
|
|
1249
|
-
gitRoot: '',
|
|
1250
|
-
handleOffset: 0,
|
|
1251
|
-
headerHeight: 40,
|
|
1252
|
-
// TODO
|
|
1253
|
-
height,
|
|
1254
|
-
id,
|
|
1255
|
-
index: [],
|
|
1256
|
-
inputValue: '',
|
|
1257
|
-
expandedGroups: Object.create(null),
|
|
1258
|
-
itemHeight: 20,
|
|
1259
|
-
items: [],
|
|
1260
|
-
maxLineY: 0,
|
|
1261
|
-
merge: [],
|
|
1262
|
-
minimumSliderSize: 20,
|
|
1263
|
-
inputBoxHeight: 30,
|
|
1264
|
-
minLineY: 0,
|
|
1265
|
-
providerId: '',
|
|
1266
|
-
root: '',
|
|
1267
|
-
scrollBarActive: false,
|
|
1268
|
-
scrollBarHeight: 0,
|
|
1269
|
-
splitButtonEnabled: false,
|
|
1270
|
-
untracked: [],
|
|
1271
|
-
visibleItems: [],
|
|
1272
|
-
width,
|
|
1273
|
-
workingTree: [],
|
|
1274
|
-
workspacePath,
|
|
1275
|
-
x,
|
|
1276
|
-
y,
|
|
1277
|
-
inputPlaceholder: '',
|
|
1278
|
-
inputSource: 0,
|
|
1279
|
-
maxInputLines: 5,
|
|
1280
|
-
inputFontFamily: 'system-ui, Ubuntu, "Droid Sans", sans-serif',
|
|
1281
|
-
inputFontSize: 13,
|
|
1282
|
-
inputFontWeight: 400,
|
|
1283
|
-
inputLetterSpacing: 0,
|
|
1284
|
-
inputLineHeight: 20,
|
|
1285
|
-
inputBoxMaxHeight: 214,
|
|
1286
|
-
history: [],
|
|
1287
|
-
viewMode: 1,
|
|
1288
|
-
iconDefinitions: [],
|
|
1289
|
-
decorationIcons: [],
|
|
1290
|
-
focus: 0
|
|
1291
|
-
};
|
|
1292
|
-
set(id, state, state);
|
|
1293
|
-
};
|
|
1294
|
-
|
|
1295
|
-
const isEqual$3 = (oldState, newState) => {
|
|
1296
|
-
return oldState.inputBoxHeight === newState.inputBoxHeight;
|
|
1297
|
-
};
|
|
1298
|
-
|
|
1299
|
-
const isEqual$2 = (oldState, newState) => {
|
|
1300
|
-
return oldState.focus === newState.focus;
|
|
1301
|
-
};
|
|
1302
|
-
|
|
1303
|
-
const isEqual$1 = (oldState, newState) => {
|
|
1304
|
-
return oldState.allGroups === newState.allGroups && oldState.deltaY === newState.deltaY && oldState.items === newState.items && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.visibleItems === newState.visibleItems;
|
|
1305
|
-
};
|
|
1306
|
-
|
|
1307
|
-
const RenderItems = 4;
|
|
1308
|
-
const RenderFocus = 6;
|
|
1309
|
-
const RenderFocusContext = 7;
|
|
1310
|
-
const RenderValue = 8;
|
|
1311
|
-
const RenderCss = 10;
|
|
1312
|
-
|
|
1313
|
-
const isEqual = (oldState, newState) => {
|
|
1314
|
-
return newState.inputSource === User || oldState.inputValue === newState.inputValue;
|
|
1315
|
-
};
|
|
1316
|
-
|
|
1317
|
-
const modules = [isEqual$1, isEqual, isEqual$3, isEqual$2];
|
|
1318
|
-
const numbers = [RenderItems, RenderValue, RenderCss, RenderFocus];
|
|
1319
|
-
|
|
1320
|
-
const diff = (oldState, newState) => {
|
|
1321
|
-
const diffResult = [];
|
|
1322
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1323
|
-
const fn = modules[i];
|
|
1324
|
-
if (!fn(oldState, newState)) {
|
|
1325
|
-
diffResult.push(numbers[i]);
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
return diffResult;
|
|
1329
|
-
};
|
|
1330
|
-
|
|
1331
|
-
const diff2 = uid => {
|
|
1332
|
-
const {
|
|
1333
|
-
oldState,
|
|
1334
|
-
newState
|
|
1335
|
-
} = get$1(uid);
|
|
1336
|
-
const result = diff(oldState, newState);
|
|
1337
|
-
return result;
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
|
-
const getInfo = uid => {
|
|
1341
|
-
const {
|
|
1342
|
-
newState
|
|
1343
|
-
} = get$1(uid);
|
|
1344
|
-
return newState.allGroups;
|
|
1345
|
-
};
|
|
1346
|
-
|
|
1347
|
-
const mergeClassNames = (...classNames) => {
|
|
1348
|
-
return classNames.filter(Boolean).join(' ');
|
|
1349
|
-
};
|
|
1350
|
-
|
|
1351
|
-
const text = data => {
|
|
1352
|
-
return {
|
|
1353
|
-
type: Text,
|
|
1354
|
-
text: data,
|
|
1355
|
-
childCount: 0
|
|
1356
|
-
};
|
|
1357
|
-
};
|
|
1358
|
-
|
|
1359
|
-
const getKeyBindings = () => {
|
|
1360
|
-
return [{
|
|
1361
|
-
key: CtrlCmd | Enter,
|
|
1362
|
-
command: 'Source Control.acceptInput',
|
|
1363
|
-
when: FocusSourceControlInput
|
|
1364
|
-
}];
|
|
1365
|
-
};
|
|
1366
|
-
|
|
1367
|
-
const emptyObject = {};
|
|
1368
|
-
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1369
|
-
const i18nString = (key, placeholders = emptyObject) => {
|
|
1370
|
-
if (placeholders === emptyObject) {
|
|
1371
|
-
return key;
|
|
1372
|
-
}
|
|
1373
|
-
const replacer = (match, rest) => {
|
|
1374
|
-
return placeholders[rest];
|
|
1375
|
-
};
|
|
1376
|
-
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1377
|
-
};
|
|
1378
|
-
|
|
1379
|
-
const OpenChanges = 'Open Changes';
|
|
1380
|
-
const OpenFile = 'Open File';
|
|
1381
|
-
const OpenFileHead = 'Open File (HEAD)';
|
|
1382
|
-
const DiscardChanges = 'Discard Changes';
|
|
1383
|
-
const StageChanges = 'Stage Changes';
|
|
1384
|
-
const AddToGitignore = 'Add to gitignore';
|
|
1385
|
-
const RevealInExplorerView = 'Reveal in Explorer View';
|
|
1386
|
-
const OpenContainingFolder = 'Open Containing Folder';
|
|
1387
|
-
const MessageEnterToCommitOnMaster = `Message (Enter) to commit on 'master'`;
|
|
1388
|
-
const SourceControlInput$1 = 'Source Control Input';
|
|
1389
|
-
|
|
1390
|
-
const openChanges = () => {
|
|
1391
|
-
return i18nString(OpenChanges);
|
|
1392
|
-
};
|
|
1393
|
-
const openFile = () => {
|
|
1394
|
-
return i18nString(OpenFile);
|
|
1395
|
-
};
|
|
1396
|
-
const openFileHead = () => {
|
|
1397
|
-
return i18nString(OpenFileHead);
|
|
1398
|
-
};
|
|
1399
|
-
const discardChanges = () => {
|
|
1400
|
-
return i18nString(DiscardChanges);
|
|
1401
|
-
};
|
|
1402
|
-
const stageChanges = () => {
|
|
1403
|
-
return i18nString(StageChanges);
|
|
1404
|
-
};
|
|
1405
|
-
const addToGitignore = () => {
|
|
1406
|
-
return i18nString(AddToGitignore);
|
|
1407
|
-
};
|
|
1408
|
-
const revealInExplorerView = () => {
|
|
1409
|
-
return i18nString(RevealInExplorerView);
|
|
1410
|
-
};
|
|
1411
|
-
const openContainingFolder = () => {
|
|
1412
|
-
return i18nString(OpenContainingFolder);
|
|
1413
|
-
};
|
|
1414
|
-
const messageEnterToCommitOnMaster = () => {
|
|
1415
|
-
return i18nString(MessageEnterToCommitOnMaster);
|
|
1416
|
-
};
|
|
1417
|
-
const sourceControlInput = () => {
|
|
1418
|
-
return i18nString(SourceControlInput$1);
|
|
1419
|
-
};
|
|
1420
|
-
|
|
1421
|
-
const getMenuEntries = () => {
|
|
1422
|
-
return [{
|
|
1423
|
-
label: openChanges(),
|
|
1424
|
-
flags: None,
|
|
1425
|
-
command: /* TODO */'-1',
|
|
1426
|
-
id: ''
|
|
1427
|
-
}, {
|
|
1428
|
-
label: openFile(),
|
|
1429
|
-
flags: None,
|
|
1430
|
-
command: /* TODO */'-1',
|
|
1431
|
-
id: ''
|
|
1432
|
-
}, {
|
|
1433
|
-
label: openFileHead(),
|
|
1434
|
-
flags: None,
|
|
1435
|
-
command: /* TODO */'-1',
|
|
1436
|
-
id: ''
|
|
1437
|
-
}, {
|
|
1438
|
-
label: discardChanges(),
|
|
1439
|
-
flags: None,
|
|
1440
|
-
command: /* TODO */'-1',
|
|
1441
|
-
id: ''
|
|
1442
|
-
}, {
|
|
1443
|
-
label: stageChanges(),
|
|
1444
|
-
flags: None,
|
|
1445
|
-
command: /* TODO */'-1',
|
|
1446
|
-
id: ''
|
|
1447
|
-
}, {
|
|
1448
|
-
label: addToGitignore(),
|
|
1449
|
-
flags: None,
|
|
1450
|
-
command: /* TODO */'-1',
|
|
1451
|
-
id: ''
|
|
1452
|
-
}, {
|
|
1453
|
-
label: revealInExplorerView(),
|
|
1454
|
-
flags: None,
|
|
1455
|
-
command: /* TODO */'-1',
|
|
1456
|
-
id: ''
|
|
1457
|
-
}, {
|
|
1458
|
-
label: openContainingFolder(),
|
|
1459
|
-
flags: None,
|
|
1460
|
-
command: /* TODO */'-1',
|
|
1461
|
-
id: ''
|
|
1462
|
-
}];
|
|
1463
|
-
};
|
|
1464
|
-
|
|
1465
|
-
const getMenuEntries2 = state => {
|
|
1466
|
-
return getMenuEntries();
|
|
1467
|
-
};
|
|
1468
|
-
|
|
1469
|
-
const getMenuIds = () => {
|
|
1470
|
-
return [SourceControl$1];
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
|
-
const activateByEvent = event => {
|
|
1474
|
-
return activateByEvent$1(event);
|
|
1475
|
-
};
|
|
1476
|
-
|
|
1477
|
-
const executeProvider = async ({
|
|
1478
|
-
event,
|
|
1479
|
-
method,
|
|
1480
|
-
params
|
|
1481
|
-
}) => {
|
|
1482
|
-
await activateByEvent(event);
|
|
1483
|
-
// @ts-ignore
|
|
1484
|
-
const result = await invoke$1(method, ...params);
|
|
1485
|
-
return result;
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
const CommandExecute = 'ExtensionHostCommand.executeCommand';
|
|
1489
|
-
const SourceControlGetFileDecorations = 'ExtensionHostSourceControl.getFileDecorations';
|
|
1490
|
-
const SourceControlGetEnabledProviderIds = 'ExtensionHostSourceControl.getEnabledProviderIds';
|
|
1491
|
-
const SourceControlGetFileBefore = 'ExtensionHostSourceControl.getFileBefore';
|
|
1492
|
-
const SourceControlGetGroups = 'ExtensionHostSourceControl.getGroups';
|
|
1493
|
-
|
|
1494
|
-
const executeCommand = (id, ...args) => {
|
|
1495
|
-
return executeProvider({
|
|
1496
|
-
event: `onCommand:${id}`,
|
|
1497
|
-
method: CommandExecute,
|
|
1498
|
-
params: [id, ...args]
|
|
1499
|
-
});
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
1232
|
const getActualDecorationIcon = (iconDefinitions, icon) => {
|
|
1503
1233
|
if (typeof icon === 'number') {
|
|
1504
1234
|
const value = iconDefinitions[icon];
|
|
@@ -1651,6 +1381,36 @@ const getFinalDeltaY = (height, itemHeight, itemsLength) => {
|
|
|
1651
1381
|
return finalDeltaY;
|
|
1652
1382
|
};
|
|
1653
1383
|
|
|
1384
|
+
const activateByEvent = event => {
|
|
1385
|
+
return activateByEvent$1(event);
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
const executeProvider = async ({
|
|
1389
|
+
event,
|
|
1390
|
+
method,
|
|
1391
|
+
params
|
|
1392
|
+
}) => {
|
|
1393
|
+
await activateByEvent(event);
|
|
1394
|
+
// @ts-ignore
|
|
1395
|
+
const result = await invoke$1(method, ...params);
|
|
1396
|
+
return result;
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
const CommandExecute = 'ExtensionHostCommand.executeCommand';
|
|
1400
|
+
const SourceControlAcceptInput = 'ExtensionHostSourceControl.acceptInput';
|
|
1401
|
+
const SourceControlGetFileDecorations = 'ExtensionHostSourceControl.getFileDecorations';
|
|
1402
|
+
const SourceControlGetEnabledProviderIds = 'ExtensionHostSourceControl.getEnabledProviderIds';
|
|
1403
|
+
const SourceControlGetFileBefore = 'ExtensionHostSourceControl.getFileBefore';
|
|
1404
|
+
const SourceControlGetGroups = 'ExtensionHostSourceControl.getGroups';
|
|
1405
|
+
|
|
1406
|
+
const acceptInput$2 = async (providerId, text) => {
|
|
1407
|
+
return executeProvider({
|
|
1408
|
+
event: 'none',
|
|
1409
|
+
method: SourceControlAcceptInput,
|
|
1410
|
+
params: [providerId, text]
|
|
1411
|
+
// noProviderFoundMessage: 'No source control provider found',
|
|
1412
|
+
});
|
|
1413
|
+
};
|
|
1654
1414
|
const getFileDecorations$1 = (providerId, uris) => {
|
|
1655
1415
|
return executeProvider({
|
|
1656
1416
|
event: 'none',
|
|
@@ -1688,6 +1448,11 @@ const getIconDefinitions$1 = async providerId => {
|
|
|
1688
1448
|
return result;
|
|
1689
1449
|
};
|
|
1690
1450
|
|
|
1451
|
+
const acceptInput$1 = (providerId, text) => {
|
|
1452
|
+
string(providerId);
|
|
1453
|
+
string(text);
|
|
1454
|
+
return acceptInput$2(providerId, text);
|
|
1455
|
+
};
|
|
1691
1456
|
const getFileDecorations = (providerId, uris) => {
|
|
1692
1457
|
return getFileDecorations$1(providerId, uris);
|
|
1693
1458
|
};
|
|
@@ -1808,7 +1573,7 @@ const getVisibleSourceControlItems = (items, minLineY, maxLineY, actionsCache, f
|
|
|
1808
1573
|
return visible;
|
|
1809
1574
|
};
|
|
1810
1575
|
|
|
1811
|
-
const get = key => {
|
|
1576
|
+
const get$1 = key => {
|
|
1812
1577
|
return getPreference(key);
|
|
1813
1578
|
};
|
|
1814
1579
|
|
|
@@ -1828,35 +1593,89 @@ const requestSourceActions = async () => {
|
|
|
1828
1593
|
}
|
|
1829
1594
|
return newCache;
|
|
1830
1595
|
};
|
|
1831
|
-
|
|
1832
|
-
/* eslint-disable unicorn/no-array-reduce */
|
|
1833
|
-
const restoreExpandedGroups = groups => {
|
|
1834
|
-
return groups.map(group => group.id).reduce((total, current) => {
|
|
1835
|
-
return {
|
|
1836
|
-
...total,
|
|
1837
|
-
[current]: true
|
|
1838
|
-
};
|
|
1839
|
-
}, Object.create(null));
|
|
1596
|
+
|
|
1597
|
+
/* eslint-disable unicorn/no-array-reduce */
|
|
1598
|
+
const restoreExpandedGroups = groups => {
|
|
1599
|
+
return groups.map(group => group.id).reduce((total, current) => {
|
|
1600
|
+
return {
|
|
1601
|
+
...total,
|
|
1602
|
+
[current]: true
|
|
1603
|
+
};
|
|
1604
|
+
}, Object.create(null));
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
const getRestoredInputValue = savedState => {
|
|
1608
|
+
if (savedState && typeof savedState === 'object' && 'inputValue' in savedState && typeof savedState['inputValue'] === 'string') {
|
|
1609
|
+
return savedState.inputValue;
|
|
1610
|
+
}
|
|
1611
|
+
return '';
|
|
1612
|
+
};
|
|
1613
|
+
const restoreState = savedState => {
|
|
1614
|
+
const inputValue = getRestoredInputValue(savedState);
|
|
1615
|
+
return {
|
|
1616
|
+
inputValue
|
|
1617
|
+
};
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
|
|
1621
|
+
if (size >= contentSize) {
|
|
1622
|
+
return 0;
|
|
1623
|
+
}
|
|
1624
|
+
return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
|
|
1625
|
+
};
|
|
1626
|
+
|
|
1627
|
+
const emptyObject = {};
|
|
1628
|
+
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1629
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1630
|
+
if (placeholders === emptyObject) {
|
|
1631
|
+
return key;
|
|
1632
|
+
}
|
|
1633
|
+
const replacer = (match, rest) => {
|
|
1634
|
+
return placeholders[rest];
|
|
1635
|
+
};
|
|
1636
|
+
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1637
|
+
};
|
|
1638
|
+
|
|
1639
|
+
const OpenChanges = 'Open Changes';
|
|
1640
|
+
const OpenFile = 'Open File';
|
|
1641
|
+
const OpenFileHead = 'Open File (HEAD)';
|
|
1642
|
+
const DiscardChanges = 'Discard Changes';
|
|
1643
|
+
const StageChanges = 'Stage Changes';
|
|
1644
|
+
const AddToGitignore = 'Add to gitignore';
|
|
1645
|
+
const RevealInExplorerView = 'Reveal in Explorer View';
|
|
1646
|
+
const OpenContainingFolder = 'Open Containing Folder';
|
|
1647
|
+
const MessageEnterToCommitOnMaster = `Message (Enter) to commit on 'master'`;
|
|
1648
|
+
const SourceControlInput$1 = 'Source Control Input';
|
|
1649
|
+
|
|
1650
|
+
const openChanges = () => {
|
|
1651
|
+
return i18nString(OpenChanges);
|
|
1652
|
+
};
|
|
1653
|
+
const openFile = () => {
|
|
1654
|
+
return i18nString(OpenFile);
|
|
1655
|
+
};
|
|
1656
|
+
const openFileHead = () => {
|
|
1657
|
+
return i18nString(OpenFileHead);
|
|
1658
|
+
};
|
|
1659
|
+
const discardChanges = () => {
|
|
1660
|
+
return i18nString(DiscardChanges);
|
|
1840
1661
|
};
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
if (savedState && typeof savedState === 'object' && 'inputValue' in savedState && typeof savedState['inputValue'] === 'string') {
|
|
1844
|
-
return savedState.inputValue;
|
|
1845
|
-
}
|
|
1846
|
-
return '';
|
|
1662
|
+
const stageChanges = () => {
|
|
1663
|
+
return i18nString(StageChanges);
|
|
1847
1664
|
};
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1850
|
-
return {
|
|
1851
|
-
inputValue
|
|
1852
|
-
};
|
|
1665
|
+
const addToGitignore = () => {
|
|
1666
|
+
return i18nString(AddToGitignore);
|
|
1853
1667
|
};
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1668
|
+
const revealInExplorerView = () => {
|
|
1669
|
+
return i18nString(RevealInExplorerView);
|
|
1670
|
+
};
|
|
1671
|
+
const openContainingFolder = () => {
|
|
1672
|
+
return i18nString(OpenContainingFolder);
|
|
1673
|
+
};
|
|
1674
|
+
const messageEnterToCommitOnMaster = () => {
|
|
1675
|
+
return i18nString(MessageEnterToCommitOnMaster);
|
|
1676
|
+
};
|
|
1677
|
+
const sourceControlInput = () => {
|
|
1678
|
+
return i18nString(SourceControlInput$1);
|
|
1860
1679
|
};
|
|
1861
1680
|
|
|
1862
1681
|
const loadContent = async (state, savedState) => {
|
|
@@ -1889,7 +1708,7 @@ const loadContent = async (state, savedState) => {
|
|
|
1889
1708
|
const actionsCache = await requestSourceActions();
|
|
1890
1709
|
|
|
1891
1710
|
// TODO make preferences async and more functional
|
|
1892
|
-
const splitButtonEnabled = await get('sourceControl.splitButtonEnabled');
|
|
1711
|
+
const splitButtonEnabled = await get$1('sourceControl.splitButtonEnabled');
|
|
1893
1712
|
const total = displayItems.length;
|
|
1894
1713
|
const contentHeight = total * itemHeight;
|
|
1895
1714
|
const listHeight = getListHeight(total, itemHeight, height);
|
|
@@ -1924,6 +1743,228 @@ const loadContent = async (state, savedState) => {
|
|
|
1924
1743
|
};
|
|
1925
1744
|
};
|
|
1926
1745
|
|
|
1746
|
+
const info = (...args) => {
|
|
1747
|
+
// @ts-ignore
|
|
1748
|
+
// eslint-disable-next-line no-console
|
|
1749
|
+
console.info(...args);
|
|
1750
|
+
};
|
|
1751
|
+
const warn = (...args) => {
|
|
1752
|
+
// @ts-ignore
|
|
1753
|
+
console.warn(...args);
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
const acceptInput = async state => {
|
|
1757
|
+
const {
|
|
1758
|
+
inputValue,
|
|
1759
|
+
enabledProviderIds
|
|
1760
|
+
} = state;
|
|
1761
|
+
if (enabledProviderIds.length === 0) {
|
|
1762
|
+
info('[ViewletSourceControl] no source control provider found');
|
|
1763
|
+
return state;
|
|
1764
|
+
}
|
|
1765
|
+
const providerId = enabledProviderIds[0];
|
|
1766
|
+
await acceptInput$1(providerId, inputValue);
|
|
1767
|
+
const newState = await loadContent(state, {});
|
|
1768
|
+
return {
|
|
1769
|
+
...newState,
|
|
1770
|
+
inputValue: ''
|
|
1771
|
+
};
|
|
1772
|
+
};
|
|
1773
|
+
|
|
1774
|
+
const {
|
|
1775
|
+
get,
|
|
1776
|
+
set,
|
|
1777
|
+
wrapCommand,
|
|
1778
|
+
getCommandIds,
|
|
1779
|
+
registerCommands,
|
|
1780
|
+
wrapGetter
|
|
1781
|
+
} = create();
|
|
1782
|
+
|
|
1783
|
+
const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
1784
|
+
const state = {
|
|
1785
|
+
actionsCache: Object.create(null),
|
|
1786
|
+
allGroups: [],
|
|
1787
|
+
deltaY: 0,
|
|
1788
|
+
enabledProviderIds: [],
|
|
1789
|
+
fileIconCache: Object.create(null),
|
|
1790
|
+
finalDeltaY: 0,
|
|
1791
|
+
gitRoot: '',
|
|
1792
|
+
handleOffset: 0,
|
|
1793
|
+
headerHeight: 40,
|
|
1794
|
+
// TODO
|
|
1795
|
+
height,
|
|
1796
|
+
id,
|
|
1797
|
+
index: [],
|
|
1798
|
+
inputValue: '',
|
|
1799
|
+
expandedGroups: Object.create(null),
|
|
1800
|
+
itemHeight: 20,
|
|
1801
|
+
items: [],
|
|
1802
|
+
maxLineY: 0,
|
|
1803
|
+
merge: [],
|
|
1804
|
+
minimumSliderSize: 20,
|
|
1805
|
+
inputBoxHeight: 30,
|
|
1806
|
+
minLineY: 0,
|
|
1807
|
+
providerId: '',
|
|
1808
|
+
root: '',
|
|
1809
|
+
scrollBarActive: false,
|
|
1810
|
+
scrollBarHeight: 0,
|
|
1811
|
+
splitButtonEnabled: false,
|
|
1812
|
+
untracked: [],
|
|
1813
|
+
visibleItems: [],
|
|
1814
|
+
width,
|
|
1815
|
+
workingTree: [],
|
|
1816
|
+
workspacePath,
|
|
1817
|
+
x,
|
|
1818
|
+
y,
|
|
1819
|
+
inputPlaceholder: '',
|
|
1820
|
+
inputSource: 0,
|
|
1821
|
+
maxInputLines: 5,
|
|
1822
|
+
inputFontFamily: 'system-ui, Ubuntu, "Droid Sans", sans-serif',
|
|
1823
|
+
inputFontSize: 13,
|
|
1824
|
+
inputFontWeight: 400,
|
|
1825
|
+
inputLetterSpacing: 0,
|
|
1826
|
+
inputLineHeight: 20,
|
|
1827
|
+
inputBoxMaxHeight: 214,
|
|
1828
|
+
history: [],
|
|
1829
|
+
viewMode: 1,
|
|
1830
|
+
iconDefinitions: [],
|
|
1831
|
+
decorationIcons: [],
|
|
1832
|
+
focus: 0
|
|
1833
|
+
};
|
|
1834
|
+
set(id, state, state);
|
|
1835
|
+
};
|
|
1836
|
+
|
|
1837
|
+
const isEqual$3 = (oldState, newState) => {
|
|
1838
|
+
return oldState.inputBoxHeight === newState.inputBoxHeight;
|
|
1839
|
+
};
|
|
1840
|
+
|
|
1841
|
+
const isEqual$2 = (oldState, newState) => {
|
|
1842
|
+
return oldState.focus === newState.focus;
|
|
1843
|
+
};
|
|
1844
|
+
|
|
1845
|
+
const isEqual$1 = (oldState, newState) => {
|
|
1846
|
+
return oldState.allGroups === newState.allGroups && oldState.deltaY === newState.deltaY && oldState.items === newState.items && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.visibleItems === newState.visibleItems;
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
const RenderItems = 4;
|
|
1850
|
+
const RenderFocusContext = 7;
|
|
1851
|
+
const RenderValue = 8;
|
|
1852
|
+
const RenderCss = 10;
|
|
1853
|
+
|
|
1854
|
+
const isEqual = (oldState, newState) => {
|
|
1855
|
+
return newState.inputSource === User || oldState.inputValue === newState.inputValue;
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1858
|
+
const modules = [isEqual$1, isEqual, isEqual$3, isEqual$2];
|
|
1859
|
+
const numbers = [RenderItems, RenderValue, RenderCss, RenderFocusContext];
|
|
1860
|
+
|
|
1861
|
+
const diff = (oldState, newState) => {
|
|
1862
|
+
const diffResult = [];
|
|
1863
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1864
|
+
const fn = modules[i];
|
|
1865
|
+
if (!fn(oldState, newState)) {
|
|
1866
|
+
diffResult.push(numbers[i]);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
return diffResult;
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1872
|
+
const diff2 = uid => {
|
|
1873
|
+
const {
|
|
1874
|
+
oldState,
|
|
1875
|
+
newState
|
|
1876
|
+
} = get(uid);
|
|
1877
|
+
const result = diff(oldState, newState);
|
|
1878
|
+
return result;
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1881
|
+
const getInfo = uid => {
|
|
1882
|
+
const {
|
|
1883
|
+
newState
|
|
1884
|
+
} = get(uid);
|
|
1885
|
+
return newState.allGroups;
|
|
1886
|
+
};
|
|
1887
|
+
|
|
1888
|
+
const mergeClassNames = (...classNames) => {
|
|
1889
|
+
return classNames.filter(Boolean).join(' ');
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1892
|
+
const text = data => {
|
|
1893
|
+
return {
|
|
1894
|
+
type: Text,
|
|
1895
|
+
text: data,
|
|
1896
|
+
childCount: 0
|
|
1897
|
+
};
|
|
1898
|
+
};
|
|
1899
|
+
|
|
1900
|
+
const getKeyBindings = () => {
|
|
1901
|
+
return [{
|
|
1902
|
+
key: CtrlCmd | Enter,
|
|
1903
|
+
command: 'Source Control.acceptInput',
|
|
1904
|
+
when: FocusSourceControlInput
|
|
1905
|
+
}];
|
|
1906
|
+
};
|
|
1907
|
+
|
|
1908
|
+
const getMenuEntries = () => {
|
|
1909
|
+
return [{
|
|
1910
|
+
label: openChanges(),
|
|
1911
|
+
flags: None,
|
|
1912
|
+
command: /* TODO */'-1',
|
|
1913
|
+
id: ''
|
|
1914
|
+
}, {
|
|
1915
|
+
label: openFile(),
|
|
1916
|
+
flags: None,
|
|
1917
|
+
command: /* TODO */'-1',
|
|
1918
|
+
id: ''
|
|
1919
|
+
}, {
|
|
1920
|
+
label: openFileHead(),
|
|
1921
|
+
flags: None,
|
|
1922
|
+
command: /* TODO */'-1',
|
|
1923
|
+
id: ''
|
|
1924
|
+
}, {
|
|
1925
|
+
label: discardChanges(),
|
|
1926
|
+
flags: None,
|
|
1927
|
+
command: /* TODO */'-1',
|
|
1928
|
+
id: ''
|
|
1929
|
+
}, {
|
|
1930
|
+
label: stageChanges(),
|
|
1931
|
+
flags: None,
|
|
1932
|
+
command: /* TODO */'-1',
|
|
1933
|
+
id: ''
|
|
1934
|
+
}, {
|
|
1935
|
+
label: addToGitignore(),
|
|
1936
|
+
flags: None,
|
|
1937
|
+
command: /* TODO */'-1',
|
|
1938
|
+
id: ''
|
|
1939
|
+
}, {
|
|
1940
|
+
label: revealInExplorerView(),
|
|
1941
|
+
flags: None,
|
|
1942
|
+
command: /* TODO */'-1',
|
|
1943
|
+
id: ''
|
|
1944
|
+
}, {
|
|
1945
|
+
label: openContainingFolder(),
|
|
1946
|
+
flags: None,
|
|
1947
|
+
command: /* TODO */'-1',
|
|
1948
|
+
id: ''
|
|
1949
|
+
}];
|
|
1950
|
+
};
|
|
1951
|
+
|
|
1952
|
+
const getMenuEntries2 = state => {
|
|
1953
|
+
return getMenuEntries();
|
|
1954
|
+
};
|
|
1955
|
+
|
|
1956
|
+
const getMenuIds = () => {
|
|
1957
|
+
return [SourceControl$1];
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1960
|
+
const executeCommand = (id, ...args) => {
|
|
1961
|
+
return executeProvider({
|
|
1962
|
+
event: `onCommand:${id}`,
|
|
1963
|
+
method: CommandExecute,
|
|
1964
|
+
params: [id, ...args]
|
|
1965
|
+
});
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1927
1968
|
const handleButtonClick = async (state, clickedIndex) => {
|
|
1928
1969
|
const {
|
|
1929
1970
|
visibleItems
|
|
@@ -1949,11 +1990,6 @@ const getIndex = (state, eventX, eventY) => {
|
|
|
1949
1990
|
return index;
|
|
1950
1991
|
};
|
|
1951
1992
|
|
|
1952
|
-
const warn = (...args) => {
|
|
1953
|
-
// @ts-ignore
|
|
1954
|
-
console.warn(...args);
|
|
1955
|
-
};
|
|
1956
|
-
|
|
1957
1993
|
const refresh = async state => {
|
|
1958
1994
|
const {
|
|
1959
1995
|
itemHeight,
|
|
@@ -2656,7 +2692,7 @@ const render2 = (uid, diffResult) => {
|
|
|
2656
2692
|
const {
|
|
2657
2693
|
oldState,
|
|
2658
2694
|
newState
|
|
2659
|
-
} = get
|
|
2695
|
+
} = get(uid);
|
|
2660
2696
|
set(uid, newState, newState);
|
|
2661
2697
|
const commands = applyRender(oldState, newState, diffResult);
|
|
2662
2698
|
return commands;
|
|
@@ -2740,7 +2776,7 @@ const renderEventListeners = () => {
|
|
|
2740
2776
|
|
|
2741
2777
|
const saveState = uid => {
|
|
2742
2778
|
number(uid);
|
|
2743
|
-
const value = get
|
|
2779
|
+
const value = get(uid);
|
|
2744
2780
|
const {
|
|
2745
2781
|
newState
|
|
2746
2782
|
} = value;
|
|
@@ -2791,6 +2827,7 @@ const viewAsTree = state => {
|
|
|
2791
2827
|
|
|
2792
2828
|
const commandMap = {
|
|
2793
2829
|
'Initialize.initialize': initialize,
|
|
2830
|
+
'SourceControl.acceptInput': wrapCommand(acceptInput),
|
|
2794
2831
|
'SourceControl.create2': create2,
|
|
2795
2832
|
'SourceControl.diff2': diff2,
|
|
2796
2833
|
'SourceControl.getCommandIds': getCommandIds,
|
|
@@ -2806,6 +2843,7 @@ const commandMap = {
|
|
|
2806
2843
|
'SourceControl.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2807
2844
|
'SourceControl.handleFocus': wrapCommand(handleInputFocus),
|
|
2808
2845
|
'SourceControl.handleInput': wrapCommand(handleInput),
|
|
2846
|
+
'SourceControl.handleInputBlur': wrapCommand(handleInputBlur),
|
|
2809
2847
|
'SourceControl.handleMessagePort': handleMessagePort,
|
|
2810
2848
|
'SourceControl.handleMouseOut': wrapCommand(handleMouseOut),
|
|
2811
2849
|
'SourceControl.handleMouseOutAt': wrapCommand(handleMouseOutAt),
|
|
@@ -2825,8 +2863,7 @@ const commandMap = {
|
|
|
2825
2863
|
'SourceControl.terminate': terminate,
|
|
2826
2864
|
'SourceControl.updateIcons': wrapCommand(updateIcons),
|
|
2827
2865
|
'SourceControl.viewAsList': wrapCommand(viewAsList),
|
|
2828
|
-
'SourceControl.viewAsTree': wrapCommand(viewAsTree)
|
|
2829
|
-
'SourceControl.handleInputBlur': wrapCommand(handleInputBlur)
|
|
2866
|
+
'SourceControl.viewAsTree': wrapCommand(viewAsTree)
|
|
2830
2867
|
};
|
|
2831
2868
|
|
|
2832
2869
|
const listen = async () => {
|