@lvce-editor/editor-worker 7.21.0 → 8.1.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/editorWorkerMain.js +494 -358
- package/package.json +5 -2
package/dist/editorWorkerMain.js
CHANGED
|
@@ -539,7 +539,7 @@ const create$4$2 = (method, params) => {
|
|
|
539
539
|
};
|
|
540
540
|
};
|
|
541
541
|
const callbacks = Object.create(null);
|
|
542
|
-
const set$
|
|
542
|
+
const set$d = (id, fn) => {
|
|
543
543
|
callbacks[id] = fn;
|
|
544
544
|
};
|
|
545
545
|
const get$7 = id => {
|
|
@@ -558,7 +558,7 @@ const registerPromise = () => {
|
|
|
558
558
|
resolve,
|
|
559
559
|
promise
|
|
560
560
|
} = Promise.withResolvers();
|
|
561
|
-
set$
|
|
561
|
+
set$d(id, resolve);
|
|
562
562
|
return {
|
|
563
563
|
id,
|
|
564
564
|
promise
|
|
@@ -903,10 +903,10 @@ const send = (transport, method, ...params) => {
|
|
|
903
903
|
const message = create$4$2(method, params);
|
|
904
904
|
transport.send(message);
|
|
905
905
|
};
|
|
906
|
-
const invoke$
|
|
906
|
+
const invoke$c = (ipc, method, ...params) => {
|
|
907
907
|
return invokeHelper(ipc, method, params, false);
|
|
908
908
|
};
|
|
909
|
-
const invokeAndTransfer$
|
|
909
|
+
const invokeAndTransfer$4 = (ipc, method, ...params) => {
|
|
910
910
|
return invokeHelper(ipc, method, params, true);
|
|
911
911
|
};
|
|
912
912
|
|
|
@@ -942,10 +942,10 @@ const createRpc = ipc => {
|
|
|
942
942
|
send(ipc, method, ...params);
|
|
943
943
|
},
|
|
944
944
|
invoke(method, ...params) {
|
|
945
|
-
return invoke$
|
|
945
|
+
return invoke$c(ipc, method, ...params);
|
|
946
946
|
},
|
|
947
947
|
invokeAndTransfer(method, ...params) {
|
|
948
|
-
return invokeAndTransfer$
|
|
948
|
+
return invokeAndTransfer$4(ipc, method, ...params);
|
|
949
949
|
},
|
|
950
950
|
async dispose() {
|
|
951
951
|
await ipc?.dispose();
|
|
@@ -1046,17 +1046,46 @@ const WebWorkerRpcClient = {
|
|
|
1046
1046
|
__proto__: null,
|
|
1047
1047
|
create: create$a
|
|
1048
1048
|
};
|
|
1049
|
+
const createMockRpc = ({
|
|
1050
|
+
commandMap
|
|
1051
|
+
}) => {
|
|
1052
|
+
const invocations = [];
|
|
1053
|
+
const invoke = (method, ...params) => {
|
|
1054
|
+
invocations.push([method, ...params]);
|
|
1055
|
+
const command = commandMap[method];
|
|
1056
|
+
return command(...params);
|
|
1057
|
+
};
|
|
1058
|
+
const mockRpc = {
|
|
1059
|
+
invoke,
|
|
1060
|
+
invokeAndTransfer: invoke,
|
|
1061
|
+
invocations
|
|
1062
|
+
};
|
|
1063
|
+
return mockRpc;
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
const DebugWorker = 55;
|
|
1067
|
+
const EditorWorker = 99;
|
|
1068
|
+
const ExtensionHostWorker = 44;
|
|
1069
|
+
const MarkdownWorker = 300;
|
|
1070
|
+
const RendererWorker$1 = 1;
|
|
1071
|
+
|
|
1072
|
+
const CodeGenerator = 1;
|
|
1073
|
+
const ColorPicker$1 = 2;
|
|
1074
|
+
const Completion = 3;
|
|
1075
|
+
const CompletionDetail = 4;
|
|
1076
|
+
const Find = 5;
|
|
1077
|
+
const Hover = 6;
|
|
1078
|
+
const Rename$1 = 7;
|
|
1079
|
+
const SourceAction$1 = 8;
|
|
1049
1080
|
|
|
1050
1081
|
const rpcs = Object.create(null);
|
|
1051
|
-
const set$
|
|
1082
|
+
const set$c = (id, rpc) => {
|
|
1052
1083
|
rpcs[id] = rpc;
|
|
1053
1084
|
};
|
|
1054
1085
|
const get$6 = id => {
|
|
1055
1086
|
return rpcs[id];
|
|
1056
1087
|
};
|
|
1057
1088
|
|
|
1058
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1059
|
-
|
|
1060
1089
|
const create$9 = rpcId => {
|
|
1061
1090
|
return {
|
|
1062
1091
|
// @ts-ignore
|
|
@@ -1072,7 +1101,7 @@ const create$9 = rpcId => {
|
|
|
1072
1101
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1073
1102
|
},
|
|
1074
1103
|
set(rpc) {
|
|
1075
|
-
set$
|
|
1104
|
+
set$c(rpcId, rpc);
|
|
1076
1105
|
},
|
|
1077
1106
|
async dispose() {
|
|
1078
1107
|
const rpc = get$6(rpcId);
|
|
@@ -1080,85 +1109,407 @@ const create$9 = rpcId => {
|
|
|
1080
1109
|
}
|
|
1081
1110
|
};
|
|
1082
1111
|
};
|
|
1083
|
-
|
|
1084
|
-
const ClipBoardWorker$1 = 3400;
|
|
1085
|
-
const ColorPickerWorker = 302;
|
|
1086
|
-
const CompletionWorker = 301;
|
|
1087
|
-
const DebugWorker$1 = 55;
|
|
1088
|
-
const EditorWorker$1 = 99;
|
|
1089
|
-
const EmbedsProcess$1 = 207;
|
|
1090
|
-
const EmbedsWorker = 208;
|
|
1091
|
-
const ErrorWorker$1 = 3308;
|
|
1092
|
-
const ExtensionDetailWorker = 3402;
|
|
1093
|
-
const ExtensionHostWorker = 44;
|
|
1094
|
-
const FileSystemProcess$1 = 210;
|
|
1095
|
-
const FileSystemWorker$1 = 209;
|
|
1096
|
-
const MainProcess$1 = -5;
|
|
1097
|
-
const MarkdownWorker$1 = 300;
|
|
1098
|
-
const OutputWorker = 7001;
|
|
1099
|
-
const ProblemsWorker = 3403;
|
|
1100
|
-
const RendererProcess$1 = 1670;
|
|
1101
|
-
const RendererWorker$1 = 1;
|
|
1102
|
-
const SearchProcess$1 = 77;
|
|
1103
|
-
const SearchProcessElectron = 2;
|
|
1104
|
-
const SharedProcess$1 = 1;
|
|
1105
|
-
const SourceActionWorker = 303;
|
|
1106
|
-
const SourceControlWorker = 66;
|
|
1107
|
-
const SyntaxHighlightingWorker$1 = 3309;
|
|
1108
|
-
const TestWorker = 9001;
|
|
1109
|
-
const RpcId = {
|
|
1110
|
-
__proto__: null,
|
|
1111
|
-
ClipBoardProcess: ClipBoardProcess$1,
|
|
1112
|
-
ClipBoardWorker: ClipBoardWorker$1,
|
|
1113
|
-
ColorPickerWorker,
|
|
1114
|
-
CompletionWorker,
|
|
1115
|
-
DebugWorker: DebugWorker$1,
|
|
1116
|
-
EditorWorker: EditorWorker$1,
|
|
1117
|
-
EmbedsProcess: EmbedsProcess$1,
|
|
1118
|
-
EmbedsWorker,
|
|
1119
|
-
ErrorWorker: ErrorWorker$1,
|
|
1120
|
-
ExtensionDetailWorker,
|
|
1121
|
-
ExtensionHostWorker,
|
|
1122
|
-
FileSystemProcess: FileSystemProcess$1,
|
|
1123
|
-
FileSystemWorker: FileSystemWorker$1,
|
|
1124
|
-
MainProcess: MainProcess$1,
|
|
1125
|
-
MarkdownWorker: MarkdownWorker$1,
|
|
1126
|
-
OutputWorker,
|
|
1127
|
-
ProblemsWorker,
|
|
1128
|
-
RendererProcess: RendererProcess$1,
|
|
1129
|
-
RendererWorker: RendererWorker$1,
|
|
1130
|
-
SearchProcess: SearchProcess$1,
|
|
1131
|
-
SearchProcessElectron,
|
|
1132
|
-
SharedProcess: SharedProcess$1,
|
|
1133
|
-
SourceActionWorker,
|
|
1134
|
-
SourceControlWorker,
|
|
1135
|
-
SyntaxHighlightingWorker: SyntaxHighlightingWorker$1,
|
|
1136
|
-
TestWorker
|
|
1137
|
-
};
|
|
1112
|
+
|
|
1138
1113
|
const {
|
|
1139
|
-
invoke: invoke$
|
|
1140
|
-
|
|
1114
|
+
invoke: invoke$b,
|
|
1115
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1116
|
+
set: set$b,
|
|
1117
|
+
dispose: dispose$2
|
|
1118
|
+
} = create$9(ExtensionHostWorker);
|
|
1119
|
+
const executeReferenceProvider = async (id, offset) => {
|
|
1120
|
+
// @ts-ignore
|
|
1121
|
+
return invoke$b('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
1122
|
+
};
|
|
1123
|
+
const executeFileReferenceProvider = async id => {
|
|
1124
|
+
// @ts-ignore
|
|
1125
|
+
return invoke$b('ExtensionHostReference.executeFileReferenceProvider', id);
|
|
1126
|
+
};
|
|
1127
|
+
const getRuntimeStatus = async extensionId => {
|
|
1128
|
+
// @ts-ignore
|
|
1129
|
+
return invoke$b('ExtensionHost.getRuntimeStatus', extensionId);
|
|
1130
|
+
};
|
|
1131
|
+
const registerMockRpc$1 = commandMap => {
|
|
1132
|
+
const mockRpc = createMockRpc({
|
|
1133
|
+
commandMap
|
|
1134
|
+
});
|
|
1135
|
+
set$b(mockRpc);
|
|
1136
|
+
return mockRpc;
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1141
1139
|
const ExtensionHost = {
|
|
1142
1140
|
__proto__: null,
|
|
1143
|
-
|
|
1144
|
-
|
|
1141
|
+
dispose: dispose$2,
|
|
1142
|
+
executeFileReferenceProvider,
|
|
1143
|
+
executeReferenceProvider,
|
|
1144
|
+
getRuntimeStatus,
|
|
1145
|
+
invoke: invoke$b,
|
|
1146
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1147
|
+
registerMockRpc: registerMockRpc$1,
|
|
1148
|
+
set: set$b
|
|
1145
1149
|
};
|
|
1150
|
+
|
|
1146
1151
|
const {
|
|
1147
|
-
invoke: invoke$
|
|
1148
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1149
|
-
set: set$
|
|
1152
|
+
invoke: invoke$a,
|
|
1153
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1154
|
+
set: set$a,
|
|
1155
|
+
dispose: dispose$1
|
|
1156
|
+
} = create$9(RendererWorker$1);
|
|
1157
|
+
const searchFileHtml = async uri => {
|
|
1158
|
+
return invoke$a('ExtensionHost.searchFileWithHtml', uri);
|
|
1159
|
+
};
|
|
1160
|
+
const getFilePathElectron = async file => {
|
|
1161
|
+
return invoke$a('FileSystemHandle.getFilePathElectron', file);
|
|
1162
|
+
};
|
|
1163
|
+
const showContextMenu = async (x, y, id, ...args) => {
|
|
1164
|
+
return invoke$a('ContextMenu.show', x, y, id, ...args);
|
|
1165
|
+
};
|
|
1166
|
+
const getElectronVersion = async () => {
|
|
1167
|
+
return invoke$a('Process.getElectronVersion');
|
|
1168
|
+
};
|
|
1169
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
1170
|
+
await invoke$a('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1171
|
+
};
|
|
1172
|
+
const setColorTheme = async id => {
|
|
1173
|
+
// @ts-ignore
|
|
1174
|
+
return invoke$a(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1175
|
+
};
|
|
1176
|
+
const getNodeVersion = async () => {
|
|
1177
|
+
return invoke$a('Process.getNodeVersion');
|
|
1178
|
+
};
|
|
1179
|
+
const getChromeVersion = async () => {
|
|
1180
|
+
return invoke$a('Process.getChromeVersion');
|
|
1181
|
+
};
|
|
1182
|
+
const getV8Version = async () => {
|
|
1183
|
+
return invoke$a('Process.getV8Version');
|
|
1184
|
+
};
|
|
1185
|
+
const getFileHandles = async fileIds => {
|
|
1186
|
+
const files = await invoke$a('FileSystemHandle.getFileHandles', fileIds);
|
|
1187
|
+
return files;
|
|
1188
|
+
};
|
|
1189
|
+
const setWorkspacePath = async path => {
|
|
1190
|
+
await invoke$a('Workspace.setPath', path);
|
|
1191
|
+
};
|
|
1192
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
1193
|
+
await invokeAndTransfer$2('WebView.registerInterceptor', id, port);
|
|
1194
|
+
};
|
|
1195
|
+
const unregisterWebViewInterceptor = async id => {
|
|
1196
|
+
await invoke$a('WebView.unregisterInterceptor', id);
|
|
1197
|
+
};
|
|
1198
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1199
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1200
|
+
// @ts-ignore
|
|
1201
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1202
|
+
};
|
|
1203
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1204
|
+
const command = 'Errors.handleMessagePort';
|
|
1205
|
+
// @ts-ignore
|
|
1206
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1207
|
+
};
|
|
1208
|
+
const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
|
|
1209
|
+
const command = 'Markdown.handleMessagePort';
|
|
1210
|
+
// @ts-ignore
|
|
1211
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1212
|
+
};
|
|
1213
|
+
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1214
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1215
|
+
// @ts-ignore
|
|
1216
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1217
|
+
};
|
|
1218
|
+
const readFile = async uri => {
|
|
1219
|
+
return invoke$a('FileSystem.readFile', uri);
|
|
1220
|
+
};
|
|
1221
|
+
const getWebViewSecret = async key => {
|
|
1222
|
+
// @ts-ignore
|
|
1223
|
+
return invoke$a('WebView.getSecret', key);
|
|
1224
|
+
};
|
|
1225
|
+
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1226
|
+
return invokeAndTransfer$2('WebView.setPort', uid, port, origin, portType);
|
|
1227
|
+
};
|
|
1228
|
+
const setFocus$1 = key => {
|
|
1229
|
+
return invoke$a('Focus.setFocus', key);
|
|
1230
|
+
};
|
|
1231
|
+
const getFileIcon = async options => {
|
|
1232
|
+
return invoke$a('IconTheme.getFileIcon', options);
|
|
1233
|
+
};
|
|
1234
|
+
const getColorThemeNames = async () => {
|
|
1235
|
+
return invoke$a('ColorTheme.getColorThemeNames');
|
|
1236
|
+
};
|
|
1237
|
+
const disableExtension = async id => {
|
|
1238
|
+
// @ts-ignore
|
|
1239
|
+
return invoke$a('ExtensionManagement.disable', id);
|
|
1240
|
+
};
|
|
1241
|
+
const enableExtension = async id => {
|
|
1242
|
+
// @ts-ignore
|
|
1243
|
+
return invoke$a('ExtensionManagement.enable', id);
|
|
1244
|
+
};
|
|
1245
|
+
const handleDebugChange = async params => {
|
|
1246
|
+
// @ts-ignore
|
|
1247
|
+
return invoke$a('Run And Debug.handleChange', params);
|
|
1248
|
+
};
|
|
1249
|
+
const getFolderIcon = async options => {
|
|
1250
|
+
return invoke$a('IconTheme.getFolderIcon', options);
|
|
1251
|
+
};
|
|
1252
|
+
const closeWidget = async widgetId => {
|
|
1253
|
+
return invoke$a('Viewlet.closeWidget', widgetId);
|
|
1254
|
+
};
|
|
1255
|
+
const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
|
|
1256
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1257
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1258
|
+
};
|
|
1259
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
1260
|
+
await invokeAndTransfer$2('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1261
|
+
};
|
|
1262
|
+
const confirm = async (message, options) => {
|
|
1263
|
+
// @ts-ignore
|
|
1264
|
+
const result = await invoke$a('ConfirmPrompt.prompt', message, options);
|
|
1265
|
+
return result;
|
|
1266
|
+
};
|
|
1267
|
+
const getRecentlyOpened = async () => {
|
|
1268
|
+
return invoke$a(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1269
|
+
};
|
|
1270
|
+
const getKeyBindings$1 = async () => {
|
|
1271
|
+
return invoke$a('KeyBindingsInitial.getKeyBindings');
|
|
1272
|
+
};
|
|
1273
|
+
const writeClipBoardText = async text => {
|
|
1274
|
+
await invoke$a('ClipBoard.writeText', /* text */text);
|
|
1275
|
+
};
|
|
1276
|
+
const writeClipBoardImage = async blob => {
|
|
1277
|
+
// @ts-ignore
|
|
1278
|
+
await invoke$a('ClipBoard.writeImage', /* text */blob);
|
|
1279
|
+
};
|
|
1280
|
+
const searchFileMemory = async uri => {
|
|
1281
|
+
// @ts-ignore
|
|
1282
|
+
return invoke$a('ExtensionHost.searchFileWithMemory', uri);
|
|
1283
|
+
};
|
|
1284
|
+
const searchFileFetch = async uri => {
|
|
1285
|
+
return invoke$a('ExtensionHost.searchFileWithFetch', uri);
|
|
1286
|
+
};
|
|
1287
|
+
const showMessageBox = async options => {
|
|
1288
|
+
return invoke$a('ElectronDialog.showMessageBox', options);
|
|
1289
|
+
};
|
|
1290
|
+
const handleDebugResumed = async params => {
|
|
1291
|
+
await invoke$a('Run And Debug.handleResumed', params);
|
|
1292
|
+
};
|
|
1293
|
+
const openWidget = async name => {
|
|
1294
|
+
await invoke$a('Viewlet.openWidget', name);
|
|
1295
|
+
};
|
|
1296
|
+
const getIcons = async requests => {
|
|
1297
|
+
const icons = await invoke$a('IconTheme.getIcons', requests);
|
|
1298
|
+
return icons;
|
|
1299
|
+
};
|
|
1300
|
+
const activateByEvent$1 = event => {
|
|
1301
|
+
return invoke$a('ExtensionHostManagement.activateByEvent', event);
|
|
1302
|
+
};
|
|
1303
|
+
const setAdditionalFocus$1 = focusKey => {
|
|
1304
|
+
// @ts-ignore
|
|
1305
|
+
return invoke$a('Focus.setAdditionalFocus', focusKey);
|
|
1306
|
+
};
|
|
1307
|
+
const getActiveEditorId = () => {
|
|
1308
|
+
// @ts-ignore
|
|
1309
|
+
return invoke$a('GetActiveEditor.getActiveEditorId');
|
|
1310
|
+
};
|
|
1311
|
+
const getWorkspacePath = () => {
|
|
1312
|
+
return invoke$a('Workspace.getPath');
|
|
1313
|
+
};
|
|
1314
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
1315
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1316
|
+
// @ts-ignore
|
|
1317
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
1318
|
+
};
|
|
1319
|
+
const getPreference = async key => {
|
|
1320
|
+
return await invoke$a('Preferences.get', key);
|
|
1321
|
+
};
|
|
1322
|
+
const getAllExtensions = async () => {
|
|
1323
|
+
return invoke$a('ExtensionManagement.getAllExtensions');
|
|
1324
|
+
};
|
|
1325
|
+
const rerenderEditor = async key => {
|
|
1326
|
+
// @ts-ignore
|
|
1327
|
+
return invoke$a('Editor.rerender', key);
|
|
1328
|
+
};
|
|
1329
|
+
const handleDebugPaused = async params => {
|
|
1330
|
+
await invoke$a('Run And Debug.handlePaused', params);
|
|
1331
|
+
};
|
|
1332
|
+
const openUri = async (uri, focus, options) => {
|
|
1333
|
+
await invoke$a('Main.openUri', uri, focus, options);
|
|
1334
|
+
};
|
|
1335
|
+
const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
|
|
1336
|
+
await invokeAndTransfer$2(
|
|
1337
|
+
// @ts-ignore
|
|
1338
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1339
|
+
};
|
|
1340
|
+
const handleDebugScriptParsed = async script => {
|
|
1341
|
+
await invoke$a('Run And Debug.handleScriptParsed', script);
|
|
1342
|
+
};
|
|
1343
|
+
const getWindowId = async () => {
|
|
1344
|
+
return invoke$a('GetWindowId.getWindowId');
|
|
1345
|
+
};
|
|
1346
|
+
const getBlob = async uri => {
|
|
1347
|
+
// @ts-ignore
|
|
1348
|
+
return invoke$a('FileSystem.getBlob', uri);
|
|
1349
|
+
};
|
|
1350
|
+
const getExtensionCommands = async () => {
|
|
1351
|
+
return invoke$a('ExtensionHost.getCommands');
|
|
1352
|
+
};
|
|
1353
|
+
const showErrorDialog = async errorInfo => {
|
|
1354
|
+
// @ts-ignore
|
|
1355
|
+
await invoke$a('ErrorHandling.showErrorDialog', errorInfo);
|
|
1356
|
+
};
|
|
1357
|
+
const getFolderSize = async uri => {
|
|
1358
|
+
// @ts-ignore
|
|
1359
|
+
return await invoke$a('FileSystem.getFolderSize', uri);
|
|
1360
|
+
};
|
|
1361
|
+
const getExtension = async id => {
|
|
1362
|
+
// @ts-ignore
|
|
1363
|
+
return invoke$a('ExtensionManagement.getExtension', id);
|
|
1364
|
+
};
|
|
1365
|
+
const getMarkdownDom = async html => {
|
|
1366
|
+
// @ts-ignore
|
|
1367
|
+
return invoke$a('Markdown.getVirtualDom', html);
|
|
1368
|
+
};
|
|
1369
|
+
const renderMarkdown = async (markdown, options) => {
|
|
1370
|
+
// @ts-ignore
|
|
1371
|
+
return invoke$a('Markdown.renderMarkdown', markdown, options);
|
|
1372
|
+
};
|
|
1373
|
+
const openNativeFolder = async uri => {
|
|
1374
|
+
// @ts-ignore
|
|
1375
|
+
await invoke$a('OpenNativeFolder.openNativeFolder', uri);
|
|
1376
|
+
};
|
|
1377
|
+
const uninstallExtension = async id => {
|
|
1378
|
+
return invoke$a('ExtensionManagement.uninstall', id);
|
|
1379
|
+
};
|
|
1380
|
+
const installExtension = async id => {
|
|
1381
|
+
// @ts-ignore
|
|
1382
|
+
return invoke$a('ExtensionManagement.install', id);
|
|
1383
|
+
};
|
|
1384
|
+
const openExtensionSearch = async () => {
|
|
1385
|
+
// @ts-ignore
|
|
1386
|
+
return invoke$a('SideBar.openViewlet', 'Extensions');
|
|
1387
|
+
};
|
|
1388
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
1389
|
+
// @ts-ignore
|
|
1390
|
+
return invoke$a('Extensions.handleInput', searchValue);
|
|
1391
|
+
};
|
|
1392
|
+
const openExternal = async uri => {
|
|
1393
|
+
// @ts-ignore
|
|
1394
|
+
await invoke$a('Open.openExternal', uri);
|
|
1395
|
+
};
|
|
1396
|
+
const openUrl = async uri => {
|
|
1397
|
+
// @ts-ignore
|
|
1398
|
+
await invoke$a('Open.openUrl', uri);
|
|
1399
|
+
};
|
|
1400
|
+
const getAllPreferences = async () => {
|
|
1401
|
+
// @ts-ignore
|
|
1402
|
+
return invoke$a('Preferences.getAll');
|
|
1403
|
+
};
|
|
1404
|
+
const showSaveFilePicker = async () => {
|
|
1405
|
+
// @ts-ignore
|
|
1406
|
+
return invoke$a('FilePicker.showSaveFilePicker');
|
|
1407
|
+
};
|
|
1408
|
+
const getLogsDir = async () => {
|
|
1409
|
+
// @ts-ignore
|
|
1410
|
+
return invoke$a('PlatformPaths.getLogsDir');
|
|
1411
|
+
};
|
|
1412
|
+
const registerMockRpc = commandMap => {
|
|
1413
|
+
const mockRpc = createMockRpc({
|
|
1414
|
+
commandMap
|
|
1415
|
+
});
|
|
1416
|
+
set$a(mockRpc);
|
|
1417
|
+
return mockRpc;
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1150
1420
|
const RendererWorker = {
|
|
1151
1421
|
__proto__: null,
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1422
|
+
activateByEvent: activateByEvent$1,
|
|
1423
|
+
applyBulkReplacement,
|
|
1424
|
+
closeWidget,
|
|
1425
|
+
confirm,
|
|
1426
|
+
disableExtension,
|
|
1427
|
+
dispose: dispose$1,
|
|
1428
|
+
enableExtension,
|
|
1429
|
+
getActiveEditorId,
|
|
1430
|
+
getAllExtensions,
|
|
1431
|
+
getAllPreferences,
|
|
1432
|
+
getBlob,
|
|
1433
|
+
getChromeVersion,
|
|
1434
|
+
getColorThemeNames,
|
|
1435
|
+
getElectronVersion,
|
|
1436
|
+
getExtension,
|
|
1437
|
+
getExtensionCommands,
|
|
1438
|
+
getFileHandles,
|
|
1439
|
+
getFileIcon,
|
|
1440
|
+
getFilePathElectron,
|
|
1441
|
+
getFolderIcon,
|
|
1442
|
+
getFolderSize,
|
|
1443
|
+
getIcons,
|
|
1444
|
+
getKeyBindings: getKeyBindings$1,
|
|
1445
|
+
getLogsDir,
|
|
1446
|
+
getMarkdownDom,
|
|
1447
|
+
getNodeVersion,
|
|
1448
|
+
getPreference,
|
|
1449
|
+
getRecentlyOpened,
|
|
1450
|
+
getV8Version,
|
|
1451
|
+
getWebViewSecret,
|
|
1452
|
+
getWindowId,
|
|
1453
|
+
getWorkspacePath,
|
|
1454
|
+
handleDebugChange,
|
|
1455
|
+
handleDebugPaused,
|
|
1456
|
+
handleDebugResumed,
|
|
1457
|
+
handleDebugScriptParsed,
|
|
1458
|
+
installExtension,
|
|
1156
1459
|
invoke: invoke$a,
|
|
1157
|
-
|
|
1460
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1461
|
+
openExtensionSearch,
|
|
1462
|
+
openExternal,
|
|
1463
|
+
openNativeFolder,
|
|
1464
|
+
openUri,
|
|
1465
|
+
openUrl,
|
|
1466
|
+
openWidget,
|
|
1467
|
+
readFile,
|
|
1468
|
+
registerMockRpc,
|
|
1469
|
+
registerWebViewInterceptor,
|
|
1470
|
+
renderMarkdown,
|
|
1471
|
+
rerenderEditor,
|
|
1472
|
+
searchFileFetch,
|
|
1473
|
+
searchFileHtml,
|
|
1474
|
+
searchFileMemory,
|
|
1475
|
+
sendMessagePortToEditorWorker,
|
|
1476
|
+
sendMessagePortToErrorWorker,
|
|
1477
|
+
sendMessagePortToExtensionHostWorker,
|
|
1478
|
+
sendMessagePortToFileSystemWorker,
|
|
1479
|
+
sendMessagePortToMarkdownWorker,
|
|
1480
|
+
sendMessagePortToRendererProcess,
|
|
1481
|
+
sendMessagePortToSearchProcess,
|
|
1482
|
+
sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
|
|
1483
|
+
set: set$a,
|
|
1484
|
+
setAdditionalFocus: setAdditionalFocus$1,
|
|
1485
|
+
setColorTheme,
|
|
1486
|
+
setExtensionsSearchValue,
|
|
1487
|
+
setFocus: setFocus$1,
|
|
1488
|
+
setWebViewPort,
|
|
1489
|
+
setWorkspacePath,
|
|
1490
|
+
showContextMenu,
|
|
1491
|
+
showErrorDialog,
|
|
1492
|
+
showMessageBox,
|
|
1493
|
+
showSaveFilePicker,
|
|
1494
|
+
uninstallExtension,
|
|
1495
|
+
unregisterWebViewInterceptor,
|
|
1496
|
+
writeClipBoardImage,
|
|
1497
|
+
writeClipBoardText
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1500
|
+
const {
|
|
1501
|
+
invoke: invoke$9,
|
|
1502
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1503
|
+
set: set$9,
|
|
1504
|
+
dispose
|
|
1505
|
+
} = create$9(MarkdownWorker);
|
|
1506
|
+
|
|
1158
1507
|
const SyntaxHighlightingWorker = {
|
|
1159
1508
|
__proto__: null,
|
|
1160
|
-
|
|
1161
|
-
|
|
1509
|
+
dispose,
|
|
1510
|
+
invoke: invoke$9,
|
|
1511
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1512
|
+
set: set$9
|
|
1162
1513
|
};
|
|
1163
1514
|
|
|
1164
1515
|
const {
|
|
@@ -1267,7 +1618,7 @@ const IndentLess = 'indentLess';
|
|
|
1267
1618
|
const IndentMore = 'indentMore';
|
|
1268
1619
|
const InsertLineBreak = 'insertLineBreak';
|
|
1269
1620
|
const LineComment = 'lineComment';
|
|
1270
|
-
const Rename
|
|
1621
|
+
const Rename = 'rename';
|
|
1271
1622
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1272
1623
|
|
|
1273
1624
|
const map$1 = Object.create(null);
|
|
@@ -2188,7 +2539,7 @@ const {
|
|
|
2188
2539
|
set: set$5,
|
|
2189
2540
|
invoke: invoke$6} = ExtensionHost;
|
|
2190
2541
|
|
|
2191
|
-
const ColorPicker
|
|
2542
|
+
const ColorPicker = 41;
|
|
2192
2543
|
const EditorCompletion = 9;
|
|
2193
2544
|
const Empty = 0;
|
|
2194
2545
|
const FindWidget = 16;
|
|
@@ -2573,7 +2924,7 @@ const getTextChanges = (editor, changes) => {
|
|
|
2573
2924
|
end: endPosition,
|
|
2574
2925
|
inserted: [edit.inserted],
|
|
2575
2926
|
deleted,
|
|
2576
|
-
origin: Rename
|
|
2927
|
+
origin: Rename
|
|
2577
2928
|
};
|
|
2578
2929
|
textChanges.push(textChange);
|
|
2579
2930
|
}
|
|
@@ -2941,15 +3292,6 @@ const removeEditorWidget = (widgets, id) => {
|
|
|
2941
3292
|
return newWidgets;
|
|
2942
3293
|
};
|
|
2943
3294
|
|
|
2944
|
-
const CodeGenerator = 1;
|
|
2945
|
-
const ColorPicker = 2;
|
|
2946
|
-
const Completion = 3;
|
|
2947
|
-
const CompletionDetail = 4;
|
|
2948
|
-
const Find = 5;
|
|
2949
|
-
const Hover = 6;
|
|
2950
|
-
const Rename = 7;
|
|
2951
|
-
const SourceAction$1 = 8;
|
|
2952
|
-
|
|
2953
3295
|
const isMatchingWidget$2 = widget => {
|
|
2954
3296
|
return widget.id === CodeGenerator;
|
|
2955
3297
|
};
|
|
@@ -3010,7 +3352,7 @@ const invoke$5 = async (method, ...params) => {
|
|
|
3010
3352
|
|
|
3011
3353
|
// TODO duplicate code
|
|
3012
3354
|
const isRenameWidget = widget => {
|
|
3013
|
-
return widget.id === Rename;
|
|
3355
|
+
return widget.id === Rename$1;
|
|
3014
3356
|
};
|
|
3015
3357
|
const closeRename = async editor => {
|
|
3016
3358
|
const {
|
|
@@ -3113,7 +3455,7 @@ const create$7 = () => {
|
|
|
3113
3455
|
const create$6 = () => {
|
|
3114
3456
|
const completionUid = create$7();
|
|
3115
3457
|
const widget = {
|
|
3116
|
-
id: ColorPicker,
|
|
3458
|
+
id: ColorPicker$1,
|
|
3117
3459
|
oldState: {
|
|
3118
3460
|
uid: completionUid,
|
|
3119
3461
|
x: 0,
|
|
@@ -3138,7 +3480,7 @@ const newStateGenerator$6 = (state, parentUid) => {
|
|
|
3138
3480
|
return loadContent$2(state, parentUid);
|
|
3139
3481
|
};
|
|
3140
3482
|
const openColorPicker = async editor => {
|
|
3141
|
-
return addWidgetToEditor(ColorPicker, ColorPicker
|
|
3483
|
+
return addWidgetToEditor(ColorPicker$1, ColorPicker, editor, create$6, newStateGenerator$6);
|
|
3142
3484
|
};
|
|
3143
3485
|
|
|
3144
3486
|
const state$6 = {
|
|
@@ -3957,7 +4299,6 @@ const EscapeToClose = 'Escape to close';
|
|
|
3957
4299
|
const FormatDocument = 'Format Document';
|
|
3958
4300
|
const MoveLineDown = 'Move Line Down';
|
|
3959
4301
|
const MoveLineUp = 'Move Line Up';
|
|
3960
|
-
const NoCodeActionsAvailable = 'No code actions available';
|
|
3961
4302
|
const NoDefinitionFound = 'No definition found';
|
|
3962
4303
|
const NoDefinitionFoundFor = "No definition found for '{PH1}'";
|
|
3963
4304
|
const NoTypeDefinitionFound = 'No type definition found';
|
|
@@ -3984,9 +4325,6 @@ const noTypeDefinitionFound = () => {
|
|
|
3984
4325
|
const sourceAction = () => {
|
|
3985
4326
|
return i18nString(SourceAction);
|
|
3986
4327
|
};
|
|
3987
|
-
const noCodeActionsAvailable = () => {
|
|
3988
|
-
return i18nString(NoCodeActionsAvailable);
|
|
3989
|
-
};
|
|
3990
4328
|
const escapeToClose = () => {
|
|
3991
4329
|
return i18nString(EscapeToClose);
|
|
3992
4330
|
};
|
|
@@ -5388,7 +5726,7 @@ const newStateGenerator$3 = (state, parentUid) => {
|
|
|
5388
5726
|
};
|
|
5389
5727
|
const openFind2 = async editor => {
|
|
5390
5728
|
const fullFocus = true;
|
|
5391
|
-
return addWidgetToEditor(ColorPicker, FindWidget, editor, create$3, newStateGenerator$3, fullFocus);
|
|
5729
|
+
return addWidgetToEditor(ColorPicker$1, FindWidget, editor, create$3, newStateGenerator$3, fullFocus);
|
|
5392
5730
|
};
|
|
5393
5731
|
|
|
5394
5732
|
const openFind = async state => {
|
|
@@ -5414,7 +5752,7 @@ const getPositionAtCursor$1 = editor => {
|
|
|
5414
5752
|
const create$2 = () => {
|
|
5415
5753
|
const completionUid = create$7();
|
|
5416
5754
|
const renameWidget = {
|
|
5417
|
-
id: Rename,
|
|
5755
|
+
id: Rename$1,
|
|
5418
5756
|
oldState: {
|
|
5419
5757
|
uid: completionUid,
|
|
5420
5758
|
x: 0,
|
|
@@ -5470,7 +5808,7 @@ const openRename = async editor => {
|
|
|
5470
5808
|
return editor;
|
|
5471
5809
|
}
|
|
5472
5810
|
const fullFocus = true;
|
|
5473
|
-
return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$2, newStateGenerator$2, fullFocus);
|
|
5811
|
+
return addWidgetToEditor(Rename$1, FocusEditorRename$1, editor, create$2, newStateGenerator$2, fullFocus);
|
|
5474
5812
|
};
|
|
5475
5813
|
|
|
5476
5814
|
const getOrganizeImportEdits = async editor => {
|
|
@@ -6637,75 +6975,6 @@ const showHover = async state => {
|
|
|
6637
6975
|
return state;
|
|
6638
6976
|
};
|
|
6639
6977
|
|
|
6640
|
-
const filterActions = (sourceActions, languageId) => {
|
|
6641
|
-
return sourceActions.filter(action => action.languageId === languageId);
|
|
6642
|
-
};
|
|
6643
|
-
|
|
6644
|
-
// TODO ask extension host worker instead
|
|
6645
|
-
const getEditorSourceActions = async editorId => {
|
|
6646
|
-
if (!editorId) {
|
|
6647
|
-
return [];
|
|
6648
|
-
}
|
|
6649
|
-
const {
|
|
6650
|
-
newState
|
|
6651
|
-
} = get$4(editorId);
|
|
6652
|
-
const {
|
|
6653
|
-
languageId
|
|
6654
|
-
} = newState;
|
|
6655
|
-
// @ts-ignore
|
|
6656
|
-
const allActions = await invoke$8('GetEditorSourceActions.getEditorSourceActions');
|
|
6657
|
-
const filtered = filterActions(allActions, languageId);
|
|
6658
|
-
return filtered;
|
|
6659
|
-
};
|
|
6660
|
-
|
|
6661
|
-
const getHeight = sourceActionCount => {
|
|
6662
|
-
if (sourceActionCount === 0) {
|
|
6663
|
-
return 45;
|
|
6664
|
-
}
|
|
6665
|
-
return 150;
|
|
6666
|
-
};
|
|
6667
|
-
const getSourceActionWidgetPosition = (editor, sourceActionCount) => {
|
|
6668
|
-
const width = 300;
|
|
6669
|
-
const height = getHeight(sourceActionCount);
|
|
6670
|
-
const cursor = getPositionAtCursor$1(editor);
|
|
6671
|
-
const {
|
|
6672
|
-
x
|
|
6673
|
-
} = cursor;
|
|
6674
|
-
const {
|
|
6675
|
-
y
|
|
6676
|
-
} = cursor;
|
|
6677
|
-
// TODO support virtual list
|
|
6678
|
-
return {
|
|
6679
|
-
x,
|
|
6680
|
-
y,
|
|
6681
|
-
width,
|
|
6682
|
-
height
|
|
6683
|
-
};
|
|
6684
|
-
};
|
|
6685
|
-
|
|
6686
|
-
const loadSourceActions = async (editor, state) => {
|
|
6687
|
-
// const editor = GetEditor.getEditor(editorUid)
|
|
6688
|
-
// TODO request source actions information from extensions
|
|
6689
|
-
const sourceActions = await getEditorSourceActions();
|
|
6690
|
-
// TODO avoid side effect
|
|
6691
|
-
const {
|
|
6692
|
-
x,
|
|
6693
|
-
y,
|
|
6694
|
-
width,
|
|
6695
|
-
height
|
|
6696
|
-
} = getSourceActionWidgetPosition(editor, sourceActions.length);
|
|
6697
|
-
return {
|
|
6698
|
-
...state,
|
|
6699
|
-
sourceActions,
|
|
6700
|
-
x,
|
|
6701
|
-
y,
|
|
6702
|
-
width,
|
|
6703
|
-
height,
|
|
6704
|
-
maxHeight: 150,
|
|
6705
|
-
focusedIndex: 0
|
|
6706
|
-
};
|
|
6707
|
-
};
|
|
6708
|
-
|
|
6709
6978
|
const create = () => {
|
|
6710
6979
|
const completionUid = create$7();
|
|
6711
6980
|
const widget = {
|
|
@@ -6736,13 +7005,6 @@ const create = () => {
|
|
|
6736
7005
|
return widget;
|
|
6737
7006
|
};
|
|
6738
7007
|
|
|
6739
|
-
const showSourceActions$1 = async editor => {
|
|
6740
|
-
const newStateGenerator = async state => {
|
|
6741
|
-
return loadSourceActions(editor, state);
|
|
6742
|
-
};
|
|
6743
|
-
return addWidgetToEditor(SourceAction$1, SourceActions, editor, create, newStateGenerator);
|
|
6744
|
-
};
|
|
6745
|
-
|
|
6746
7008
|
const launchSourceActionWorker = async () => {
|
|
6747
7009
|
const name = 'Source Action Worker';
|
|
6748
7010
|
const url = 'sourceActionWorkerMain.js';
|
|
@@ -7582,10 +7844,11 @@ const editorUnindent = editor => {
|
|
|
7582
7844
|
|
|
7583
7845
|
const isFunctional = widgetId => {
|
|
7584
7846
|
switch (widgetId) {
|
|
7585
|
-
case ColorPicker:
|
|
7586
|
-
case Rename:
|
|
7847
|
+
case ColorPicker$1:
|
|
7848
|
+
case Rename$1:
|
|
7587
7849
|
case Completion:
|
|
7588
7850
|
case Find:
|
|
7851
|
+
case SourceAction$1:
|
|
7589
7852
|
return true;
|
|
7590
7853
|
default:
|
|
7591
7854
|
return false;
|
|
@@ -7625,13 +7888,13 @@ const addWidget$1 = (widget, id, render) => {
|
|
|
7625
7888
|
|
|
7626
7889
|
const getWidgetInvoke = widgetId => {
|
|
7627
7890
|
switch (widgetId) {
|
|
7628
|
-
case ColorPicker:
|
|
7891
|
+
case ColorPicker$1:
|
|
7629
7892
|
return invoke$7;
|
|
7630
7893
|
case Completion:
|
|
7631
7894
|
return invoke$4;
|
|
7632
7895
|
case Find:
|
|
7633
7896
|
return invoke$3;
|
|
7634
|
-
case Rename:
|
|
7897
|
+
case Rename$1:
|
|
7635
7898
|
return invoke$5;
|
|
7636
7899
|
case SourceAction$1:
|
|
7637
7900
|
return invoke$1;
|
|
@@ -7716,7 +7979,7 @@ const renderFull$4 = (oldState, newState) => {
|
|
|
7716
7979
|
return commands;
|
|
7717
7980
|
};
|
|
7718
7981
|
|
|
7719
|
-
const render$
|
|
7982
|
+
const render$b = widget => {
|
|
7720
7983
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
7721
7984
|
const wrappedCommands = [];
|
|
7722
7985
|
const {
|
|
@@ -7732,7 +7995,7 @@ const render$c = widget => {
|
|
|
7732
7995
|
return wrappedCommands;
|
|
7733
7996
|
};
|
|
7734
7997
|
const add$7 = widget => {
|
|
7735
|
-
return addWidget$1(widget, 'EditorCompletion', render$
|
|
7998
|
+
return addWidget$1(widget, 'EditorCompletion', render$b);
|
|
7736
7999
|
};
|
|
7737
8000
|
const remove$7 = widget => {
|
|
7738
8001
|
return [['Viewlet.dispose', widget.newState.uid]];
|
|
@@ -7773,7 +8036,7 @@ const EditorCompletionWidget = {
|
|
|
7773
8036
|
handleWheel: handleWheel$1,
|
|
7774
8037
|
openDetails,
|
|
7775
8038
|
remove: remove$7,
|
|
7776
|
-
render: render$
|
|
8039
|
+
render: render$b,
|
|
7777
8040
|
selectCurrent: selectCurrent$1,
|
|
7778
8041
|
selectIndex: selectIndex$1,
|
|
7779
8042
|
toggleDetails: toggleDetails$1
|
|
@@ -7786,7 +8049,7 @@ const renderFull$3 = (oldState, newState) => {
|
|
|
7786
8049
|
return commands;
|
|
7787
8050
|
};
|
|
7788
8051
|
|
|
7789
|
-
const render$
|
|
8052
|
+
const render$a = widget => {
|
|
7790
8053
|
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
7791
8054
|
const wrappedCommands = [];
|
|
7792
8055
|
const {
|
|
@@ -7802,7 +8065,7 @@ const render$b = widget => {
|
|
|
7802
8065
|
return wrappedCommands;
|
|
7803
8066
|
};
|
|
7804
8067
|
const add$6 = widget => {
|
|
7805
|
-
return addWidget$1(widget, 'FindWidget', render$
|
|
8068
|
+
return addWidget$1(widget, 'FindWidget', render$a);
|
|
7806
8069
|
};
|
|
7807
8070
|
const remove$6 = widget => {
|
|
7808
8071
|
return [['Viewlet.dispose', widget.newState.uid]];
|
|
@@ -7849,7 +8112,7 @@ const EditorFindWidget = {
|
|
|
7849
8112
|
handleReplaceInput,
|
|
7850
8113
|
handleToggleReplaceFocus,
|
|
7851
8114
|
remove: remove$6,
|
|
7852
|
-
render: render$
|
|
8115
|
+
render: render$a,
|
|
7853
8116
|
toggleReplace
|
|
7854
8117
|
};
|
|
7855
8118
|
|
|
@@ -7904,8 +8167,6 @@ const EditorCursor = 'EditorCursor';
|
|
|
7904
8167
|
const EditorRow = 'EditorRow';
|
|
7905
8168
|
const EditorRowHighlighted = 'EditorRowHighlighted';
|
|
7906
8169
|
const EditorSelection = 'EditorSelection';
|
|
7907
|
-
const EditorSourceActions = 'EditorSourceActions';
|
|
7908
|
-
const EditorSourceActionsList = 'EditorSourceActionsList';
|
|
7909
8170
|
const HoverDisplayString = 'HoverDisplayString';
|
|
7910
8171
|
const HoverDocumentation = 'HoverDocumentation';
|
|
7911
8172
|
const HoverEditorRow = 'HoverEditorRow';
|
|
@@ -7915,16 +8176,10 @@ const HoverProblemMessage = 'HoverProblemMessage';
|
|
|
7915
8176
|
const IconClose = 'IconClose';
|
|
7916
8177
|
const InputBox = 'InputBox';
|
|
7917
8178
|
const MaskIcon = 'MaskIcon';
|
|
7918
|
-
const MaskIconSymbolFile = 'MaskIconSymbolFile';
|
|
7919
|
-
const SourceActionHeading = 'SourceActionHeading';
|
|
7920
|
-
const SourceActionIcon = 'SourceActionIcon';
|
|
7921
|
-
const SourceActionItem = 'SourceActionItem';
|
|
7922
|
-
const SourceActionItemFocused = 'SourceActionItemFocused';
|
|
7923
8179
|
const Viewlet = 'Viewlet';
|
|
7924
8180
|
|
|
7925
8181
|
const HandleBeforeInput = 'handleBeforeInput';
|
|
7926
8182
|
const HandleBlur = 'handleBlur';
|
|
7927
|
-
const HandleClick = 'handleClick';
|
|
7928
8183
|
const HandleClose = 'handleClose';
|
|
7929
8184
|
const HandleCompositionEnd = 'handleCompositionEnd';
|
|
7930
8185
|
const HandleCompositionStart = 'handleCompositionStart';
|
|
@@ -7932,7 +8187,6 @@ const HandleCompositionUpdate = 'handleCompositionUpdate';
|
|
|
7932
8187
|
const HandleContextMenu = 'handleContextMenu';
|
|
7933
8188
|
const HandleCut = 'handleCut';
|
|
7934
8189
|
const HandleFocus = 'handleFocus';
|
|
7935
|
-
const HandleFocusIn = 'handleFocusIn';
|
|
7936
8190
|
const HandleMouseMove = 'handleMouseMove';
|
|
7937
8191
|
const HandleSashPointerDown = 'handleSashPointerDown';
|
|
7938
8192
|
const HandleWheel = 'handleWheel';
|
|
@@ -8035,7 +8289,7 @@ const renderHoverDom = {
|
|
|
8035
8289
|
return [/* method */SetDom2, dom];
|
|
8036
8290
|
}
|
|
8037
8291
|
};
|
|
8038
|
-
const renderBounds$
|
|
8292
|
+
const renderBounds$2 = {
|
|
8039
8293
|
isEqual(oldState, newState) {
|
|
8040
8294
|
return oldState.x === newState.x && oldState.y === newState.y;
|
|
8041
8295
|
},
|
|
@@ -8049,10 +8303,10 @@ const renderBounds$3 = {
|
|
|
8049
8303
|
return [SetBounds, x, y, width, height];
|
|
8050
8304
|
}
|
|
8051
8305
|
};
|
|
8052
|
-
const render$
|
|
8306
|
+
const render$9 = [renderHoverDom, renderBounds$2];
|
|
8053
8307
|
const renderHover = (oldState, newState) => {
|
|
8054
8308
|
const commands = [];
|
|
8055
|
-
for (const item of render$
|
|
8309
|
+
for (const item of render$9) {
|
|
8056
8310
|
if (!item.isEqual(oldState, newState)) {
|
|
8057
8311
|
commands.push(item.apply(oldState, newState));
|
|
8058
8312
|
}
|
|
@@ -8060,7 +8314,7 @@ const renderHover = (oldState, newState) => {
|
|
|
8060
8314
|
return commands;
|
|
8061
8315
|
};
|
|
8062
8316
|
|
|
8063
|
-
const render$
|
|
8317
|
+
const render$8 = widget => {
|
|
8064
8318
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
8065
8319
|
const wrappedCommands = [];
|
|
8066
8320
|
const {
|
|
@@ -8076,7 +8330,7 @@ const render$9 = widget => {
|
|
|
8076
8330
|
return wrappedCommands;
|
|
8077
8331
|
};
|
|
8078
8332
|
const add$5 = widget => {
|
|
8079
|
-
return addWidget$1(widget, 'EditorRename', render$
|
|
8333
|
+
return addWidget$1(widget, 'EditorRename', render$8);
|
|
8080
8334
|
};
|
|
8081
8335
|
const remove$5 = widget => {
|
|
8082
8336
|
return [['Viewlet.dispose', widget.newState.uid]];
|
|
@@ -8085,7 +8339,7 @@ const {
|
|
|
8085
8339
|
handleInput,
|
|
8086
8340
|
close: close$1,
|
|
8087
8341
|
accept
|
|
8088
|
-
} = createFns(['handleInput', 'close', 'accept'], 'Rename', Rename);
|
|
8342
|
+
} = createFns(['handleInput', 'close', 'accept'], 'Rename', Rename$1);
|
|
8089
8343
|
|
|
8090
8344
|
const EditorRenameWidget = {
|
|
8091
8345
|
__proto__: null,
|
|
@@ -8094,7 +8348,7 @@ const EditorRenameWidget = {
|
|
|
8094
8348
|
close: close$1,
|
|
8095
8349
|
handleInput,
|
|
8096
8350
|
remove: remove$5,
|
|
8097
|
-
render: render$
|
|
8351
|
+
render: render$8
|
|
8098
8352
|
};
|
|
8099
8353
|
|
|
8100
8354
|
const rerender = editor => {
|
|
@@ -8120,127 +8374,14 @@ const removeWidget$1 = widget => {
|
|
|
8120
8374
|
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
8121
8375
|
};
|
|
8122
8376
|
|
|
8123
|
-
const getEditorMessageVirtualDom = message => {
|
|
8124
|
-
const dom = [{
|
|
8125
|
-
type: Div,
|
|
8126
|
-
className: 'Viewlet EditorMessage',
|
|
8127
|
-
tabIndex: -1,
|
|
8128
|
-
childCount: 2
|
|
8129
|
-
}, {
|
|
8130
|
-
type: Div,
|
|
8131
|
-
className: 'EditorMessageText',
|
|
8132
|
-
childCount: 1
|
|
8133
|
-
}, text(message), {
|
|
8134
|
-
type: Div,
|
|
8135
|
-
className: 'EditorMessageTriangle',
|
|
8136
|
-
childCount: 0
|
|
8137
|
-
}];
|
|
8138
|
-
return dom;
|
|
8139
|
-
};
|
|
8140
|
-
|
|
8141
|
-
const getEmptySourceActionsVirtualDom = () => {
|
|
8142
|
-
return getEditorMessageVirtualDom(noCodeActionsAvailable());
|
|
8143
|
-
};
|
|
8144
|
-
|
|
8145
|
-
const mergeClassNames = (...classNames) => {
|
|
8146
|
-
return classNames.filter(Boolean).join(' ');
|
|
8147
|
-
};
|
|
8148
|
-
|
|
8149
|
-
const getActionClassName = isFocused => {
|
|
8150
|
-
if (isFocused) {
|
|
8151
|
-
return mergeClassNames(SourceActionItem, SourceActionItemFocused);
|
|
8152
|
-
}
|
|
8153
|
-
return SourceActionItem;
|
|
8154
|
-
};
|
|
8155
|
-
const getSourceActionListItemVirtualDom = sourceAction => {
|
|
8156
|
-
const {
|
|
8157
|
-
name,
|
|
8158
|
-
isFocused
|
|
8159
|
-
} = sourceAction;
|
|
8160
|
-
const actionClassName = getActionClassName(isFocused);
|
|
8161
|
-
return [{
|
|
8162
|
-
type: Div,
|
|
8163
|
-
className: actionClassName,
|
|
8164
|
-
childCount: 2
|
|
8165
|
-
}, {
|
|
8166
|
-
type: Div,
|
|
8167
|
-
className: mergeClassNames(SourceActionIcon, MaskIcon, MaskIconSymbolFile)
|
|
8168
|
-
}, text(name)];
|
|
8169
|
-
};
|
|
8170
|
-
|
|
8171
|
-
const getSourceActionsVirtualDom = sourceActions => {
|
|
8172
|
-
if (sourceActions.length === 0) {
|
|
8173
|
-
return getEmptySourceActionsVirtualDom();
|
|
8174
|
-
}
|
|
8175
|
-
const dom = [{
|
|
8176
|
-
type: Div,
|
|
8177
|
-
className: mergeClassNames(Viewlet, EditorSourceActions),
|
|
8178
|
-
tabIndex: -1,
|
|
8179
|
-
childCount: 2,
|
|
8180
|
-
onFocusIn: HandleFocusIn
|
|
8181
|
-
}, {
|
|
8182
|
-
type: Div,
|
|
8183
|
-
className: SourceActionHeading,
|
|
8184
|
-
childCount: 1
|
|
8185
|
-
}, text(sourceAction()), {
|
|
8186
|
-
type: Div,
|
|
8187
|
-
className: EditorSourceActionsList,
|
|
8188
|
-
childCount: sourceActions.length,
|
|
8189
|
-
onClick: HandleClick
|
|
8190
|
-
}, ...sourceActions.flatMap(getSourceActionListItemVirtualDom)];
|
|
8191
|
-
return dom;
|
|
8192
|
-
};
|
|
8193
|
-
|
|
8194
|
-
const getVisibleSourceActions = (sourceActions, focusedIndex) => {
|
|
8195
|
-
const visible = [];
|
|
8196
|
-
for (let i = 0; i < sourceActions.length; i++) {
|
|
8197
|
-
const isFocused = i === focusedIndex;
|
|
8198
|
-
const sourceAction = sourceActions[i];
|
|
8199
|
-
visible.push({
|
|
8200
|
-
...sourceAction,
|
|
8201
|
-
isFocused
|
|
8202
|
-
});
|
|
8203
|
-
}
|
|
8204
|
-
return visible;
|
|
8205
|
-
};
|
|
8206
|
-
|
|
8207
|
-
const renderSourceActions = {
|
|
8208
|
-
isEqual(oldState, newState) {
|
|
8209
|
-
return oldState.sourceActions === newState.sourceActions && oldState.focusedIndex === newState.focusedIndex;
|
|
8210
|
-
},
|
|
8211
|
-
apply(oldStatem, newState) {
|
|
8212
|
-
const visible = getVisibleSourceActions(newState.sourceActions, newState.focusedIndex);
|
|
8213
|
-
const dom = getSourceActionsVirtualDom(visible);
|
|
8214
|
-
return [SetDom2, newState.uid, dom];
|
|
8215
|
-
}
|
|
8216
|
-
};
|
|
8217
|
-
const renderBounds$2 = {
|
|
8218
|
-
isEqual(oldState, newState) {
|
|
8219
|
-
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
8220
|
-
},
|
|
8221
|
-
apply(oldState, newState) {
|
|
8222
|
-
return [SetBounds, newState.x, newState.y, newState.width, newState.height];
|
|
8223
|
-
}
|
|
8224
|
-
};
|
|
8225
|
-
const render$8 = [renderSourceActions, renderBounds$2];
|
|
8226
|
-
const doRender = (oldState, newState) => {
|
|
8227
|
-
const commands = [];
|
|
8228
|
-
for (const item of render$8) {
|
|
8229
|
-
if (!item.isEqual(oldState, newState)) {
|
|
8230
|
-
commands.push(item.apply(oldState, newState));
|
|
8231
|
-
}
|
|
8232
|
-
}
|
|
8233
|
-
return commands;
|
|
8234
|
-
};
|
|
8235
|
-
|
|
8236
8377
|
const render$7 = widget => {
|
|
8237
|
-
const commands =
|
|
8378
|
+
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
8238
8379
|
const wrappedCommands = [];
|
|
8239
8380
|
const {
|
|
8240
8381
|
uid
|
|
8241
8382
|
} = widget.newState;
|
|
8242
8383
|
for (const command of commands) {
|
|
8243
|
-
if (command[0] === SetDom2) {
|
|
8384
|
+
if (command[0] === SetDom2 || command[0] === SetCss || command[0] === AppendToBody || command[0] === SetBounds2 || command[0] === RegisterEventListeners || command[0] === SetSelectionByName || command[0] === SetValueByName || command[0] === SetFocusContext || command[0] === SetUid || command[0] === 'Viewlet.focusSelector') {
|
|
8244
8385
|
wrappedCommands.push(command);
|
|
8245
8386
|
} else {
|
|
8246
8387
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
@@ -8321,6 +8462,27 @@ const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...par
|
|
|
8321
8462
|
return newEditor;
|
|
8322
8463
|
};
|
|
8323
8464
|
|
|
8465
|
+
const filterActions = (sourceActions, languageId) => {
|
|
8466
|
+
return sourceActions.filter(action => action.languageId === languageId);
|
|
8467
|
+
};
|
|
8468
|
+
|
|
8469
|
+
// TODO ask extension host worker instead
|
|
8470
|
+
const getEditorSourceActions = async editorId => {
|
|
8471
|
+
if (!editorId) {
|
|
8472
|
+
return [];
|
|
8473
|
+
}
|
|
8474
|
+
const {
|
|
8475
|
+
newState
|
|
8476
|
+
} = get$4(editorId);
|
|
8477
|
+
const {
|
|
8478
|
+
languageId
|
|
8479
|
+
} = newState;
|
|
8480
|
+
// @ts-ignore
|
|
8481
|
+
const allActions = await invoke$8('GetEditorSourceActions.getEditorSourceActions');
|
|
8482
|
+
const filtered = filterActions(allActions, languageId);
|
|
8483
|
+
return filtered;
|
|
8484
|
+
};
|
|
8485
|
+
|
|
8324
8486
|
const RE_WORD = /[\w\-]+$/;
|
|
8325
8487
|
const getWordAtOffset = editor => {
|
|
8326
8488
|
const {
|
|
@@ -8696,7 +8858,7 @@ const getKeyBindings = () => {
|
|
|
8696
8858
|
when: FocusEditorText
|
|
8697
8859
|
}, {
|
|
8698
8860
|
key: CtrlCmd | Period,
|
|
8699
|
-
command: 'Editor.
|
|
8861
|
+
command: 'Editor.showSourceActions3',
|
|
8700
8862
|
when: FocusEditorText
|
|
8701
8863
|
}, {
|
|
8702
8864
|
key: Tab,
|
|
@@ -9020,7 +9182,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
9020
9182
|
commandMap: {}
|
|
9021
9183
|
});
|
|
9022
9184
|
if (rpcId) {
|
|
9023
|
-
set$
|
|
9185
|
+
set$c(rpcId, rpc);
|
|
9024
9186
|
}
|
|
9025
9187
|
};
|
|
9026
9188
|
|
|
@@ -9049,7 +9211,7 @@ const createExtensionHostRpc = async () => {
|
|
|
9049
9211
|
} = getPortTuple();
|
|
9050
9212
|
const initialCommand = 'HandleMessagePort.handleMessagePort2';
|
|
9051
9213
|
// TODO use transfer rpc
|
|
9052
|
-
await sendMessagePortToExtensionHostWorker2(port2, initialCommand,
|
|
9214
|
+
await sendMessagePortToExtensionHostWorker2(port2, initialCommand, EditorWorker);
|
|
9053
9215
|
const rpc = await PlainMessagePortRpcParent.create({
|
|
9054
9216
|
commandMap: {},
|
|
9055
9217
|
messagePort: port1
|
|
@@ -9691,6 +9853,10 @@ const getDiagnosticClassName = type => {
|
|
|
9691
9853
|
}
|
|
9692
9854
|
};
|
|
9693
9855
|
|
|
9856
|
+
const mergeClassNames = (...classNames) => {
|
|
9857
|
+
return classNames.filter(Boolean).join(' ');
|
|
9858
|
+
};
|
|
9859
|
+
|
|
9694
9860
|
const getDiagnosticVirtualDom = diagnostic => {
|
|
9695
9861
|
const {
|
|
9696
9862
|
x,
|
|
@@ -10052,7 +10218,7 @@ const setDebugEnabled = (state, enabled) => {
|
|
|
10052
10218
|
};
|
|
10053
10219
|
|
|
10054
10220
|
const invoke = async (method, ...params) => {
|
|
10055
|
-
const worker = get$6(
|
|
10221
|
+
const worker = get$6(DebugWorker);
|
|
10056
10222
|
return worker.invoke(method, ...params);
|
|
10057
10223
|
};
|
|
10058
10224
|
|
|
@@ -10119,38 +10285,8 @@ const wrapWidgetCommand = (widgetId, fn) => {
|
|
|
10119
10285
|
};
|
|
10120
10286
|
|
|
10121
10287
|
const widgetCommands = {
|
|
10122
|
-
'ColorPicker.handleSliderPointerDown': ColorPicker,
|
|
10123
|
-
'ColorPicker.handleSliderPointerMove': ColorPicker
|
|
10124
|
-
// 'FindWidget.focusNext': WidgetId.Find,
|
|
10125
|
-
// 'FindWidget.focusPrevious': WidgetId.Find,
|
|
10126
|
-
'FindWidget.close': Find,
|
|
10127
|
-
// 'FindWidget.focusIndex': WidgetId.Find,
|
|
10128
|
-
// 'FindWidget.focusFirst': WidgetId.Find,
|
|
10129
|
-
// 'FindWidget.focusLast': WidgetId.Find,
|
|
10130
|
-
'FindWidget.toggleReplace': Find,
|
|
10131
|
-
'FindWidget.handleFocus': Find,
|
|
10132
|
-
'FindWidget.handleBlur': Find,
|
|
10133
|
-
'FindWidget.handleToggleReplaceFocus': Find,
|
|
10134
|
-
'FindWidget.handleInput': Find,
|
|
10135
|
-
'FindWidget.handleReplaceInput': Find,
|
|
10136
|
-
'FindWidget.handleReplaceFocus': Find,
|
|
10137
|
-
'FindWidget.focusFind': Find,
|
|
10138
|
-
'FindWidget.focusToggleReplace': Find,
|
|
10139
|
-
'FindWidget.focusReplace': Find,
|
|
10140
|
-
'FindWidget.focusReplaceButton': Find,
|
|
10141
|
-
'FindWidget.focusReplaceAllButton': Find,
|
|
10142
|
-
'FindWidget.focusNextMatchButton': Find,
|
|
10143
|
-
'FindWidget.focusPreviousMatchButton': Find,
|
|
10144
|
-
'FindWidget.focusCloseButton': Find
|
|
10145
|
-
|
|
10146
|
-
// 'EditorCompletion.handleWheel': WidgetId.Completion,
|
|
10147
|
-
// 'EditorCompletion.focusFirst': WidgetId.Completion,
|
|
10148
|
-
// 'EditorCompletion.focusNext': WidgetId.Completion,
|
|
10149
|
-
// 'EditorCompletion.focusPrevious': WidgetId.Completion,
|
|
10150
|
-
// 'EditorCompletion.focusIndex': WidgetId.Completion,
|
|
10151
|
-
// 'EditorCompletion.focusLast': WidgetId.Completion,
|
|
10152
|
-
// 'EditorCompletion.selectCurrent': WidgetId.Completion,
|
|
10153
|
-
// 'EditorCompletion.selectIndex': WidgetId.Completion,
|
|
10288
|
+
'ColorPicker.handleSliderPointerDown': ColorPicker$1,
|
|
10289
|
+
'ColorPicker.handleSliderPointerMove': ColorPicker$1
|
|
10154
10290
|
};
|
|
10155
10291
|
|
|
10156
10292
|
// TODO wrap commands globally, not per editor
|
|
@@ -10332,8 +10468,8 @@ const commandMap = {
|
|
|
10332
10468
|
'Editor.setSelections2': setSelections2,
|
|
10333
10469
|
'Editor.showHover': showHover,
|
|
10334
10470
|
'Editor.showHover2': showHover2,
|
|
10335
|
-
'Editor.showSourceActions': showSourceActions
|
|
10336
|
-
'Editor.showSourceActions2': showSourceActions
|
|
10471
|
+
'Editor.showSourceActions': showSourceActions,
|
|
10472
|
+
'Editor.showSourceActions2': showSourceActions,
|
|
10337
10473
|
'Editor.showSourceActions3': showSourceActions,
|
|
10338
10474
|
'Editor.sortLinesAscending': sortLinesAscending,
|
|
10339
10475
|
'Editor.tabCompletion': tabCompletion,
|
|
@@ -10704,12 +10840,12 @@ const EditorHoverWidget = {
|
|
|
10704
10840
|
};
|
|
10705
10841
|
|
|
10706
10842
|
const registerWidgets = () => {
|
|
10707
|
-
set$7(ColorPicker, EditorColorPickerWidget);
|
|
10843
|
+
set$7(ColorPicker$1, EditorColorPickerWidget);
|
|
10708
10844
|
set$7(Completion, EditorCompletionWidget);
|
|
10709
10845
|
set$7(CompletionDetail, EditorCompletionDetailWidget);
|
|
10710
10846
|
set$7(Find, EditorFindWidget);
|
|
10711
10847
|
set$7(Hover, EditorHoverWidget);
|
|
10712
|
-
set$7(Rename, EditorRenameWidget);
|
|
10848
|
+
set$7(Rename$1, EditorRenameWidget);
|
|
10713
10849
|
set$7(SourceAction$1, EditorSourceActionWidget);
|
|
10714
10850
|
set$7(CodeGenerator, EditorCodeGeneratorWidget);
|
|
10715
10851
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/editor-worker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Lvce Editor",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"main": "dist/editorWorkerMain.js"
|
|
7
|
+
"main": "dist/editorWorkerMain.js",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@lvce-editor/constants": "^1.9.0"
|
|
10
|
+
}
|
|
8
11
|
}
|