@lvce-editor/completion-worker 1.22.0 → 1.24.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/completionWorkerMain.js +57 -36
- package/package.json +1 -1
|
@@ -552,7 +552,7 @@ const registerPromise = () => {
|
|
|
552
552
|
promise
|
|
553
553
|
};
|
|
554
554
|
};
|
|
555
|
-
const create$2$
|
|
555
|
+
const create$2$1 = (method, params) => {
|
|
556
556
|
const {
|
|
557
557
|
id,
|
|
558
558
|
promise
|
|
@@ -773,7 +773,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
773
773
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
774
774
|
return create$1$1(id, errorProperty);
|
|
775
775
|
};
|
|
776
|
-
const create$
|
|
776
|
+
const create$6 = (message, result) => {
|
|
777
777
|
return {
|
|
778
778
|
jsonrpc: Two,
|
|
779
779
|
id: message.id,
|
|
@@ -782,7 +782,7 @@ const create$5 = (message, result) => {
|
|
|
782
782
|
};
|
|
783
783
|
const getSuccessResponse = (message, result) => {
|
|
784
784
|
const resultProperty = result ?? null;
|
|
785
|
-
return create$
|
|
785
|
+
return create$6(message, resultProperty);
|
|
786
786
|
};
|
|
787
787
|
const getErrorResponseSimple = (id, error) => {
|
|
788
788
|
return {
|
|
@@ -877,7 +877,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
877
877
|
const {
|
|
878
878
|
message,
|
|
879
879
|
promise
|
|
880
|
-
} = create$2$
|
|
880
|
+
} = create$2$1(method, params);
|
|
881
881
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
882
882
|
ipc.sendAndTransfer(message);
|
|
883
883
|
} else {
|
|
@@ -964,7 +964,7 @@ const listen$1 = async (module, options) => {
|
|
|
964
964
|
const ipc = module.wrap(rawIpc);
|
|
965
965
|
return ipc;
|
|
966
966
|
};
|
|
967
|
-
const create$
|
|
967
|
+
const create$5 = async ({
|
|
968
968
|
commandMap,
|
|
969
969
|
messagePort
|
|
970
970
|
}) => {
|
|
@@ -980,7 +980,7 @@ const create$4 = async ({
|
|
|
980
980
|
messagePort.start();
|
|
981
981
|
return rpc;
|
|
982
982
|
};
|
|
983
|
-
const create$
|
|
983
|
+
const create$3 = async ({
|
|
984
984
|
commandMap,
|
|
985
985
|
send
|
|
986
986
|
}) => {
|
|
@@ -989,16 +989,16 @@ const create$2$1 = async ({
|
|
|
989
989
|
port2
|
|
990
990
|
} = new MessageChannel();
|
|
991
991
|
await send(port1);
|
|
992
|
-
return create$
|
|
992
|
+
return create$5({
|
|
993
993
|
commandMap,
|
|
994
994
|
messagePort: port2
|
|
995
995
|
});
|
|
996
996
|
};
|
|
997
997
|
const TransferMessagePortRpcParent = {
|
|
998
998
|
__proto__: null,
|
|
999
|
-
create: create$
|
|
999
|
+
create: create$3
|
|
1000
1000
|
};
|
|
1001
|
-
const create$
|
|
1001
|
+
const create$4 = async ({
|
|
1002
1002
|
commandMap
|
|
1003
1003
|
}) => {
|
|
1004
1004
|
// TODO create a commandMap per rpc instance
|
|
@@ -1010,11 +1010,16 @@ const create$3 = async ({
|
|
|
1010
1010
|
};
|
|
1011
1011
|
const WebWorkerRpcClient = {
|
|
1012
1012
|
__proto__: null,
|
|
1013
|
-
create: create$
|
|
1013
|
+
create: create$4
|
|
1014
1014
|
};
|
|
1015
1015
|
|
|
1016
|
+
const toCommandId = key => {
|
|
1017
|
+
const dotIndex = key.indexOf('.');
|
|
1018
|
+
return key.slice(dotIndex + 1);
|
|
1019
|
+
};
|
|
1016
1020
|
const create$2 = () => {
|
|
1017
1021
|
const states = Object.create(null);
|
|
1022
|
+
const commandMapRef = {};
|
|
1018
1023
|
return {
|
|
1019
1024
|
get(uid) {
|
|
1020
1025
|
return states[uid];
|
|
@@ -1055,6 +1060,15 @@ const create$2 = () => {
|
|
|
1055
1060
|
};
|
|
1056
1061
|
return wrapped;
|
|
1057
1062
|
},
|
|
1063
|
+
wrapGetter(fn) {
|
|
1064
|
+
const wrapped = (uid, ...args) => {
|
|
1065
|
+
const {
|
|
1066
|
+
newState
|
|
1067
|
+
} = states[uid];
|
|
1068
|
+
return fn(newState, ...args);
|
|
1069
|
+
};
|
|
1070
|
+
return wrapped;
|
|
1071
|
+
},
|
|
1058
1072
|
diff(uid, modules, numbers) {
|
|
1059
1073
|
const {
|
|
1060
1074
|
oldState,
|
|
@@ -1068,6 +1082,14 @@ const create$2 = () => {
|
|
|
1068
1082
|
}
|
|
1069
1083
|
}
|
|
1070
1084
|
return diffResult;
|
|
1085
|
+
},
|
|
1086
|
+
getCommandIds() {
|
|
1087
|
+
const keys = Object.keys(commandMapRef);
|
|
1088
|
+
const ids = keys.map(toCommandId);
|
|
1089
|
+
return ids;
|
|
1090
|
+
},
|
|
1091
|
+
registerCommands(commandMap) {
|
|
1092
|
+
Object.assign(commandMapRef, commandMap);
|
|
1071
1093
|
}
|
|
1072
1094
|
};
|
|
1073
1095
|
};
|
|
@@ -1108,14 +1130,14 @@ const create$1 = rpcId => {
|
|
|
1108
1130
|
}
|
|
1109
1131
|
};
|
|
1110
1132
|
};
|
|
1111
|
-
const EditorWorker$
|
|
1133
|
+
const EditorWorker$1 = 99;
|
|
1112
1134
|
const ExtensionHostWorker = 44;
|
|
1113
1135
|
const {
|
|
1114
|
-
invoke: invoke$
|
|
1136
|
+
invoke: invoke$c,
|
|
1115
1137
|
invokeAndTransfer: invokeAndTransfer$c,
|
|
1116
1138
|
set: set$c,
|
|
1117
1139
|
dispose: dispose$c
|
|
1118
|
-
} = create$1(EditorWorker$
|
|
1140
|
+
} = create$1(EditorWorker$1);
|
|
1119
1141
|
const sendMessagePortToExtensionHostWorker$1$1 = async port => {
|
|
1120
1142
|
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1121
1143
|
await invokeAndTransfer$c(
|
|
@@ -1127,40 +1149,40 @@ const sendMessagePortToExtensionHostWorker$1$1 = async port => {
|
|
|
1127
1149
|
// TODO add tests for this
|
|
1128
1150
|
const activateByEvent$1$1 = async event => {
|
|
1129
1151
|
// @ts-ignore
|
|
1130
|
-
await invoke$
|
|
1152
|
+
await invoke$c('ActivateByEvent.activateByEvent', event);
|
|
1131
1153
|
};
|
|
1132
1154
|
const applyEdit$2 = async (editorUid, changes) => {
|
|
1133
1155
|
// @ts-ignore
|
|
1134
|
-
await
|
|
1156
|
+
await invoke$c('Editor.applyEdit2', editorUid, changes);
|
|
1135
1157
|
};
|
|
1136
1158
|
const closeWidget$1 = async (editorUid, widgetId, widgetName, focusId) => {
|
|
1137
1159
|
// @ts-ignore
|
|
1138
|
-
await invoke$
|
|
1160
|
+
await invoke$c('Editor.closeWidget2', editorUid, widgetId, widgetName, focusId);
|
|
1139
1161
|
};
|
|
1140
1162
|
const getWordAt$1 = async (uid, rowIndex, columnIndex) => {
|
|
1141
1163
|
// @ts-ignore
|
|
1142
|
-
const word = await invoke$
|
|
1164
|
+
const word = await invoke$c('Editor.getWordAt2', uid, rowIndex, columnIndex);
|
|
1143
1165
|
return word;
|
|
1144
1166
|
};
|
|
1145
1167
|
const getLines$2 = async editorUid => {
|
|
1146
|
-
const lines = await invoke$
|
|
1168
|
+
const lines = await invoke$c('Editor.getLines2', editorUid);
|
|
1147
1169
|
return lines;
|
|
1148
1170
|
};
|
|
1149
1171
|
const getPositionAtCursor$2 = async parentUid => {
|
|
1150
|
-
const position = await invoke$
|
|
1172
|
+
const position = await invoke$c('Editor.getPositionAtCursor', parentUid);
|
|
1151
1173
|
return position;
|
|
1152
1174
|
};
|
|
1153
1175
|
const getSelections$2 = async editorUid => {
|
|
1154
|
-
const selections = await invoke$
|
|
1176
|
+
const selections = await invoke$c('Editor.getSelections2', editorUid);
|
|
1155
1177
|
return selections;
|
|
1156
1178
|
};
|
|
1157
1179
|
const getWordAtOffset2$1 = async editorUid => {
|
|
1158
|
-
return invoke$
|
|
1180
|
+
return invoke$c('Editor.getWordAtOffset2', editorUid);
|
|
1159
1181
|
};
|
|
1160
1182
|
const getWordBefore$2 = async (editorUid, rowIndex, columnIndex) => {
|
|
1161
|
-
return invoke$
|
|
1183
|
+
return invoke$c('Editor.getWordBefore2', editorUid, rowIndex, columnIndex);
|
|
1162
1184
|
};
|
|
1163
|
-
const EditorWorker$
|
|
1185
|
+
const EditorWorker$2 = {
|
|
1164
1186
|
__proto__: null,
|
|
1165
1187
|
activateByEvent: activateByEvent$1$1,
|
|
1166
1188
|
applyEdit: applyEdit$2,
|
|
@@ -1172,17 +1194,16 @@ const EditorWorker$1$1 = {
|
|
|
1172
1194
|
getWordAt: getWordAt$1,
|
|
1173
1195
|
getWordAtOffset2: getWordAtOffset2$1,
|
|
1174
1196
|
getWordBefore: getWordBefore$2,
|
|
1175
|
-
invoke: invoke$
|
|
1197
|
+
invoke: invoke$c,
|
|
1176
1198
|
invokeAndTransfer: invokeAndTransfer$c,
|
|
1177
1199
|
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1$1,
|
|
1178
|
-
set: set$c
|
|
1179
|
-
};
|
|
1200
|
+
set: set$c};
|
|
1180
1201
|
const {
|
|
1181
|
-
invoke: invoke$
|
|
1202
|
+
invoke: invoke$9,
|
|
1182
1203
|
set: set$9} = create$1(ExtensionHostWorker);
|
|
1183
1204
|
const ExtensionHost = {
|
|
1184
1205
|
__proto__: null,
|
|
1185
|
-
invoke: invoke$
|
|
1206
|
+
invoke: invoke$9,
|
|
1186
1207
|
set: set$9
|
|
1187
1208
|
};
|
|
1188
1209
|
|
|
@@ -1201,9 +1222,9 @@ const {
|
|
|
1201
1222
|
getWordAtOffset2,
|
|
1202
1223
|
getWordBefore: getWordBefore$1,
|
|
1203
1224
|
invokeAndTransfer
|
|
1204
|
-
} = EditorWorker$
|
|
1225
|
+
} = EditorWorker$2;
|
|
1205
1226
|
|
|
1206
|
-
const EditorWorker
|
|
1227
|
+
const EditorWorker = {
|
|
1207
1228
|
__proto__: null,
|
|
1208
1229
|
activateByEvent: activateByEvent$1,
|
|
1209
1230
|
applyEdit: applyEdit$1,
|
|
@@ -1361,11 +1382,11 @@ const applyEdit = async (editorUid, changes) => {
|
|
|
1361
1382
|
|
|
1362
1383
|
const {
|
|
1363
1384
|
getLines
|
|
1364
|
-
} = EditorWorker
|
|
1385
|
+
} = EditorWorker;
|
|
1365
1386
|
|
|
1366
1387
|
const {
|
|
1367
1388
|
getSelections
|
|
1368
|
-
} = EditorWorker
|
|
1389
|
+
} = EditorWorker;
|
|
1369
1390
|
|
|
1370
1391
|
const getSelectionPairs = (selections, i) => {
|
|
1371
1392
|
const first = selections[i];
|
|
@@ -1425,7 +1446,7 @@ const CompletionResolveExecute = 'ExtensionHostCompletion.executeResolve';
|
|
|
1425
1446
|
|
|
1426
1447
|
const {
|
|
1427
1448
|
activateByEvent
|
|
1428
|
-
} = EditorWorker
|
|
1449
|
+
} = EditorWorker;
|
|
1429
1450
|
|
|
1430
1451
|
const {
|
|
1431
1452
|
invoke,
|
|
@@ -1824,7 +1845,7 @@ const getListHeight = (itemsLength, itemHeight, maxHeight) => {
|
|
|
1824
1845
|
|
|
1825
1846
|
const {
|
|
1826
1847
|
getPositionAtCursor
|
|
1827
|
-
} = EditorWorker
|
|
1848
|
+
} = EditorWorker;
|
|
1828
1849
|
|
|
1829
1850
|
const getWordAtOffset = getWordAtOffset2;
|
|
1830
1851
|
|
|
@@ -1863,7 +1884,7 @@ const handleEditorDeleteLeft = async state => {
|
|
|
1863
1884
|
|
|
1864
1885
|
const {
|
|
1865
1886
|
getWordBefore
|
|
1866
|
-
} = EditorWorker
|
|
1887
|
+
} = EditorWorker;
|
|
1867
1888
|
|
|
1868
1889
|
const handleEditorType = async state => {
|
|
1869
1890
|
const {
|
|
@@ -1969,7 +1990,7 @@ const handleWheel = (state, deltaMode, deltaY) => {
|
|
|
1969
1990
|
|
|
1970
1991
|
const {
|
|
1971
1992
|
sendMessagePortToExtensionHostWorker
|
|
1972
|
-
} = EditorWorker
|
|
1993
|
+
} = EditorWorker;
|
|
1973
1994
|
|
|
1974
1995
|
const createExtensionHostRpc = async () => {
|
|
1975
1996
|
try {
|