@lvce-editor/source-control-worker 1.17.0 → 1.18.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 +254 -253
- package/package.json +1 -1
|
@@ -513,7 +513,7 @@ const IpcParentWithMessagePort$1 = {
|
|
|
513
513
|
};
|
|
514
514
|
|
|
515
515
|
const Two = '2.0';
|
|
516
|
-
const create$4
|
|
516
|
+
const create$4 = (method, params) => {
|
|
517
517
|
return {
|
|
518
518
|
jsonrpc: Two,
|
|
519
519
|
method,
|
|
@@ -521,7 +521,7 @@ const create$4$1 = (method, params) => {
|
|
|
521
521
|
};
|
|
522
522
|
};
|
|
523
523
|
const callbacks = Object.create(null);
|
|
524
|
-
const set$
|
|
524
|
+
const set$5 = (id, fn) => {
|
|
525
525
|
callbacks[id] = fn;
|
|
526
526
|
};
|
|
527
527
|
const get$3 = id => {
|
|
@@ -531,16 +531,16 @@ const remove = id => {
|
|
|
531
531
|
delete callbacks[id];
|
|
532
532
|
};
|
|
533
533
|
let id = 0;
|
|
534
|
-
const create$3 = () => {
|
|
534
|
+
const create$3$1 = () => {
|
|
535
535
|
return ++id;
|
|
536
536
|
};
|
|
537
537
|
const registerPromise = () => {
|
|
538
|
-
const id = create$3();
|
|
538
|
+
const id = create$3$1();
|
|
539
539
|
const {
|
|
540
540
|
resolve,
|
|
541
541
|
promise
|
|
542
542
|
} = Promise.withResolvers();
|
|
543
|
-
set$
|
|
543
|
+
set$5(id, resolve);
|
|
544
544
|
return {
|
|
545
545
|
id,
|
|
546
546
|
promise
|
|
@@ -882,13 +882,13 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
882
882
|
return unwrapJsonRpcResult(responseMessage);
|
|
883
883
|
};
|
|
884
884
|
const send = (transport, method, ...params) => {
|
|
885
|
-
const message = create$4
|
|
885
|
+
const message = create$4(method, params);
|
|
886
886
|
transport.send(message);
|
|
887
887
|
};
|
|
888
888
|
const invoke$4 = (ipc, method, ...params) => {
|
|
889
889
|
return invokeHelper(ipc, method, params, false);
|
|
890
890
|
};
|
|
891
|
-
const invokeAndTransfer$
|
|
891
|
+
const invokeAndTransfer$2 = (ipc, method, ...params) => {
|
|
892
892
|
return invokeHelper(ipc, method, params, true);
|
|
893
893
|
};
|
|
894
894
|
|
|
@@ -927,7 +927,7 @@ const createRpc = ipc => {
|
|
|
927
927
|
return invoke$4(ipc, method, ...params);
|
|
928
928
|
},
|
|
929
929
|
invokeAndTransfer(method, ...params) {
|
|
930
|
-
return invokeAndTransfer$
|
|
930
|
+
return invokeAndTransfer$2(ipc, method, ...params);
|
|
931
931
|
},
|
|
932
932
|
async dispose() {
|
|
933
933
|
await ipc?.dispose();
|
|
@@ -981,18 +981,23 @@ const create$5 = async ({
|
|
|
981
981
|
messagePort.start();
|
|
982
982
|
return rpc;
|
|
983
983
|
};
|
|
984
|
-
const create$
|
|
984
|
+
const create$3 = async ({
|
|
985
985
|
commandMap,
|
|
986
|
-
|
|
986
|
+
send
|
|
987
987
|
}) => {
|
|
988
|
+
const {
|
|
989
|
+
port1,
|
|
990
|
+
port2
|
|
991
|
+
} = new MessageChannel();
|
|
992
|
+
await send(port1);
|
|
988
993
|
return create$5({
|
|
989
994
|
commandMap,
|
|
990
|
-
messagePort
|
|
995
|
+
messagePort: port2
|
|
991
996
|
});
|
|
992
997
|
};
|
|
993
|
-
const
|
|
998
|
+
const TransferMessagePortRpcParent = {
|
|
994
999
|
__proto__: null,
|
|
995
|
-
create: create$
|
|
1000
|
+
create: create$3
|
|
996
1001
|
};
|
|
997
1002
|
const create$2 = async ({
|
|
998
1003
|
commandMap
|
|
@@ -1028,207 +1033,52 @@ const createMockRpc = ({
|
|
|
1028
1033
|
return mockRpc;
|
|
1029
1034
|
};
|
|
1030
1035
|
|
|
1031
|
-
const toCommandId = key => {
|
|
1032
|
-
const dotIndex = key.indexOf('.');
|
|
1033
|
-
return key.slice(dotIndex + 1);
|
|
1034
|
-
};
|
|
1035
|
-
const create$1 = () => {
|
|
1036
|
-
const states = Object.create(null);
|
|
1037
|
-
const commandMapRef = {};
|
|
1038
|
-
return {
|
|
1039
|
-
get(uid) {
|
|
1040
|
-
return states[uid];
|
|
1041
|
-
},
|
|
1042
|
-
set(uid, oldState, newState) {
|
|
1043
|
-
states[uid] = {
|
|
1044
|
-
oldState,
|
|
1045
|
-
newState
|
|
1046
|
-
};
|
|
1047
|
-
},
|
|
1048
|
-
dispose(uid) {
|
|
1049
|
-
delete states[uid];
|
|
1050
|
-
},
|
|
1051
|
-
getKeys() {
|
|
1052
|
-
return Object.keys(states).map(key => {
|
|
1053
|
-
return Number.parseInt(key);
|
|
1054
|
-
});
|
|
1055
|
-
},
|
|
1056
|
-
clear() {
|
|
1057
|
-
for (const key of Object.keys(states)) {
|
|
1058
|
-
delete states[key];
|
|
1059
|
-
}
|
|
1060
|
-
},
|
|
1061
|
-
wrapCommand(fn) {
|
|
1062
|
-
const wrapped = async (uid, ...args) => {
|
|
1063
|
-
const {
|
|
1064
|
-
newState
|
|
1065
|
-
} = states[uid];
|
|
1066
|
-
const newerState = await fn(newState, ...args);
|
|
1067
|
-
if (newState === newerState) {
|
|
1068
|
-
return;
|
|
1069
|
-
}
|
|
1070
|
-
const latest = states[uid];
|
|
1071
|
-
states[uid] = {
|
|
1072
|
-
oldState: latest.oldState,
|
|
1073
|
-
newState: newerState
|
|
1074
|
-
};
|
|
1075
|
-
};
|
|
1076
|
-
return wrapped;
|
|
1077
|
-
},
|
|
1078
|
-
wrapGetter(fn) {
|
|
1079
|
-
const wrapped = (uid, ...args) => {
|
|
1080
|
-
const {
|
|
1081
|
-
newState
|
|
1082
|
-
} = states[uid];
|
|
1083
|
-
return fn(newState, ...args);
|
|
1084
|
-
};
|
|
1085
|
-
return wrapped;
|
|
1086
|
-
},
|
|
1087
|
-
diff(uid, modules, numbers) {
|
|
1088
|
-
const {
|
|
1089
|
-
oldState,
|
|
1090
|
-
newState
|
|
1091
|
-
} = states[uid];
|
|
1092
|
-
const diffResult = [];
|
|
1093
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1094
|
-
const fn = modules[i];
|
|
1095
|
-
if (!fn(oldState, newState)) {
|
|
1096
|
-
diffResult.push(numbers[i]);
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
return diffResult;
|
|
1100
|
-
},
|
|
1101
|
-
getCommandIds() {
|
|
1102
|
-
const keys = Object.keys(commandMapRef);
|
|
1103
|
-
const ids = keys.map(toCommandId);
|
|
1104
|
-
return ids;
|
|
1105
|
-
},
|
|
1106
|
-
registerCommands(commandMap) {
|
|
1107
|
-
Object.assign(commandMapRef, commandMap);
|
|
1108
|
-
}
|
|
1109
|
-
};
|
|
1110
|
-
};
|
|
1111
|
-
|
|
1112
|
-
const {
|
|
1113
|
-
get: get$2,
|
|
1114
|
-
set: set$5,
|
|
1115
|
-
wrapCommand,
|
|
1116
|
-
getCommandIds,
|
|
1117
|
-
registerCommands
|
|
1118
|
-
} = create$1();
|
|
1119
|
-
|
|
1120
|
-
const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
1121
|
-
const state = {
|
|
1122
|
-
actionsCache: Object.create(null),
|
|
1123
|
-
allGroups: [],
|
|
1124
|
-
deltaY: 0,
|
|
1125
|
-
enabledProviderIds: [],
|
|
1126
|
-
fileIconCache: Object.create(null),
|
|
1127
|
-
finalDeltaY: 0,
|
|
1128
|
-
gitRoot: '',
|
|
1129
|
-
handleOffset: 0,
|
|
1130
|
-
headerHeight: 40,
|
|
1131
|
-
// TODO
|
|
1132
|
-
height,
|
|
1133
|
-
id,
|
|
1134
|
-
index: [],
|
|
1135
|
-
inputValue: '',
|
|
1136
|
-
expandedGroups: Object.create(null),
|
|
1137
|
-
itemHeight: 20,
|
|
1138
|
-
items: [],
|
|
1139
|
-
maxLineY: 0,
|
|
1140
|
-
merge: [],
|
|
1141
|
-
minimumSliderSize: 20,
|
|
1142
|
-
minLineY: 0,
|
|
1143
|
-
providerId: '',
|
|
1144
|
-
root: '',
|
|
1145
|
-
scrollBarActive: false,
|
|
1146
|
-
scrollBarHeight: 0,
|
|
1147
|
-
splitButtonEnabled: false,
|
|
1148
|
-
untracked: [],
|
|
1149
|
-
visibleItems: [],
|
|
1150
|
-
width,
|
|
1151
|
-
workingTree: [],
|
|
1152
|
-
workspacePath,
|
|
1153
|
-
x,
|
|
1154
|
-
y
|
|
1155
|
-
};
|
|
1156
|
-
set$5(id, state, state);
|
|
1157
|
-
};
|
|
1158
|
-
|
|
1159
|
-
const RenderItems = 4;
|
|
1160
|
-
|
|
1161
|
-
const diffType = RenderItems;
|
|
1162
|
-
const isEqual = (oldState, newState) => {
|
|
1163
|
-
return oldState.allGroups === newState.allGroups && oldState.visibleItems === newState.visibleItems && oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.deltaY === newState.deltaY;
|
|
1164
|
-
};
|
|
1165
|
-
|
|
1166
|
-
const modules = [isEqual];
|
|
1167
|
-
const numbers = [diffType];
|
|
1168
|
-
|
|
1169
|
-
const diff = (oldState, newState) => {
|
|
1170
|
-
const diffResult = [];
|
|
1171
|
-
for (let i = 0; i < modules.length; i++) {
|
|
1172
|
-
const fn = modules[i];
|
|
1173
|
-
if (!fn(oldState, newState)) {
|
|
1174
|
-
diffResult.push(numbers[i]);
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
return diffResult;
|
|
1178
|
-
};
|
|
1179
|
-
|
|
1180
|
-
const diff2 = uid => {
|
|
1181
|
-
const {
|
|
1182
|
-
oldState,
|
|
1183
|
-
newState
|
|
1184
|
-
} = get$2(uid);
|
|
1185
|
-
const result = diff(oldState, newState);
|
|
1186
|
-
return result;
|
|
1187
|
-
};
|
|
1188
|
-
|
|
1189
|
-
const getInfo = uid => {
|
|
1190
|
-
const {
|
|
1191
|
-
newState
|
|
1192
|
-
} = get$2(uid);
|
|
1193
|
-
return newState.allGroups;
|
|
1194
|
-
};
|
|
1195
|
-
|
|
1196
1036
|
const None = 'none';
|
|
1197
1037
|
const ToolBar = 'toolbar';
|
|
1198
1038
|
const Tree = 'tree';
|
|
1199
1039
|
const TreeItem$1 = 'treeitem';
|
|
1200
1040
|
|
|
1201
|
-
const Button$
|
|
1041
|
+
const Button$2 = 1;
|
|
1202
1042
|
const Div = 4;
|
|
1203
1043
|
const Input = 6;
|
|
1204
1044
|
const Span = 8;
|
|
1205
1045
|
const Text = 12;
|
|
1206
1046
|
const Img = 17;
|
|
1207
1047
|
|
|
1048
|
+
const TargetValue = 'event.target.value';
|
|
1049
|
+
const ClientX = 'event.clientX';
|
|
1050
|
+
const ClientY = 'event.clientY';
|
|
1051
|
+
const Button$1 = 'event.button';
|
|
1052
|
+
const DeltaMode = 'event.deltaMode';
|
|
1053
|
+
const DeltaY = 'event.deltaY';
|
|
1054
|
+
const TargetName = 'event.target.name';
|
|
1055
|
+
|
|
1208
1056
|
const DebugWorker = 55;
|
|
1209
1057
|
const ExtensionHostWorker = 44;
|
|
1210
1058
|
const RendererWorker$1 = 1;
|
|
1211
1059
|
const SourceControlWorker = 66;
|
|
1212
1060
|
|
|
1061
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
1062
|
+
|
|
1213
1063
|
const rpcs = Object.create(null);
|
|
1214
1064
|
const set$4 = (id, rpc) => {
|
|
1215
1065
|
rpcs[id] = rpc;
|
|
1216
1066
|
};
|
|
1217
|
-
const get$
|
|
1067
|
+
const get$2 = id => {
|
|
1218
1068
|
return rpcs[id];
|
|
1219
1069
|
};
|
|
1220
1070
|
|
|
1221
|
-
const create = rpcId => {
|
|
1071
|
+
const create$1 = rpcId => {
|
|
1222
1072
|
return {
|
|
1223
1073
|
// @ts-ignore
|
|
1224
1074
|
invoke(method, ...params) {
|
|
1225
|
-
const rpc = get$
|
|
1075
|
+
const rpc = get$2(rpcId);
|
|
1226
1076
|
// @ts-ignore
|
|
1227
1077
|
return rpc.invoke(method, ...params);
|
|
1228
1078
|
},
|
|
1229
1079
|
// @ts-ignore
|
|
1230
1080
|
invokeAndTransfer(method, ...params) {
|
|
1231
|
-
const rpc = get$
|
|
1081
|
+
const rpc = get$2(rpcId);
|
|
1232
1082
|
// @ts-ignore
|
|
1233
1083
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1234
1084
|
},
|
|
@@ -1236,7 +1086,7 @@ const create = rpcId => {
|
|
|
1236
1086
|
set$4(rpcId, rpc);
|
|
1237
1087
|
},
|
|
1238
1088
|
async dispose() {
|
|
1239
|
-
const rpc = get$
|
|
1089
|
+
const rpc = get$2(rpcId);
|
|
1240
1090
|
await rpc.dispose();
|
|
1241
1091
|
}
|
|
1242
1092
|
};
|
|
@@ -1244,10 +1094,10 @@ const create = rpcId => {
|
|
|
1244
1094
|
|
|
1245
1095
|
const {
|
|
1246
1096
|
invoke: invoke$3,
|
|
1247
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1097
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1248
1098
|
set: set$3,
|
|
1249
1099
|
dispose: dispose$1
|
|
1250
|
-
} = create(ExtensionHostWorker);
|
|
1100
|
+
} = create$1(ExtensionHostWorker);
|
|
1251
1101
|
const executeReferenceProvider = async (id, offset) => {
|
|
1252
1102
|
// @ts-ignore
|
|
1253
1103
|
return invoke$3('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
@@ -1275,17 +1125,17 @@ const ExtensionHost = {
|
|
|
1275
1125
|
executeReferenceProvider,
|
|
1276
1126
|
getRuntimeStatus,
|
|
1277
1127
|
invoke: invoke$3,
|
|
1278
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1128
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1279
1129
|
registerMockRpc: registerMockRpc$1,
|
|
1280
1130
|
set: set$3
|
|
1281
1131
|
};
|
|
1282
1132
|
|
|
1283
1133
|
const {
|
|
1284
1134
|
invoke: invoke$2,
|
|
1285
|
-
invokeAndTransfer
|
|
1135
|
+
invokeAndTransfer,
|
|
1286
1136
|
set: set$2,
|
|
1287
1137
|
dispose
|
|
1288
|
-
} = create(RendererWorker$1);
|
|
1138
|
+
} = create$1(RendererWorker$1);
|
|
1289
1139
|
const searchFileHtml = async uri => {
|
|
1290
1140
|
return invoke$2('ExtensionHost.searchFileWithHtml', uri);
|
|
1291
1141
|
};
|
|
@@ -1322,7 +1172,7 @@ const setWorkspacePath = async path => {
|
|
|
1322
1172
|
await invoke$2('Workspace.setPath', path);
|
|
1323
1173
|
};
|
|
1324
1174
|
const registerWebViewInterceptor = async (id, port) => {
|
|
1325
|
-
await invokeAndTransfer
|
|
1175
|
+
await invokeAndTransfer('WebView.registerInterceptor', id, port);
|
|
1326
1176
|
};
|
|
1327
1177
|
const unregisterWebViewInterceptor = async id => {
|
|
1328
1178
|
await invoke$2('WebView.unregisterInterceptor', id);
|
|
@@ -1330,22 +1180,22 @@ const unregisterWebViewInterceptor = async id => {
|
|
|
1330
1180
|
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1331
1181
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1332
1182
|
// @ts-ignore
|
|
1333
|
-
await invokeAndTransfer
|
|
1183
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1334
1184
|
};
|
|
1335
1185
|
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1336
1186
|
const command = 'Errors.handleMessagePort';
|
|
1337
1187
|
// @ts-ignore
|
|
1338
|
-
await invokeAndTransfer
|
|
1188
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1339
1189
|
};
|
|
1340
1190
|
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1341
1191
|
const command = 'Markdown.handleMessagePort';
|
|
1342
1192
|
// @ts-ignore
|
|
1343
|
-
await invokeAndTransfer
|
|
1193
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1344
1194
|
};
|
|
1345
1195
|
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1346
1196
|
const command = 'FileSystem.handleMessagePort';
|
|
1347
1197
|
// @ts-ignore
|
|
1348
|
-
await invokeAndTransfer
|
|
1198
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1349
1199
|
};
|
|
1350
1200
|
const readFile$1 = async uri => {
|
|
1351
1201
|
return invoke$2('FileSystem.readFile', uri);
|
|
@@ -1355,7 +1205,7 @@ const getWebViewSecret = async key => {
|
|
|
1355
1205
|
return invoke$2('WebView.getSecret', key);
|
|
1356
1206
|
};
|
|
1357
1207
|
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1358
|
-
return invokeAndTransfer
|
|
1208
|
+
return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
1359
1209
|
};
|
|
1360
1210
|
const setFocus = key => {
|
|
1361
1211
|
return invoke$2('Focus.setFocus', key);
|
|
@@ -1386,10 +1236,10 @@ const closeWidget = async widgetId => {
|
|
|
1386
1236
|
};
|
|
1387
1237
|
const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
1388
1238
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1389
|
-
await invokeAndTransfer
|
|
1239
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1390
1240
|
};
|
|
1391
1241
|
const sendMessagePortToSearchProcess = async port => {
|
|
1392
|
-
await invokeAndTransfer
|
|
1242
|
+
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1393
1243
|
};
|
|
1394
1244
|
const confirm = async (message, options) => {
|
|
1395
1245
|
// @ts-ignore
|
|
@@ -1446,7 +1296,7 @@ const getWorkspacePath = () => {
|
|
|
1446
1296
|
const sendMessagePortToRendererProcess = async port => {
|
|
1447
1297
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1448
1298
|
// @ts-ignore
|
|
1449
|
-
await invokeAndTransfer
|
|
1299
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1450
1300
|
};
|
|
1451
1301
|
const getPreference = async key => {
|
|
1452
1302
|
return await invoke$2('Preferences.get', key);
|
|
@@ -1465,7 +1315,7 @@ const openUri$1 = async (uri, focus, options) => {
|
|
|
1465
1315
|
await invoke$2('Main.openUri', uri, focus, options);
|
|
1466
1316
|
};
|
|
1467
1317
|
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1468
|
-
await invokeAndTransfer
|
|
1318
|
+
await invokeAndTransfer(
|
|
1469
1319
|
// @ts-ignore
|
|
1470
1320
|
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1471
1321
|
};
|
|
@@ -1589,7 +1439,7 @@ const RendererWorker = {
|
|
|
1589
1439
|
handleDebugScriptParsed,
|
|
1590
1440
|
installExtension,
|
|
1591
1441
|
invoke: invoke$2,
|
|
1592
|
-
invokeAndTransfer
|
|
1442
|
+
invokeAndTransfer,
|
|
1593
1443
|
openExtensionSearch,
|
|
1594
1444
|
openExternal,
|
|
1595
1445
|
openNativeFolder,
|
|
@@ -1629,17 +1479,180 @@ const RendererWorker = {
|
|
|
1629
1479
|
writeClipBoardText
|
|
1630
1480
|
};
|
|
1631
1481
|
|
|
1482
|
+
const toCommandId = key => {
|
|
1483
|
+
const dotIndex = key.indexOf('.');
|
|
1484
|
+
return key.slice(dotIndex + 1);
|
|
1485
|
+
};
|
|
1486
|
+
const create = () => {
|
|
1487
|
+
const states = Object.create(null);
|
|
1488
|
+
const commandMapRef = {};
|
|
1489
|
+
return {
|
|
1490
|
+
get(uid) {
|
|
1491
|
+
return states[uid];
|
|
1492
|
+
},
|
|
1493
|
+
set(uid, oldState, newState) {
|
|
1494
|
+
states[uid] = {
|
|
1495
|
+
oldState,
|
|
1496
|
+
newState
|
|
1497
|
+
};
|
|
1498
|
+
},
|
|
1499
|
+
dispose(uid) {
|
|
1500
|
+
delete states[uid];
|
|
1501
|
+
},
|
|
1502
|
+
getKeys() {
|
|
1503
|
+
return Object.keys(states).map(key => {
|
|
1504
|
+
return Number.parseInt(key);
|
|
1505
|
+
});
|
|
1506
|
+
},
|
|
1507
|
+
clear() {
|
|
1508
|
+
for (const key of Object.keys(states)) {
|
|
1509
|
+
delete states[key];
|
|
1510
|
+
}
|
|
1511
|
+
},
|
|
1512
|
+
wrapCommand(fn) {
|
|
1513
|
+
const wrapped = async (uid, ...args) => {
|
|
1514
|
+
const {
|
|
1515
|
+
newState
|
|
1516
|
+
} = states[uid];
|
|
1517
|
+
const newerState = await fn(newState, ...args);
|
|
1518
|
+
if (newState === newerState) {
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
const latest = states[uid];
|
|
1522
|
+
states[uid] = {
|
|
1523
|
+
oldState: latest.oldState,
|
|
1524
|
+
newState: newerState
|
|
1525
|
+
};
|
|
1526
|
+
};
|
|
1527
|
+
return wrapped;
|
|
1528
|
+
},
|
|
1529
|
+
wrapGetter(fn) {
|
|
1530
|
+
const wrapped = (uid, ...args) => {
|
|
1531
|
+
const {
|
|
1532
|
+
newState
|
|
1533
|
+
} = states[uid];
|
|
1534
|
+
return fn(newState, ...args);
|
|
1535
|
+
};
|
|
1536
|
+
return wrapped;
|
|
1537
|
+
},
|
|
1538
|
+
diff(uid, modules, numbers) {
|
|
1539
|
+
const {
|
|
1540
|
+
oldState,
|
|
1541
|
+
newState
|
|
1542
|
+
} = states[uid];
|
|
1543
|
+
const diffResult = [];
|
|
1544
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1545
|
+
const fn = modules[i];
|
|
1546
|
+
if (!fn(oldState, newState)) {
|
|
1547
|
+
diffResult.push(numbers[i]);
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
return diffResult;
|
|
1551
|
+
},
|
|
1552
|
+
getCommandIds() {
|
|
1553
|
+
const keys = Object.keys(commandMapRef);
|
|
1554
|
+
const ids = keys.map(toCommandId);
|
|
1555
|
+
return ids;
|
|
1556
|
+
},
|
|
1557
|
+
registerCommands(commandMap) {
|
|
1558
|
+
Object.assign(commandMapRef, commandMap);
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
};
|
|
1562
|
+
const terminate = () => {
|
|
1563
|
+
globalThis.close();
|
|
1564
|
+
};
|
|
1565
|
+
|
|
1632
1566
|
const {
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1567
|
+
get: get$1,
|
|
1568
|
+
set: set$1,
|
|
1569
|
+
wrapCommand,
|
|
1570
|
+
getCommandIds,
|
|
1571
|
+
registerCommands
|
|
1572
|
+
} = create();
|
|
1573
|
+
|
|
1574
|
+
const create2 = (id, uri, x, y, width, height, workspacePath) => {
|
|
1575
|
+
const state = {
|
|
1576
|
+
actionsCache: Object.create(null),
|
|
1577
|
+
allGroups: [],
|
|
1578
|
+
deltaY: 0,
|
|
1579
|
+
enabledProviderIds: [],
|
|
1580
|
+
fileIconCache: Object.create(null),
|
|
1581
|
+
finalDeltaY: 0,
|
|
1582
|
+
gitRoot: '',
|
|
1583
|
+
handleOffset: 0,
|
|
1584
|
+
headerHeight: 40,
|
|
1585
|
+
// TODO
|
|
1586
|
+
height,
|
|
1587
|
+
id,
|
|
1588
|
+
index: [],
|
|
1589
|
+
inputValue: '',
|
|
1590
|
+
expandedGroups: Object.create(null),
|
|
1591
|
+
itemHeight: 20,
|
|
1592
|
+
items: [],
|
|
1593
|
+
maxLineY: 0,
|
|
1594
|
+
merge: [],
|
|
1595
|
+
minimumSliderSize: 20,
|
|
1596
|
+
minLineY: 0,
|
|
1597
|
+
providerId: '',
|
|
1598
|
+
root: '',
|
|
1599
|
+
scrollBarActive: false,
|
|
1600
|
+
scrollBarHeight: 0,
|
|
1601
|
+
splitButtonEnabled: false,
|
|
1602
|
+
untracked: [],
|
|
1603
|
+
visibleItems: [],
|
|
1604
|
+
width,
|
|
1605
|
+
workingTree: [],
|
|
1606
|
+
workspacePath,
|
|
1607
|
+
x,
|
|
1608
|
+
y
|
|
1609
|
+
};
|
|
1610
|
+
set$1(id, state, state);
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1613
|
+
const RenderItems = 4;
|
|
1614
|
+
|
|
1615
|
+
const diffType = RenderItems;
|
|
1616
|
+
const isEqual = (oldState, newState) => {
|
|
1617
|
+
return oldState.allGroups === newState.allGroups && oldState.visibleItems === newState.visibleItems && oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.deltaY === newState.deltaY;
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
const modules = [isEqual];
|
|
1621
|
+
const numbers = [diffType];
|
|
1622
|
+
|
|
1623
|
+
const diff = (oldState, newState) => {
|
|
1624
|
+
const diffResult = [];
|
|
1625
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1626
|
+
const fn = modules[i];
|
|
1627
|
+
if (!fn(oldState, newState)) {
|
|
1628
|
+
diffResult.push(numbers[i]);
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
return diffResult;
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
const diff2 = uid => {
|
|
1635
|
+
const {
|
|
1636
|
+
oldState,
|
|
1637
|
+
newState
|
|
1638
|
+
} = get$1(uid);
|
|
1639
|
+
const result = diff(oldState, newState);
|
|
1640
|
+
return result;
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
const getInfo = uid => {
|
|
1644
|
+
const {
|
|
1645
|
+
newState
|
|
1646
|
+
} = get$1(uid);
|
|
1647
|
+
return newState.allGroups;
|
|
1648
|
+
};
|
|
1636
1649
|
|
|
1637
1650
|
const activateByEvent = event => {
|
|
1638
|
-
return
|
|
1651
|
+
return activateByEvent$1(event);
|
|
1639
1652
|
};
|
|
1640
1653
|
|
|
1641
1654
|
const {
|
|
1642
|
-
invoke,
|
|
1655
|
+
invoke: invoke$1,
|
|
1643
1656
|
set} = ExtensionHost;
|
|
1644
1657
|
|
|
1645
1658
|
const executeProvider = async ({
|
|
@@ -1649,7 +1662,7 @@ const executeProvider = async ({
|
|
|
1649
1662
|
}) => {
|
|
1650
1663
|
await activateByEvent(event);
|
|
1651
1664
|
// @ts-ignore
|
|
1652
|
-
const result = await invoke(method, ...params);
|
|
1665
|
+
const result = await invoke$1(method, ...params);
|
|
1653
1666
|
return result;
|
|
1654
1667
|
};
|
|
1655
1668
|
|
|
@@ -1774,8 +1787,11 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
|
1774
1787
|
return missingRequests;
|
|
1775
1788
|
};
|
|
1776
1789
|
|
|
1790
|
+
const {
|
|
1791
|
+
invoke} = RendererWorker;
|
|
1792
|
+
|
|
1777
1793
|
const requestFileIcons = async requests => {
|
|
1778
|
-
const results = await invoke
|
|
1794
|
+
const results = await invoke('IconTheme.getIcons', requests);
|
|
1779
1795
|
return results;
|
|
1780
1796
|
};
|
|
1781
1797
|
|
|
@@ -1919,7 +1935,7 @@ const get = key => {
|
|
|
1919
1935
|
};
|
|
1920
1936
|
|
|
1921
1937
|
const getExtensions = async () => {
|
|
1922
|
-
return invoke('Extensions.getExtensions');
|
|
1938
|
+
return invoke$1('Extensions.getExtensions');
|
|
1923
1939
|
};
|
|
1924
1940
|
|
|
1925
1941
|
const requestSourceActions = async () => {
|
|
@@ -2137,12 +2153,20 @@ const handleClickDirectoryExpanded = async (state, item) => {
|
|
|
2137
2153
|
};
|
|
2138
2154
|
|
|
2139
2155
|
const readFile = async (uri, encoding = 'utf8') => {
|
|
2140
|
-
const content = await invoke
|
|
2156
|
+
const content = await invoke('FileSystem.readFile', uri);
|
|
2141
2157
|
return content;
|
|
2142
2158
|
};
|
|
2143
2159
|
|
|
2144
2160
|
const openUri = uri => {
|
|
2145
|
-
return invoke
|
|
2161
|
+
return invoke('Main.openUri', uri);
|
|
2162
|
+
};
|
|
2163
|
+
|
|
2164
|
+
const openDiffEditor = async (before, afterPath, width) => {
|
|
2165
|
+
// TODO handle error
|
|
2166
|
+
// TODO should only pass uris to diff editor, diff editor should then resolve file contents
|
|
2167
|
+
{
|
|
2168
|
+
await openUri(`inline-diff://data://${before}<->${afterPath}`);
|
|
2169
|
+
}
|
|
2146
2170
|
};
|
|
2147
2171
|
|
|
2148
2172
|
const handleClickFile = async (state, item) => {
|
|
@@ -2154,9 +2178,7 @@ const handleClickFile = async (state, item) => {
|
|
|
2154
2178
|
const absolutePath = `${root}/${item.file}`;
|
|
2155
2179
|
// TODO handle error
|
|
2156
2180
|
const [fileBefore] = await Promise.all([getFileBefore(providerId, item.file), readFile(absolutePath)]);
|
|
2157
|
-
|
|
2158
|
-
await openUri(`inline-diff://data://${fileBefore}<->${absolutePath}`);
|
|
2159
|
-
}
|
|
2181
|
+
await openDiffEditor(fileBefore, absolutePath);
|
|
2160
2182
|
return state;
|
|
2161
2183
|
};
|
|
2162
2184
|
|
|
@@ -2190,7 +2212,7 @@ const handleClickAt = async (state, eventX, eventY, name) => {
|
|
|
2190
2212
|
};
|
|
2191
2213
|
|
|
2192
2214
|
const show = async (x, y, id, ...args) => {
|
|
2193
|
-
return
|
|
2215
|
+
return showContextMenu(x, y, id, ...args);
|
|
2194
2216
|
};
|
|
2195
2217
|
|
|
2196
2218
|
const SourceControl$1 = 22;
|
|
@@ -2268,32 +2290,15 @@ const handleWheel = async (state, deltaMode, deltaY) => {
|
|
|
2268
2290
|
return setDeltaY(state, state.deltaY + deltaY);
|
|
2269
2291
|
};
|
|
2270
2292
|
|
|
2271
|
-
const getPortTuple = () => {
|
|
2272
|
-
const {
|
|
2273
|
-
port1,
|
|
2274
|
-
port2
|
|
2275
|
-
} = new MessageChannel();
|
|
2276
|
-
return {
|
|
2277
|
-
port1,
|
|
2278
|
-
port2
|
|
2279
|
-
};
|
|
2280
|
-
};
|
|
2281
|
-
|
|
2282
2293
|
const sendMessagePortToExtensionHostWorker = async port => {
|
|
2283
|
-
|
|
2284
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, SourceControlWorker);
|
|
2294
|
+
await sendMessagePortToExtensionHostWorker$1(port, SourceControlWorker);
|
|
2285
2295
|
};
|
|
2286
2296
|
|
|
2287
2297
|
const createExtensionHostRpc = async () => {
|
|
2288
2298
|
try {
|
|
2289
|
-
const {
|
|
2290
|
-
port1,
|
|
2291
|
-
port2
|
|
2292
|
-
} = getPortTuple();
|
|
2293
|
-
await sendMessagePortToExtensionHostWorker(port2);
|
|
2294
|
-
const rpc = await PlainMessagePortRpcParent.create({
|
|
2299
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
2295
2300
|
commandMap: {},
|
|
2296
|
-
|
|
2301
|
+
send: sendMessagePortToExtensionHostWorker
|
|
2297
2302
|
});
|
|
2298
2303
|
return rpc;
|
|
2299
2304
|
} catch (error) {
|
|
@@ -2424,7 +2429,7 @@ const getButtonVirtualDom = button => {
|
|
|
2424
2429
|
label
|
|
2425
2430
|
} = button;
|
|
2426
2431
|
return [{
|
|
2427
|
-
type: Button$
|
|
2432
|
+
type: Button$2,
|
|
2428
2433
|
className: SourceControlButton,
|
|
2429
2434
|
title: label,
|
|
2430
2435
|
ariaLabel: label,
|
|
@@ -2634,7 +2639,7 @@ const getSourceControlVirtualDom = (items, splitButtonEnabled) => {
|
|
|
2634
2639
|
const renderItems = (oldState, newState) => {
|
|
2635
2640
|
const visible = newState.visibleItems;
|
|
2636
2641
|
const dom = getSourceControlVirtualDom(visible, newState.splitButtonEnabled);
|
|
2637
|
-
return [
|
|
2642
|
+
return [SetDom2, dom];
|
|
2638
2643
|
};
|
|
2639
2644
|
|
|
2640
2645
|
const getRenderer = diffType => {
|
|
@@ -2662,8 +2667,8 @@ const render2 = (uid, diffResult) => {
|
|
|
2662
2667
|
const {
|
|
2663
2668
|
oldState,
|
|
2664
2669
|
newState
|
|
2665
|
-
} = get$
|
|
2666
|
-
set$
|
|
2670
|
+
} = get$1(uid);
|
|
2671
|
+
set$1(uid, newState, newState);
|
|
2667
2672
|
const commands = applyRender(oldState, newState, diffResult);
|
|
2668
2673
|
return commands;
|
|
2669
2674
|
};
|
|
@@ -2677,7 +2682,7 @@ const getActionButtonVirtualDom = action => {
|
|
|
2677
2682
|
command
|
|
2678
2683
|
} = action;
|
|
2679
2684
|
return [{
|
|
2680
|
-
type: Button$
|
|
2685
|
+
type: Button$2,
|
|
2681
2686
|
className: IconButton,
|
|
2682
2687
|
title: id,
|
|
2683
2688
|
'data-command': command,
|
|
@@ -2712,40 +2717,40 @@ const renderActions = uid => {
|
|
|
2712
2717
|
const renderEventListeners = () => {
|
|
2713
2718
|
return [{
|
|
2714
2719
|
name: HandleWheel,
|
|
2715
|
-
params: ['handleWheel',
|
|
2720
|
+
params: ['handleWheel', DeltaMode, DeltaY],
|
|
2716
2721
|
passive: true
|
|
2717
2722
|
}, {
|
|
2718
2723
|
name: HandleFocus,
|
|
2719
2724
|
params: ['handleFocus']
|
|
2720
2725
|
}, {
|
|
2721
2726
|
name: HandleClickAt,
|
|
2722
|
-
params: ['handleClickAt',
|
|
2727
|
+
params: ['handleClickAt', ClientX, ClientY, TargetName]
|
|
2723
2728
|
}, {
|
|
2724
2729
|
name: HandleMouseOverAt,
|
|
2725
|
-
params: ['handleMouseOverAt',
|
|
2730
|
+
params: ['handleMouseOverAt', ClientX, ClientY]
|
|
2726
2731
|
}, {
|
|
2727
2732
|
name: HandleMouseOver,
|
|
2728
|
-
params: ['handleMouseOver',
|
|
2733
|
+
params: ['handleMouseOver', ClientX, ClientY]
|
|
2729
2734
|
}, {
|
|
2730
2735
|
name: HandleMouseOutAt,
|
|
2731
|
-
params: ['handleMouseOutAt',
|
|
2736
|
+
params: ['handleMouseOutAt', ClientX, ClientY]
|
|
2732
2737
|
}, {
|
|
2733
2738
|
name: HandleInput,
|
|
2734
|
-
params: ['handleInput',
|
|
2739
|
+
params: ['handleInput', TargetValue]
|
|
2735
2740
|
}, {
|
|
2736
2741
|
name: HandleContextMenu,
|
|
2737
|
-
params: ['handleContextMenu',
|
|
2742
|
+
params: ['handleContextMenu', Button$1, ClientX, ClientY],
|
|
2738
2743
|
preventDefault: true
|
|
2739
2744
|
}, {
|
|
2740
2745
|
name: HandleWheel,
|
|
2741
|
-
params: ['handleWheel',
|
|
2746
|
+
params: ['handleWheel', DeltaMode, DeltaY],
|
|
2742
2747
|
passive: true
|
|
2743
2748
|
}];
|
|
2744
2749
|
};
|
|
2745
2750
|
|
|
2746
2751
|
const saveState = uid => {
|
|
2747
2752
|
number(uid);
|
|
2748
|
-
const value = get$
|
|
2753
|
+
const value = get$1(uid);
|
|
2749
2754
|
const {
|
|
2750
2755
|
newState
|
|
2751
2756
|
} = value;
|
|
@@ -2763,10 +2768,6 @@ const saveState = uid => {
|
|
|
2763
2768
|
};
|
|
2764
2769
|
};
|
|
2765
2770
|
|
|
2766
|
-
const terminate = () => {
|
|
2767
|
-
globalThis.close();
|
|
2768
|
-
};
|
|
2769
|
-
|
|
2770
2771
|
const updateIcons = async state => {
|
|
2771
2772
|
const {
|
|
2772
2773
|
items,
|
|
@@ -2815,7 +2816,7 @@ const listen = async () => {
|
|
|
2815
2816
|
const rpc = await WebWorkerRpcClient.create({
|
|
2816
2817
|
commandMap: commandMap
|
|
2817
2818
|
});
|
|
2818
|
-
set$
|
|
2819
|
+
set$2(rpc);
|
|
2819
2820
|
};
|
|
2820
2821
|
|
|
2821
2822
|
const main = async () => {
|