@lvce-editor/output-view 1.0.0 → 1.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/outputViewWorkerMain.js +547 -61
- package/package.json +1 -1
|
@@ -921,6 +921,13 @@ const terminate = () => {
|
|
|
921
921
|
globalThis.close();
|
|
922
922
|
};
|
|
923
923
|
|
|
924
|
+
const closeFindWidget = async state => {
|
|
925
|
+
// TODO
|
|
926
|
+
return {
|
|
927
|
+
...state
|
|
928
|
+
};
|
|
929
|
+
};
|
|
930
|
+
|
|
924
931
|
const User = 1;
|
|
925
932
|
const Script = 2;
|
|
926
933
|
|
|
@@ -933,6 +940,7 @@ const {
|
|
|
933
940
|
const create$1 = (id, uri, x, y, width, height, workspaceUri) => {
|
|
934
941
|
const state = {
|
|
935
942
|
uid: id,
|
|
943
|
+
uri,
|
|
936
944
|
focusedIndex: -2,
|
|
937
945
|
message: '',
|
|
938
946
|
itemHeight: 22,
|
|
@@ -946,8 +954,10 @@ const create$1 = (id, uri, x, y, width, height, workspaceUri) => {
|
|
|
946
954
|
maxLineY: 0,
|
|
947
955
|
listItems: [],
|
|
948
956
|
collapsedUris: [],
|
|
957
|
+
selectedOption: '',
|
|
949
958
|
smallWidthBreakPoint: 650,
|
|
950
|
-
workspaceUri
|
|
959
|
+
workspaceUri,
|
|
960
|
+
options: []
|
|
951
961
|
};
|
|
952
962
|
set$1(id, state, state);
|
|
953
963
|
};
|
|
@@ -957,7 +967,7 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
957
967
|
};
|
|
958
968
|
|
|
959
969
|
const isEqual = (oldState, newState) => {
|
|
960
|
-
return oldState.filterValue === newState.filterValue && oldState.message === newState.message;
|
|
970
|
+
return oldState.filterValue === newState.filterValue && oldState.message === newState.message && oldState.options === newState.options && oldState.listItems === newState.listItems;
|
|
961
971
|
};
|
|
962
972
|
|
|
963
973
|
const RenderItems = 1;
|
|
@@ -1030,14 +1040,25 @@ const KeyCode = {
|
|
|
1030
1040
|
Space,
|
|
1031
1041
|
UpArrow
|
|
1032
1042
|
};
|
|
1043
|
+
const mergeClassNames = (...classNames) => {
|
|
1044
|
+
return classNames.filter(Boolean).join(' ');
|
|
1045
|
+
};
|
|
1033
1046
|
const Div = 4;
|
|
1047
|
+
const Text = 12;
|
|
1034
1048
|
const VirtualDomElements = {
|
|
1035
1049
|
__proto__: null,
|
|
1036
1050
|
Div};
|
|
1051
|
+
const text = data => {
|
|
1052
|
+
return {
|
|
1053
|
+
type: Text,
|
|
1054
|
+
text: data,
|
|
1055
|
+
childCount: 0
|
|
1056
|
+
};
|
|
1057
|
+
};
|
|
1037
1058
|
|
|
1038
1059
|
const FocusProblems = 19;
|
|
1039
1060
|
|
|
1040
|
-
const getKeyBindings = () => {
|
|
1061
|
+
const getKeyBindings$1 = () => {
|
|
1041
1062
|
return [{
|
|
1042
1063
|
key: KeyCode.DownArrow,
|
|
1043
1064
|
command: 'Problems.focusNext',
|
|
@@ -1085,8 +1106,397 @@ const getKeyBindings = () => {
|
|
|
1085
1106
|
}];
|
|
1086
1107
|
};
|
|
1087
1108
|
|
|
1109
|
+
const handleData = async state => {
|
|
1110
|
+
// TODO
|
|
1111
|
+
return {
|
|
1112
|
+
...state
|
|
1113
|
+
};
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
const handleError = async state => {
|
|
1117
|
+
// TODO
|
|
1118
|
+
return {
|
|
1119
|
+
...state
|
|
1120
|
+
};
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1088
1123
|
const initialize = async () => {};
|
|
1089
1124
|
|
|
1125
|
+
const getSelectedItem = platform => {
|
|
1126
|
+
return 'file:///tmp/log-main-process.txt';
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
const rpcs = Object.create(null);
|
|
1130
|
+
const set$g = (id, rpc) => {
|
|
1131
|
+
rpcs[id] = rpc;
|
|
1132
|
+
};
|
|
1133
|
+
const get = id => {
|
|
1134
|
+
return rpcs[id];
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1138
|
+
|
|
1139
|
+
const create = rpcId => {
|
|
1140
|
+
return {
|
|
1141
|
+
// @ts-ignore
|
|
1142
|
+
invoke(method, ...params) {
|
|
1143
|
+
const rpc = get(rpcId);
|
|
1144
|
+
// @ts-ignore
|
|
1145
|
+
return rpc.invoke(method, ...params);
|
|
1146
|
+
},
|
|
1147
|
+
// @ts-ignore
|
|
1148
|
+
invokeAndTransfer(method, ...params) {
|
|
1149
|
+
const rpc = get(rpcId);
|
|
1150
|
+
// @ts-ignore
|
|
1151
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1152
|
+
},
|
|
1153
|
+
set(rpc) {
|
|
1154
|
+
set$g(rpcId, rpc);
|
|
1155
|
+
},
|
|
1156
|
+
async dispose() {
|
|
1157
|
+
const rpc = get(rpcId);
|
|
1158
|
+
await rpc.dispose();
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
};
|
|
1162
|
+
const DebugWorker$1 = 55;
|
|
1163
|
+
const RendererWorker$1 = 1;
|
|
1164
|
+
const {
|
|
1165
|
+
invoke: invoke$3,
|
|
1166
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1167
|
+
set: set$3,
|
|
1168
|
+
dispose: dispose$3
|
|
1169
|
+
} = create(RendererWorker$1);
|
|
1170
|
+
const searchFileHtml = async uri => {
|
|
1171
|
+
return invoke$3('ExtensionHost.searchFileWithHtml', uri);
|
|
1172
|
+
};
|
|
1173
|
+
const getFilePathElectron = async file => {
|
|
1174
|
+
return invoke$3('FileSystemHandle.getFilePathElectron', file);
|
|
1175
|
+
};
|
|
1176
|
+
const showContextMenu = async (x, y, id, ...args) => {
|
|
1177
|
+
return invoke$3('ContextMenu.show', x, y, id, ...args);
|
|
1178
|
+
};
|
|
1179
|
+
const getElectronVersion = async () => {
|
|
1180
|
+
return invoke$3('Process.getElectronVersion');
|
|
1181
|
+
};
|
|
1182
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
1183
|
+
await invoke$3('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1184
|
+
};
|
|
1185
|
+
const setColorTheme = async id => {
|
|
1186
|
+
// @ts-ignore
|
|
1187
|
+
return invoke$3(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1188
|
+
};
|
|
1189
|
+
const getNodeVersion = async () => {
|
|
1190
|
+
return invoke$3('Process.getNodeVersion');
|
|
1191
|
+
};
|
|
1192
|
+
const getChromeVersion = async () => {
|
|
1193
|
+
return invoke$3('Process.getChromeVersion');
|
|
1194
|
+
};
|
|
1195
|
+
const getV8Version = async () => {
|
|
1196
|
+
return invoke$3('Process.getV8Version');
|
|
1197
|
+
};
|
|
1198
|
+
const getFileHandles = async fileIds => {
|
|
1199
|
+
const files = await invoke$3('FileSystemHandle.getFileHandles', fileIds);
|
|
1200
|
+
return files;
|
|
1201
|
+
};
|
|
1202
|
+
const setWorkspacePath = async path => {
|
|
1203
|
+
await invoke$3('Workspace.setPath', path);
|
|
1204
|
+
};
|
|
1205
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
1206
|
+
await invokeAndTransfer$3('WebView.registerInterceptor', id, port);
|
|
1207
|
+
};
|
|
1208
|
+
const unregisterWebViewInterceptor = async id => {
|
|
1209
|
+
await invoke$3('WebView.unregisterInterceptor', id);
|
|
1210
|
+
};
|
|
1211
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1212
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1213
|
+
// @ts-ignore
|
|
1214
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1215
|
+
};
|
|
1216
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1217
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1218
|
+
// @ts-ignore
|
|
1219
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1220
|
+
};
|
|
1221
|
+
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1222
|
+
const command = 'Markdown.handleMessagePort';
|
|
1223
|
+
// @ts-ignore
|
|
1224
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1225
|
+
};
|
|
1226
|
+
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1227
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1228
|
+
// @ts-ignore
|
|
1229
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1230
|
+
};
|
|
1231
|
+
const readFile = async uri => {
|
|
1232
|
+
return invoke$3('FileSystem.readFile', uri);
|
|
1233
|
+
};
|
|
1234
|
+
const getWebViewSecret = async key => {
|
|
1235
|
+
// @ts-ignore
|
|
1236
|
+
return invoke$3('WebView.getSecret', key);
|
|
1237
|
+
};
|
|
1238
|
+
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1239
|
+
return invokeAndTransfer$3('WebView.setPort', uid, port, origin, portType);
|
|
1240
|
+
};
|
|
1241
|
+
const setFocus = key => {
|
|
1242
|
+
return invoke$3('Focus.setFocus', key);
|
|
1243
|
+
};
|
|
1244
|
+
const getFileIcon = async options => {
|
|
1245
|
+
return invoke$3('IconTheme.getFileIcon', options);
|
|
1246
|
+
};
|
|
1247
|
+
const getColorThemeNames = async () => {
|
|
1248
|
+
return invoke$3('ColorTheme.getColorThemeNames');
|
|
1249
|
+
};
|
|
1250
|
+
const disableExtension = async id => {
|
|
1251
|
+
return invoke$3('ExtensionManagement.disable', id);
|
|
1252
|
+
};
|
|
1253
|
+
const enableExtension = async id => {
|
|
1254
|
+
// @ts-ignore
|
|
1255
|
+
return invoke$3('ExtensionManagement.enable', id);
|
|
1256
|
+
};
|
|
1257
|
+
const handleDebugChange = async params => {
|
|
1258
|
+
// @ts-ignore
|
|
1259
|
+
return invoke$3('Run And Debug.handleChange', params);
|
|
1260
|
+
};
|
|
1261
|
+
const getFolderIcon = async options => {
|
|
1262
|
+
return invoke$3('IconTheme.getFolderIcon', options);
|
|
1263
|
+
};
|
|
1264
|
+
const closeWidget = async widgetId => {
|
|
1265
|
+
return invoke$3('Viewlet.closeWidget', widgetId);
|
|
1266
|
+
};
|
|
1267
|
+
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1268
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1269
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1270
|
+
};
|
|
1271
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
1272
|
+
await invokeAndTransfer$3('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1273
|
+
};
|
|
1274
|
+
const confirm = async (message, options) => {
|
|
1275
|
+
// @ts-ignore
|
|
1276
|
+
const result = await invoke$3('Confirmprompt.prompt', message, options);
|
|
1277
|
+
return result;
|
|
1278
|
+
};
|
|
1279
|
+
const getRecentlyOpened = async () => {
|
|
1280
|
+
return invoke$3(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1281
|
+
};
|
|
1282
|
+
const getKeyBindings = async () => {
|
|
1283
|
+
return invoke$3('KeyBindingsInitial.getKeyBindings');
|
|
1284
|
+
};
|
|
1285
|
+
const writeClipBoardText = async text => {
|
|
1286
|
+
await invoke$3('ClipBoard.writeText', /* text */text);
|
|
1287
|
+
};
|
|
1288
|
+
const writeClipBoardImage = async blob => {
|
|
1289
|
+
// @ts-ignore
|
|
1290
|
+
await invoke$3('ClipBoard.writeImage', /* text */blob);
|
|
1291
|
+
};
|
|
1292
|
+
const searchFileMemory = async uri => {
|
|
1293
|
+
// @ts-ignore
|
|
1294
|
+
return invoke$3('ExtensionHost.searchFileWithMemory', uri);
|
|
1295
|
+
};
|
|
1296
|
+
const searchFileFetch = async uri => {
|
|
1297
|
+
return invoke$3('ExtensionHost.searchFileWithFetch', uri);
|
|
1298
|
+
};
|
|
1299
|
+
const showMessageBox = async options => {
|
|
1300
|
+
return invoke$3('ElectronDialog.showMessageBox', options);
|
|
1301
|
+
};
|
|
1302
|
+
const handleDebugResumed = async params => {
|
|
1303
|
+
await invoke$3('Run And Debug.handleResumed', params);
|
|
1304
|
+
};
|
|
1305
|
+
const openWidget = async name => {
|
|
1306
|
+
await invoke$3('Viewlet.openWidget', name);
|
|
1307
|
+
};
|
|
1308
|
+
const getIcons = async requests => {
|
|
1309
|
+
const icons = await invoke$3('IconTheme.getIcons', requests);
|
|
1310
|
+
return icons;
|
|
1311
|
+
};
|
|
1312
|
+
const activateByEvent = event => {
|
|
1313
|
+
return invoke$3('ExtensionHostManagement.activateByEvent', event);
|
|
1314
|
+
};
|
|
1315
|
+
const setAdditionalFocus = focusKey => {
|
|
1316
|
+
// @ts-ignore
|
|
1317
|
+
return invoke$3('Focus.setAdditionalFocus', focusKey);
|
|
1318
|
+
};
|
|
1319
|
+
const getActiveEditorId = () => {
|
|
1320
|
+
// @ts-ignore
|
|
1321
|
+
return invoke$3('GetActiveEditor.getActiveEditorId');
|
|
1322
|
+
};
|
|
1323
|
+
const getWorkspacePath = () => {
|
|
1324
|
+
return invoke$3('Workspace.getPath');
|
|
1325
|
+
};
|
|
1326
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
1327
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1328
|
+
// @ts-ignore
|
|
1329
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker$1);
|
|
1330
|
+
};
|
|
1331
|
+
const getPreference = async key => {
|
|
1332
|
+
return await invoke$3('Preferences.get', key);
|
|
1333
|
+
};
|
|
1334
|
+
const getAllExtensions = async () => {
|
|
1335
|
+
return invoke$3('ExtensionManagement.getAllExtensions');
|
|
1336
|
+
};
|
|
1337
|
+
const rerenderEditor = async key => {
|
|
1338
|
+
// @ts-ignore
|
|
1339
|
+
return invoke$3('Editor.rerender', key);
|
|
1340
|
+
};
|
|
1341
|
+
const handleDebugPaused = async params => {
|
|
1342
|
+
await invoke$3('Run And Debug.handlePaused', params);
|
|
1343
|
+
};
|
|
1344
|
+
const openUri = async (uri, focus, options) => {
|
|
1345
|
+
await invoke$3('Main.openUri', uri, focus, options);
|
|
1346
|
+
};
|
|
1347
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
1348
|
+
await invokeAndTransfer$3(
|
|
1349
|
+
// @ts-ignore
|
|
1350
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1351
|
+
};
|
|
1352
|
+
const handleDebugScriptParsed = async script => {
|
|
1353
|
+
await invoke$3('Run And Debug.handleScriptParsed', script);
|
|
1354
|
+
};
|
|
1355
|
+
const getWindowId = async () => {
|
|
1356
|
+
return invoke$3('GetWindowId.getWindowId');
|
|
1357
|
+
};
|
|
1358
|
+
const getBlob = async uri => {
|
|
1359
|
+
// @ts-ignore
|
|
1360
|
+
return invoke$3('FileSystem.getBlob', uri);
|
|
1361
|
+
};
|
|
1362
|
+
const getExtensionCommands = async () => {
|
|
1363
|
+
return invoke$3('ExtensionHost.getCommands');
|
|
1364
|
+
};
|
|
1365
|
+
const showErrorDialog = async errorInfo => {
|
|
1366
|
+
// @ts-ignore
|
|
1367
|
+
await invoke$3('ErrorHandling.showErrorDialog', errorInfo);
|
|
1368
|
+
};
|
|
1369
|
+
const getFolderSize = async uri => {
|
|
1370
|
+
// @ts-ignore
|
|
1371
|
+
return await invoke$3('FileSystem.getFolderSize', uri);
|
|
1372
|
+
};
|
|
1373
|
+
const getExtension = async id => {
|
|
1374
|
+
// @ts-ignore
|
|
1375
|
+
return invoke$3('ExtensionManagement.getExtension', id);
|
|
1376
|
+
};
|
|
1377
|
+
const getMarkdownDom = async html => {
|
|
1378
|
+
// @ts-ignore
|
|
1379
|
+
return invoke$3('Markdown.getVirtualDom', html);
|
|
1380
|
+
};
|
|
1381
|
+
const renderMarkdown = async (markdown, options) => {
|
|
1382
|
+
// @ts-ignore
|
|
1383
|
+
return invoke$3('Markdown.renderMarkdown', markdown, options);
|
|
1384
|
+
};
|
|
1385
|
+
const openNativeFolder = async uri => {
|
|
1386
|
+
// @ts-ignore
|
|
1387
|
+
await invoke$3('OpenNativeFolder.openNativeFolder', uri);
|
|
1388
|
+
};
|
|
1389
|
+
const uninstallExtension = async id => {
|
|
1390
|
+
return invoke$3('ExtensionManagement.uninstall', id);
|
|
1391
|
+
};
|
|
1392
|
+
const installExtension = async id => {
|
|
1393
|
+
// @ts-ignore
|
|
1394
|
+
return invoke$3('ExtensionManagement.install', id);
|
|
1395
|
+
};
|
|
1396
|
+
const openExtensionSearch = async () => {
|
|
1397
|
+
// @ts-ignore
|
|
1398
|
+
return invoke$3('SideBar.openViewlet', 'Extensions');
|
|
1399
|
+
};
|
|
1400
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
1401
|
+
// @ts-ignore
|
|
1402
|
+
return invoke$3('Extensions.handleInput', searchValue);
|
|
1403
|
+
};
|
|
1404
|
+
const openExternal = async uri => {
|
|
1405
|
+
// @ts-ignore
|
|
1406
|
+
await invoke$3('Open.openExternal', uri);
|
|
1407
|
+
};
|
|
1408
|
+
const openUrl = async uri => {
|
|
1409
|
+
// @ts-ignore
|
|
1410
|
+
await invoke$3('Open.openUrl', uri);
|
|
1411
|
+
};
|
|
1412
|
+
const getAllPreferences = async () => {
|
|
1413
|
+
// @ts-ignore
|
|
1414
|
+
return invoke$3('Preferences.getAll');
|
|
1415
|
+
};
|
|
1416
|
+
const RendererWorker = {
|
|
1417
|
+
__proto__: null,
|
|
1418
|
+
activateByEvent,
|
|
1419
|
+
applyBulkReplacement,
|
|
1420
|
+
closeWidget,
|
|
1421
|
+
confirm,
|
|
1422
|
+
disableExtension,
|
|
1423
|
+
dispose: dispose$3,
|
|
1424
|
+
enableExtension,
|
|
1425
|
+
getActiveEditorId,
|
|
1426
|
+
getAllExtensions,
|
|
1427
|
+
getAllPreferences,
|
|
1428
|
+
getBlob,
|
|
1429
|
+
getChromeVersion,
|
|
1430
|
+
getColorThemeNames,
|
|
1431
|
+
getElectronVersion,
|
|
1432
|
+
getExtension,
|
|
1433
|
+
getExtensionCommands,
|
|
1434
|
+
getFileHandles,
|
|
1435
|
+
getFileIcon,
|
|
1436
|
+
getFilePathElectron,
|
|
1437
|
+
getFolderIcon,
|
|
1438
|
+
getFolderSize,
|
|
1439
|
+
getIcons,
|
|
1440
|
+
getKeyBindings,
|
|
1441
|
+
getMarkdownDom,
|
|
1442
|
+
getNodeVersion,
|
|
1443
|
+
getPreference,
|
|
1444
|
+
getRecentlyOpened,
|
|
1445
|
+
getV8Version,
|
|
1446
|
+
getWebViewSecret,
|
|
1447
|
+
getWindowId,
|
|
1448
|
+
getWorkspacePath,
|
|
1449
|
+
handleDebugChange,
|
|
1450
|
+
handleDebugPaused,
|
|
1451
|
+
handleDebugResumed,
|
|
1452
|
+
handleDebugScriptParsed,
|
|
1453
|
+
installExtension,
|
|
1454
|
+
invoke: invoke$3,
|
|
1455
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1456
|
+
openExtensionSearch,
|
|
1457
|
+
openExternal,
|
|
1458
|
+
openNativeFolder,
|
|
1459
|
+
openUri,
|
|
1460
|
+
openUrl,
|
|
1461
|
+
openWidget,
|
|
1462
|
+
readFile,
|
|
1463
|
+
registerWebViewInterceptor,
|
|
1464
|
+
renderMarkdown,
|
|
1465
|
+
rerenderEditor,
|
|
1466
|
+
searchFileFetch,
|
|
1467
|
+
searchFileHtml,
|
|
1468
|
+
searchFileMemory,
|
|
1469
|
+
sendMessagePortToEditorWorker,
|
|
1470
|
+
sendMessagePortToErrorWorker,
|
|
1471
|
+
sendMessagePortToExtensionHostWorker,
|
|
1472
|
+
sendMessagePortToFileSystemWorker,
|
|
1473
|
+
sendMessagePortToMarkdownWorker,
|
|
1474
|
+
sendMessagePortToRendererProcess,
|
|
1475
|
+
sendMessagePortToSearchProcess,
|
|
1476
|
+
sendMessagePortToSyntaxHighlightingWorker,
|
|
1477
|
+
set: set$3,
|
|
1478
|
+
setAdditionalFocus,
|
|
1479
|
+
setColorTheme,
|
|
1480
|
+
setExtensionsSearchValue,
|
|
1481
|
+
setFocus,
|
|
1482
|
+
setWebViewPort,
|
|
1483
|
+
setWorkspacePath,
|
|
1484
|
+
showContextMenu,
|
|
1485
|
+
showErrorDialog,
|
|
1486
|
+
showMessageBox,
|
|
1487
|
+
uninstallExtension,
|
|
1488
|
+
unregisterWebViewInterceptor,
|
|
1489
|
+
writeClipBoardImage,
|
|
1490
|
+
writeClipBoardText
|
|
1491
|
+
};
|
|
1492
|
+
|
|
1493
|
+
const loadLines = async uri => {
|
|
1494
|
+
// TODO use log stream, updating the output when the file is changed
|
|
1495
|
+
const content = await RendererWorker.invoke('FileSystem.readFile', uri);
|
|
1496
|
+
const lines = content.split('\n');
|
|
1497
|
+
return lines;
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1090
1500
|
const isString = value => {
|
|
1091
1501
|
return typeof value === 'string';
|
|
1092
1502
|
};
|
|
@@ -1098,12 +1508,92 @@ const getSavedCollapsedUris = savedState => {
|
|
|
1098
1508
|
};
|
|
1099
1509
|
const loadContent = async (state, savedState) => {
|
|
1100
1510
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
1511
|
+
const selectedUri = getSelectedItem();
|
|
1512
|
+
const lines = await loadLines(selectedUri);
|
|
1101
1513
|
return {
|
|
1102
1514
|
...state,
|
|
1103
1515
|
inputSource: Script,
|
|
1104
|
-
listItems:
|
|
1105
|
-
collapsedUris
|
|
1516
|
+
listItems: lines,
|
|
1517
|
+
collapsedUris,
|
|
1518
|
+
options: [],
|
|
1519
|
+
selectedOption: selectedUri
|
|
1520
|
+
};
|
|
1521
|
+
};
|
|
1522
|
+
|
|
1523
|
+
const openFindWidget = async state => {
|
|
1524
|
+
// TODO
|
|
1525
|
+
return {
|
|
1526
|
+
...state
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
const Button = 1;
|
|
1531
|
+
const Select = 2;
|
|
1532
|
+
|
|
1533
|
+
const Blank = 'Blank';
|
|
1534
|
+
const ClearAll = 'ClearAll';
|
|
1535
|
+
|
|
1536
|
+
const emptyObject = {};
|
|
1537
|
+
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1538
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1539
|
+
if (placeholders === emptyObject) {
|
|
1540
|
+
return key;
|
|
1541
|
+
}
|
|
1542
|
+
const replacer = (match, rest) => {
|
|
1543
|
+
return placeholders[rest];
|
|
1106
1544
|
};
|
|
1545
|
+
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* @enum {string}
|
|
1550
|
+
*/
|
|
1551
|
+
const UiStrings = {
|
|
1552
|
+
Output: 'output',
|
|
1553
|
+
ClearOutput: 'clear output',
|
|
1554
|
+
TurnOffAutoScroll: 'Turn auto scrolling off',
|
|
1555
|
+
OpenLogFile: 'open output log file'
|
|
1556
|
+
};
|
|
1557
|
+
const output = () => {
|
|
1558
|
+
return i18nString(UiStrings.Output);
|
|
1559
|
+
};
|
|
1560
|
+
const clearOutput = () => {
|
|
1561
|
+
return i18nString(UiStrings.ClearOutput);
|
|
1562
|
+
};
|
|
1563
|
+
const turnOffAutoScroll = () => {
|
|
1564
|
+
return i18nString(UiStrings.TurnOffAutoScroll);
|
|
1565
|
+
};
|
|
1566
|
+
const openLogFile = () => {
|
|
1567
|
+
return i18nString(UiStrings.OpenLogFile);
|
|
1568
|
+
};
|
|
1569
|
+
|
|
1570
|
+
const toSelectOption = option => {
|
|
1571
|
+
return option.name;
|
|
1572
|
+
};
|
|
1573
|
+
const toSelectOptions = options => {
|
|
1574
|
+
return options.map(toSelectOption);
|
|
1575
|
+
};
|
|
1576
|
+
const getActions = state => {
|
|
1577
|
+
const {
|
|
1578
|
+
options
|
|
1579
|
+
} = state;
|
|
1580
|
+
return [{
|
|
1581
|
+
type: Select,
|
|
1582
|
+
id: output(),
|
|
1583
|
+
options: toSelectOptions(options)
|
|
1584
|
+
}, {
|
|
1585
|
+
type: Button,
|
|
1586
|
+
id: clearOutput(),
|
|
1587
|
+
icon: ClearAll
|
|
1588
|
+
}, {
|
|
1589
|
+
type: Button,
|
|
1590
|
+
id: turnOffAutoScroll(),
|
|
1591
|
+
icon: Blank
|
|
1592
|
+
}, {
|
|
1593
|
+
type: Button,
|
|
1594
|
+
id: openLogFile(),
|
|
1595
|
+
icon: Blank
|
|
1596
|
+
}];
|
|
1107
1597
|
};
|
|
1108
1598
|
|
|
1109
1599
|
const Filter = 'filter';
|
|
@@ -1112,9 +1602,34 @@ const renderFilterValue = (oldState, newState) => {
|
|
|
1112
1602
|
return ['Viewlet.setValueByName', Filter, newState.filterValue];
|
|
1113
1603
|
};
|
|
1114
1604
|
|
|
1605
|
+
const Actions = 'Actions';
|
|
1606
|
+
const Viewlet = 'Viewlet';
|
|
1607
|
+
const Output = 'Output';
|
|
1608
|
+
|
|
1609
|
+
const getLineDom = line => {
|
|
1610
|
+
return [{
|
|
1611
|
+
type: VirtualDomElements.Div,
|
|
1612
|
+
className: 'Line',
|
|
1613
|
+
childCount: 1
|
|
1614
|
+
}, text(line)];
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
const getOutputVirtualDom = lines => {
|
|
1618
|
+
return [{
|
|
1619
|
+
type: VirtualDomElements.Div,
|
|
1620
|
+
className: mergeClassNames(Viewlet, Output),
|
|
1621
|
+
childCount: 1
|
|
1622
|
+
}, {
|
|
1623
|
+
type: VirtualDomElements.Div,
|
|
1624
|
+
className: 'OutputContent',
|
|
1625
|
+
role: 'log',
|
|
1626
|
+
tabIndex: 0,
|
|
1627
|
+
childCount: lines.length
|
|
1628
|
+
}, ...lines.flatMap(getLineDom)];
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1115
1631
|
const renderItems = (oldState, newState) => {
|
|
1116
|
-
|
|
1117
|
-
const dom = [];
|
|
1632
|
+
const dom = getOutputVirtualDom(newState.listItems);
|
|
1118
1633
|
return ['Viewlet.setDom2', dom];
|
|
1119
1634
|
};
|
|
1120
1635
|
|
|
@@ -1148,8 +1663,6 @@ const render2 = (uid, diffResult) => {
|
|
|
1148
1663
|
return commands;
|
|
1149
1664
|
};
|
|
1150
1665
|
|
|
1151
|
-
const Actions = 'Actions';
|
|
1152
|
-
|
|
1153
1666
|
const getActionsVirtualDom = actions => {
|
|
1154
1667
|
return [{
|
|
1155
1668
|
type: VirtualDomElements.Div,
|
|
@@ -1210,61 +1723,34 @@ const saveState = state => {
|
|
|
1210
1723
|
};
|
|
1211
1724
|
};
|
|
1212
1725
|
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
'Problems.diff2': diff2,
|
|
1216
|
-
'Problems.focusIndex': wrapCommand(focusIndex),
|
|
1217
|
-
'Problems.getCommandIds': getCommandIds,
|
|
1218
|
-
'Problems.getKeyBindings': getKeyBindings,
|
|
1219
|
-
'Problems.initialize': initialize,
|
|
1220
|
-
'Problems.loadContent': wrapCommand(loadContent),
|
|
1221
|
-
'Problems.render2': render2,
|
|
1222
|
-
'Problems.renderActions': renderActions,
|
|
1223
|
-
'Problems.renderEventListeners': renderEventListeners,
|
|
1224
|
-
'Problems.resize': resize,
|
|
1225
|
-
'Problems.saveState': saveState,
|
|
1226
|
-
'Problems.terminate': terminate
|
|
1227
|
-
};
|
|
1228
|
-
|
|
1229
|
-
const rpcs = Object.create(null);
|
|
1230
|
-
const set$g = (id, rpc) => {
|
|
1231
|
-
rpcs[id] = rpc;
|
|
1232
|
-
};
|
|
1233
|
-
const get = id => {
|
|
1234
|
-
return rpcs[id];
|
|
1235
|
-
};
|
|
1236
|
-
|
|
1237
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1238
|
-
|
|
1239
|
-
const create = rpcId => {
|
|
1726
|
+
const setOutputChannel = async state => {
|
|
1727
|
+
// TODO
|
|
1240
1728
|
return {
|
|
1241
|
-
|
|
1242
|
-
invoke(method, ...params) {
|
|
1243
|
-
const rpc = get(rpcId);
|
|
1244
|
-
// @ts-ignore
|
|
1245
|
-
return rpc.invoke(method, ...params);
|
|
1246
|
-
},
|
|
1247
|
-
// @ts-ignore
|
|
1248
|
-
invokeAndTransfer(method, ...params) {
|
|
1249
|
-
const rpc = get(rpcId);
|
|
1250
|
-
// @ts-ignore
|
|
1251
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1252
|
-
},
|
|
1253
|
-
set(rpc) {
|
|
1254
|
-
set$g(rpcId, rpc);
|
|
1255
|
-
},
|
|
1256
|
-
async dispose() {
|
|
1257
|
-
const rpc = get(rpcId);
|
|
1258
|
-
await rpc.dispose();
|
|
1259
|
-
}
|
|
1729
|
+
...state
|
|
1260
1730
|
};
|
|
1261
1731
|
};
|
|
1262
|
-
|
|
1263
|
-
const {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1732
|
+
|
|
1733
|
+
const commandMap = {
|
|
1734
|
+
'Output.closeFindWidget': closeFindWidget,
|
|
1735
|
+
'Output.create': create$1,
|
|
1736
|
+
'Output.diff2': diff2,
|
|
1737
|
+
'Output.focusIndex': wrapCommand(focusIndex),
|
|
1738
|
+
'Output.getCommandIds': getCommandIds,
|
|
1739
|
+
'Output.getKeyBindings': getKeyBindings$1,
|
|
1740
|
+
'Output.handleData': handleData,
|
|
1741
|
+
'Output.handleError': handleError,
|
|
1742
|
+
'Output.initialize': initialize,
|
|
1743
|
+
'Output.loadContent2': wrapCommand(loadContent),
|
|
1744
|
+
'Output.openFindWidget': openFindWidget,
|
|
1745
|
+
'Output.render2': render2,
|
|
1746
|
+
'Output.renderActions': renderActions,
|
|
1747
|
+
'Output.renderEventListeners': renderEventListeners,
|
|
1748
|
+
'Output.resize': resize,
|
|
1749
|
+
'Output.saveState': saveState,
|
|
1750
|
+
'Output.setOutputChannel': setOutputChannel,
|
|
1751
|
+
'Output.getActions': getActions,
|
|
1752
|
+
'Output.terminate': terminate
|
|
1753
|
+
};
|
|
1268
1754
|
|
|
1269
1755
|
const {
|
|
1270
1756
|
set} = RendererWorker;
|