@lvce-editor/completion-worker 1.6.0 → 1.7.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 +14 -6
- package/package.json +1 -1
|
@@ -1029,7 +1029,8 @@ const create$2 = () => {
|
|
|
1029
1029
|
const {
|
|
1030
1030
|
get: get$1,
|
|
1031
1031
|
set: set$2,
|
|
1032
|
-
wrapCommand
|
|
1032
|
+
wrapCommand,
|
|
1033
|
+
dispose: dispose$1
|
|
1033
1034
|
} = create$2();
|
|
1034
1035
|
|
|
1035
1036
|
const create$1 = (uid, x, y, width, height, editorUid, editorLanguageId) => {
|
|
@@ -1108,6 +1109,10 @@ const diff2 = uid => {
|
|
|
1108
1109
|
return diffResult;
|
|
1109
1110
|
};
|
|
1110
1111
|
|
|
1112
|
+
const dispose = uid => {
|
|
1113
|
+
dispose$1(uid);
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1111
1116
|
const focusIndex = (state, index) => {
|
|
1112
1117
|
const newState = {
|
|
1113
1118
|
...state,
|
|
@@ -1239,8 +1244,9 @@ const executeCompletionProvider = async (editorUid, editorLanguageId, offset) =>
|
|
|
1239
1244
|
noProviderFoundMessage: 'no completion provider found',
|
|
1240
1245
|
noProviderFoundResult: []});
|
|
1241
1246
|
};
|
|
1242
|
-
const executeResolveCompletionItem = async (
|
|
1247
|
+
const executeResolveCompletionItem = async (editorUid, offset, name, completionItem) => {
|
|
1243
1248
|
return execute({
|
|
1249
|
+
editorUid,
|
|
1244
1250
|
event: OnCompletion,
|
|
1245
1251
|
method: CompletionResolveExecute,
|
|
1246
1252
|
args: [offset, name, completionItem],
|
|
@@ -1266,8 +1272,7 @@ const resolveCompletion = async (editorUid, name, completionItem) => {
|
|
|
1266
1272
|
string(name);
|
|
1267
1273
|
object(completionItem);
|
|
1268
1274
|
const offset = getOffsetAtCursor(editorUid);
|
|
1269
|
-
|
|
1270
|
-
const resolvedCompletionItem = await executeResolveCompletionItem(editor, offset, name, completionItem);
|
|
1275
|
+
const resolvedCompletionItem = await executeResolveCompletionItem(editorUid, offset, name, completionItem);
|
|
1271
1276
|
return resolvedCompletionItem;
|
|
1272
1277
|
} catch {
|
|
1273
1278
|
return undefined;
|
|
@@ -1339,6 +1344,8 @@ const getEdits = async (editorUid, leadingWord, completionItem) => {
|
|
|
1339
1344
|
return changes;
|
|
1340
1345
|
};
|
|
1341
1346
|
|
|
1347
|
+
const Completion = 3;
|
|
1348
|
+
|
|
1342
1349
|
const select = async (state, completionItem) => {
|
|
1343
1350
|
const {
|
|
1344
1351
|
editorUid,
|
|
@@ -1347,6 +1354,8 @@ const select = async (state, completionItem) => {
|
|
|
1347
1354
|
const changes = await getEdits(editorUid, leadingWord, completionItem);
|
|
1348
1355
|
// @ts-ignore
|
|
1349
1356
|
await invoke$1('Editor.applyEdit2', editorUid, changes);
|
|
1357
|
+
// @ts-ignore
|
|
1358
|
+
await invoke$1('Editor.closeWidget2', editorUid, Completion, 'Completions');
|
|
1350
1359
|
// TODO remove completion widget from editor
|
|
1351
1360
|
return {
|
|
1352
1361
|
...state
|
|
@@ -1393,8 +1402,6 @@ const CtrlCmd = 1 << 11 >>> 0;
|
|
|
1393
1402
|
const FocusEditorCompletions = 9;
|
|
1394
1403
|
const FocusEditorRename = 11;
|
|
1395
1404
|
|
|
1396
|
-
const Completion = 3;
|
|
1397
|
-
|
|
1398
1405
|
const getCommand = shortId => {
|
|
1399
1406
|
return {
|
|
1400
1407
|
command: 'Editor.executeWidgetCommand',
|
|
@@ -2205,6 +2212,7 @@ const terminate = () => {
|
|
|
2205
2212
|
const commandMap = {
|
|
2206
2213
|
'Completions.create': create$1,
|
|
2207
2214
|
'Completions.diff2': diff2,
|
|
2215
|
+
'Completions.dispose': dispose,
|
|
2208
2216
|
'Completions.focusFirst': wrapCommand(focusFirst),
|
|
2209
2217
|
'Completions.focusIndex': wrapCommand(focusIndex),
|
|
2210
2218
|
'Completions.focusNext': wrapCommand(focusNext),
|