@lvce-editor/editor-worker 7.19.0 → 7.21.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 +532 -423
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -903,7 +903,7 @@ 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$b = (ipc, method, ...params) => {
|
|
907
907
|
return invokeHelper(ipc, method, params, false);
|
|
908
908
|
};
|
|
909
909
|
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
@@ -942,7 +942,7 @@ const createRpc = ipc => {
|
|
|
942
942
|
send(ipc, method, ...params);
|
|
943
943
|
},
|
|
944
944
|
invoke(method, ...params) {
|
|
945
|
-
return invoke$
|
|
945
|
+
return invoke$b(ipc, method, ...params);
|
|
946
946
|
},
|
|
947
947
|
invokeAndTransfer(method, ...params) {
|
|
948
948
|
return invokeAndTransfer$1(ipc, method, ...params);
|
|
@@ -1153,23 +1153,23 @@ const RendererWorker = {
|
|
|
1153
1153
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
1154
1154
|
set: set$3$1};
|
|
1155
1155
|
const {
|
|
1156
|
-
invoke: invoke$
|
|
1156
|
+
invoke: invoke$a,
|
|
1157
1157
|
set: set$a} = create$9(MarkdownWorker$1);
|
|
1158
1158
|
const SyntaxHighlightingWorker = {
|
|
1159
1159
|
__proto__: null,
|
|
1160
|
-
invoke: invoke$
|
|
1160
|
+
invoke: invoke$a,
|
|
1161
1161
|
set: set$a
|
|
1162
1162
|
};
|
|
1163
1163
|
|
|
1164
1164
|
const {
|
|
1165
1165
|
set: set$8,
|
|
1166
|
-
invoke: invoke$
|
|
1166
|
+
invoke: invoke$8,
|
|
1167
1167
|
invokeAndTransfer
|
|
1168
1168
|
} = RendererWorker;
|
|
1169
1169
|
|
|
1170
1170
|
// TODO add tests for this
|
|
1171
1171
|
const activateByEvent = async event => {
|
|
1172
|
-
await invoke$
|
|
1172
|
+
await invoke$8('ExtensionHostManagement.activateByEvent', event);
|
|
1173
1173
|
};
|
|
1174
1174
|
|
|
1175
1175
|
const codeGeneratorAccept = state => {
|
|
@@ -1222,15 +1222,15 @@ const launchColorPickerWorker = async () => {
|
|
|
1222
1222
|
return launchWorker(name, url);
|
|
1223
1223
|
};
|
|
1224
1224
|
|
|
1225
|
-
let workerPromise$
|
|
1226
|
-
const getOrCreate$
|
|
1227
|
-
if (!workerPromise$
|
|
1228
|
-
workerPromise$
|
|
1225
|
+
let workerPromise$4;
|
|
1226
|
+
const getOrCreate$5 = () => {
|
|
1227
|
+
if (!workerPromise$4) {
|
|
1228
|
+
workerPromise$4 = launchColorPickerWorker();
|
|
1229
1229
|
}
|
|
1230
|
-
return workerPromise$
|
|
1230
|
+
return workerPromise$4;
|
|
1231
1231
|
};
|
|
1232
|
-
const invoke$
|
|
1233
|
-
const worker = await getOrCreate$
|
|
1232
|
+
const invoke$7 = async (method, ...params) => {
|
|
1233
|
+
const worker = await getOrCreate$5();
|
|
1234
1234
|
return await worker.invoke(method, ...params);
|
|
1235
1235
|
};
|
|
1236
1236
|
|
|
@@ -1242,10 +1242,10 @@ const loadContent$2 = async (state, parentUid) => {
|
|
|
1242
1242
|
width,
|
|
1243
1243
|
height
|
|
1244
1244
|
} = state;
|
|
1245
|
-
await invoke$
|
|
1246
|
-
await invoke$
|
|
1247
|
-
const diff = await invoke$
|
|
1248
|
-
const commands = await invoke$
|
|
1245
|
+
await invoke$7('ColorPicker.create', uid, x, y, width, height, parentUid);
|
|
1246
|
+
await invoke$7('ColorPicker.loadContent', uid);
|
|
1247
|
+
const diff = await invoke$7('ColorPicker.diff2', uid);
|
|
1248
|
+
const commands = await invoke$7('ColorPicker.render2', uid, diff);
|
|
1249
1249
|
return {
|
|
1250
1250
|
...state,
|
|
1251
1251
|
commands
|
|
@@ -1654,7 +1654,7 @@ const createMeasureContext = () => {
|
|
|
1654
1654
|
const state$8 = {
|
|
1655
1655
|
ctx: undefined
|
|
1656
1656
|
};
|
|
1657
|
-
const getOrCreate$
|
|
1657
|
+
const getOrCreate$4 = createCtx => {
|
|
1658
1658
|
if (state$8.ctx) {
|
|
1659
1659
|
return state$8.ctx;
|
|
1660
1660
|
}
|
|
@@ -1663,7 +1663,7 @@ const getOrCreate$3 = createCtx => {
|
|
|
1663
1663
|
};
|
|
1664
1664
|
|
|
1665
1665
|
const getContext = () => {
|
|
1666
|
-
const ctx = getOrCreate$
|
|
1666
|
+
const ctx = getOrCreate$4(createMeasureContext);
|
|
1667
1667
|
return ctx;
|
|
1668
1668
|
};
|
|
1669
1669
|
|
|
@@ -2186,7 +2186,7 @@ const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
|
2186
2186
|
|
|
2187
2187
|
const {
|
|
2188
2188
|
set: set$5,
|
|
2189
|
-
invoke: invoke$
|
|
2189
|
+
invoke: invoke$6} = ExtensionHost;
|
|
2190
2190
|
|
|
2191
2191
|
const ColorPicker$1 = 41;
|
|
2192
2192
|
const EditorCompletion = 9;
|
|
@@ -2215,7 +2215,7 @@ const execute = async ({
|
|
|
2215
2215
|
}) => {
|
|
2216
2216
|
const fullEvent = `${event}:${editor.languageId}`;
|
|
2217
2217
|
await activateByEvent(fullEvent);
|
|
2218
|
-
const result = await invoke$
|
|
2218
|
+
const result = await invoke$6(method, editor.uid, ...args);
|
|
2219
2219
|
return result;
|
|
2220
2220
|
};
|
|
2221
2221
|
|
|
@@ -2283,7 +2283,7 @@ const updateDiagnostics = async newState => {
|
|
|
2283
2283
|
// TODO don't really need text document sync response
|
|
2284
2284
|
// could perhaps save a lot of messages by using send instead of invoke
|
|
2285
2285
|
// @ts-ignore
|
|
2286
|
-
await invoke$
|
|
2286
|
+
await invoke$6(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
|
|
2287
2287
|
const diagnostics = await executeDiagnosticProvider(newState);
|
|
2288
2288
|
const latest = get$4(newState.id);
|
|
2289
2289
|
if (!latest) {
|
|
@@ -2297,7 +2297,7 @@ const updateDiagnostics = async newState => {
|
|
|
2297
2297
|
};
|
|
2298
2298
|
set$6(newState.id, latest.oldState, newEditor);
|
|
2299
2299
|
// @ts-ignore
|
|
2300
|
-
await invoke$
|
|
2300
|
+
await invoke$8('Editor.rerender', newState.id);
|
|
2301
2301
|
return newEditor;
|
|
2302
2302
|
} catch (error) {
|
|
2303
2303
|
// @ts-ignore
|
|
@@ -2443,7 +2443,7 @@ const createEditor = async ({
|
|
|
2443
2443
|
};
|
|
2444
2444
|
set$6(id, emptyEditor, newEditor4);
|
|
2445
2445
|
// @ts-ignore
|
|
2446
|
-
await invoke$
|
|
2446
|
+
await invoke$6(TextDocumentSyncFull, uri, id, languageId, content);
|
|
2447
2447
|
if (diagnosticsEnabled) {
|
|
2448
2448
|
updateDiagnostics(newEditor4);
|
|
2449
2449
|
}
|
|
@@ -2506,6 +2506,49 @@ const addCursorBelow = editor => {
|
|
|
2506
2506
|
};
|
|
2507
2507
|
};
|
|
2508
2508
|
|
|
2509
|
+
const getDocumentEdits = (editor, edits) => {
|
|
2510
|
+
const documentEdits = [];
|
|
2511
|
+
for (const edit of edits) {
|
|
2512
|
+
const start = positionAt(editor, edit.startOffset);
|
|
2513
|
+
const end = positionAt(editor, edit.endOffset);
|
|
2514
|
+
const deleted = getSelectionText(editor, {
|
|
2515
|
+
start,
|
|
2516
|
+
end
|
|
2517
|
+
});
|
|
2518
|
+
const documentEdit = {
|
|
2519
|
+
start,
|
|
2520
|
+
end,
|
|
2521
|
+
inserted: splitLines(edit.inserted),
|
|
2522
|
+
deleted,
|
|
2523
|
+
origin: Format
|
|
2524
|
+
};
|
|
2525
|
+
if (documentEdit.inserted.length === 0) {
|
|
2526
|
+
documentEdit.inserted = [''];
|
|
2527
|
+
}
|
|
2528
|
+
documentEdits.push(documentEdit);
|
|
2529
|
+
}
|
|
2530
|
+
return documentEdits;
|
|
2531
|
+
};
|
|
2532
|
+
|
|
2533
|
+
const warn = (...args) => {
|
|
2534
|
+
console.warn(...args);
|
|
2535
|
+
};
|
|
2536
|
+
const error = (...args) => {
|
|
2537
|
+
console.error(...args);
|
|
2538
|
+
};
|
|
2539
|
+
|
|
2540
|
+
const applyDocumentEdits = (editor, edits) => {
|
|
2541
|
+
if (!Array.isArray(edits)) {
|
|
2542
|
+
warn('something is wrong with format on save', edits);
|
|
2543
|
+
return editor;
|
|
2544
|
+
}
|
|
2545
|
+
if (edits.length === 0) {
|
|
2546
|
+
return editor;
|
|
2547
|
+
}
|
|
2548
|
+
const documentEdits = getDocumentEdits(editor, edits);
|
|
2549
|
+
return scheduleDocumentAndCursorsSelections(editor, documentEdits);
|
|
2550
|
+
};
|
|
2551
|
+
|
|
2509
2552
|
const applyEdit = async (editor, changes) => {
|
|
2510
2553
|
object(editor);
|
|
2511
2554
|
array(changes);
|
|
@@ -2797,7 +2840,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
2797
2840
|
const y$1 = y(editor, rowIndex);
|
|
2798
2841
|
const displayErrorMessage = message;
|
|
2799
2842
|
// @ts-ignore
|
|
2800
|
-
await invoke$
|
|
2843
|
+
await invoke$8('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
|
|
2801
2844
|
if (!isError) {
|
|
2802
2845
|
const handleTimeout = () => {
|
|
2803
2846
|
editorHideMessage(editor);
|
|
@@ -2854,7 +2897,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
2854
2897
|
// @ts-ignore
|
|
2855
2898
|
const offset = offsetAt(editor, editor.cursor);
|
|
2856
2899
|
// @ts-ignore
|
|
2857
|
-
const result = await invoke$
|
|
2900
|
+
const result = await invoke$8('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
2858
2901
|
if (result) {
|
|
2859
2902
|
const closingBrace = getMatchingClosingBrace$1(text);
|
|
2860
2903
|
const insertText = text + closingBrace;
|
|
@@ -2953,15 +2996,15 @@ const launchRenameWorker = async () => {
|
|
|
2953
2996
|
return rpc;
|
|
2954
2997
|
};
|
|
2955
2998
|
|
|
2956
|
-
let workerPromise$
|
|
2957
|
-
const getOrCreate$
|
|
2958
|
-
if (!workerPromise$
|
|
2959
|
-
workerPromise$
|
|
2999
|
+
let workerPromise$3;
|
|
3000
|
+
const getOrCreate$3 = () => {
|
|
3001
|
+
if (!workerPromise$3) {
|
|
3002
|
+
workerPromise$3 = launchRenameWorker();
|
|
2960
3003
|
}
|
|
2961
|
-
return workerPromise$
|
|
3004
|
+
return workerPromise$3;
|
|
2962
3005
|
};
|
|
2963
|
-
const invoke$
|
|
2964
|
-
const worker = await getOrCreate$
|
|
3006
|
+
const invoke$5 = async (method, ...params) => {
|
|
3007
|
+
const worker = await getOrCreate$3();
|
|
2965
3008
|
return await worker.invoke(method, ...params);
|
|
2966
3009
|
};
|
|
2967
3010
|
|
|
@@ -2979,7 +3022,7 @@ const closeRename = async editor => {
|
|
|
2979
3022
|
return editor;
|
|
2980
3023
|
}
|
|
2981
3024
|
const renameWidget = widgets[renameWidgetIndex];
|
|
2982
|
-
await invoke$
|
|
3025
|
+
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
2983
3026
|
const latest = get$4(uid);
|
|
2984
3027
|
const {
|
|
2985
3028
|
newState
|
|
@@ -3016,21 +3059,21 @@ const hasWidget = (widgets, id) => {
|
|
|
3016
3059
|
|
|
3017
3060
|
const setAdditionalFocus = async focusKey => {
|
|
3018
3061
|
// @ts-ignore
|
|
3019
|
-
await invoke$
|
|
3062
|
+
await invoke$8('Focus.setAdditionalFocus', focusKey);
|
|
3020
3063
|
};
|
|
3021
3064
|
|
|
3022
3065
|
const setFocus = async focusKey => {
|
|
3023
3066
|
if (!focusKey) {
|
|
3024
3067
|
return;
|
|
3025
3068
|
}
|
|
3026
|
-
await invoke$
|
|
3069
|
+
await invoke$8('Focus.setFocus', focusKey);
|
|
3027
3070
|
};
|
|
3028
3071
|
const unsetAdditionalFocus = async focusKey => {
|
|
3029
3072
|
if (!focusKey) {
|
|
3030
3073
|
return;
|
|
3031
3074
|
}
|
|
3032
3075
|
// @ts-ignore
|
|
3033
|
-
await invoke$
|
|
3076
|
+
await invoke$8('Focus.removeAdditionalFocus', focusKey);
|
|
3034
3077
|
};
|
|
3035
3078
|
|
|
3036
3079
|
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
@@ -3091,11 +3134,11 @@ const create$6 = () => {
|
|
|
3091
3134
|
return widget;
|
|
3092
3135
|
};
|
|
3093
3136
|
|
|
3094
|
-
const newStateGenerator$
|
|
3137
|
+
const newStateGenerator$6 = (state, parentUid) => {
|
|
3095
3138
|
return loadContent$2(state, parentUid);
|
|
3096
3139
|
};
|
|
3097
3140
|
const openColorPicker = async editor => {
|
|
3098
|
-
return addWidgetToEditor(ColorPicker, ColorPicker$1, editor, create$6, newStateGenerator$
|
|
3141
|
+
return addWidgetToEditor(ColorPicker, ColorPicker$1, editor, create$6, newStateGenerator$6);
|
|
3099
3142
|
};
|
|
3100
3143
|
|
|
3101
3144
|
const state$6 = {
|
|
@@ -3151,7 +3194,7 @@ const compositionEnd = (editor, data) => {
|
|
|
3151
3194
|
const writeText = async text => {
|
|
3152
3195
|
try {
|
|
3153
3196
|
string(text);
|
|
3154
|
-
await invoke$
|
|
3197
|
+
await invoke$8('ClipBoard.writeText', /* text */text);
|
|
3155
3198
|
} catch (error) {
|
|
3156
3199
|
throw new VError(error, 'Failed to write text to clipboard');
|
|
3157
3200
|
}
|
|
@@ -3788,7 +3831,7 @@ const deleteWordRight = editor => {
|
|
|
3788
3831
|
|
|
3789
3832
|
const findAllReferences = async editor => {
|
|
3790
3833
|
// @ts-ignore
|
|
3791
|
-
await invoke$
|
|
3834
|
+
await invoke$8('SideBar.show', 'References', /* focus */true);
|
|
3792
3835
|
return editor;
|
|
3793
3836
|
};
|
|
3794
3837
|
|
|
@@ -3808,49 +3851,6 @@ const isFormattingError = error => {
|
|
|
3808
3851
|
return error && error instanceof Error && error.message.startsWith(expectedErrorMessage$1);
|
|
3809
3852
|
};
|
|
3810
3853
|
|
|
3811
|
-
const getDocumentEdits = (editor, edits) => {
|
|
3812
|
-
const documentEdits = [];
|
|
3813
|
-
for (const edit of edits) {
|
|
3814
|
-
const start = positionAt(editor, edit.startOffset);
|
|
3815
|
-
const end = positionAt(editor, edit.endOffset);
|
|
3816
|
-
const deleted = getSelectionText(editor, {
|
|
3817
|
-
start,
|
|
3818
|
-
end
|
|
3819
|
-
});
|
|
3820
|
-
const documentEdit = {
|
|
3821
|
-
start,
|
|
3822
|
-
end,
|
|
3823
|
-
inserted: splitLines(edit.inserted),
|
|
3824
|
-
deleted,
|
|
3825
|
-
origin: Format
|
|
3826
|
-
};
|
|
3827
|
-
if (documentEdit.inserted.length === 0) {
|
|
3828
|
-
documentEdit.inserted = [''];
|
|
3829
|
-
}
|
|
3830
|
-
documentEdits.push(documentEdit);
|
|
3831
|
-
}
|
|
3832
|
-
return documentEdits;
|
|
3833
|
-
};
|
|
3834
|
-
|
|
3835
|
-
const warn = (...args) => {
|
|
3836
|
-
console.warn(...args);
|
|
3837
|
-
};
|
|
3838
|
-
const error = (...args) => {
|
|
3839
|
-
console.error(...args);
|
|
3840
|
-
};
|
|
3841
|
-
|
|
3842
|
-
const applyDocumentEdits = (editor, edits) => {
|
|
3843
|
-
if (!Array.isArray(edits)) {
|
|
3844
|
-
warn('something is wrong with format on save', edits);
|
|
3845
|
-
return editor;
|
|
3846
|
-
}
|
|
3847
|
-
if (edits.length === 0) {
|
|
3848
|
-
return editor;
|
|
3849
|
-
}
|
|
3850
|
-
const documentEdits = getDocumentEdits(editor, edits);
|
|
3851
|
-
return scheduleDocumentAndCursorsSelections(editor, documentEdits);
|
|
3852
|
-
};
|
|
3853
|
-
|
|
3854
3854
|
const expectedErrorMessage = 'Failed to execute formatting provider: FormattingError:';
|
|
3855
3855
|
|
|
3856
3856
|
// TODO also format with cursor
|
|
@@ -3919,7 +3919,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
|
|
|
3919
3919
|
// @ts-ignore
|
|
3920
3920
|
const getDefinition = async (editor, offset) => {
|
|
3921
3921
|
// @ts-ignore
|
|
3922
|
-
const definition = await invoke$
|
|
3922
|
+
const definition = await invoke$8('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
|
|
3923
3923
|
return definition;
|
|
3924
3924
|
};
|
|
3925
3925
|
|
|
@@ -4102,7 +4102,7 @@ const goTo = async ({
|
|
|
4102
4102
|
endRowIndex: definition.endRowIndex,
|
|
4103
4103
|
endColumnIndex: definition.endColumnIndex
|
|
4104
4104
|
};
|
|
4105
|
-
await invoke$
|
|
4105
|
+
await invoke$8(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
|
|
4106
4106
|
return editor;
|
|
4107
4107
|
} catch (error) {
|
|
4108
4108
|
// TODO if editor is already disposed at this point, do nothing
|
|
@@ -4180,7 +4180,7 @@ const getNoLocationFoundMessage = info => {
|
|
|
4180
4180
|
|
|
4181
4181
|
const getTypeDefinition = async (editor, offset) => {
|
|
4182
4182
|
// @ts-ignore
|
|
4183
|
-
const definition = await invoke$
|
|
4183
|
+
const definition = await invoke$8('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
|
|
4184
4184
|
return definition;
|
|
4185
4185
|
};
|
|
4186
4186
|
|
|
@@ -4220,7 +4220,7 @@ const goToTypeDefinition = async (editor, explicit = true) => {
|
|
|
4220
4220
|
const Editor = 3;
|
|
4221
4221
|
|
|
4222
4222
|
const handleContextMenu = async (editor, button, x, y) => {
|
|
4223
|
-
await invoke$
|
|
4223
|
+
await invoke$8(/* ContextMenu.show */'ContextMenu.show', /* x */x, /* y */y, /* id */Editor);
|
|
4224
4224
|
return editor;
|
|
4225
4225
|
};
|
|
4226
4226
|
|
|
@@ -4258,7 +4258,7 @@ const WhenExpressionEditorText = 12;
|
|
|
4258
4258
|
const handleFocus$1 = editor => {
|
|
4259
4259
|
// TODO make change events functional,
|
|
4260
4260
|
// when rendering, send focus changes to renderer worker
|
|
4261
|
-
invoke$
|
|
4261
|
+
invoke$8('Focus.setFocus', WhenExpressionEditorText);
|
|
4262
4262
|
return editor;
|
|
4263
4263
|
};
|
|
4264
4264
|
|
|
@@ -4917,7 +4917,7 @@ const indentMore = editor => {
|
|
|
4917
4917
|
|
|
4918
4918
|
const getLanguageConfiguration = async editor => {
|
|
4919
4919
|
// @ts-ignore
|
|
4920
|
-
return invoke$
|
|
4920
|
+
return invoke$8('Languages.getLanguageConfiguration', {
|
|
4921
4921
|
uri: editor.uri,
|
|
4922
4922
|
languageId: editor.languageId
|
|
4923
4923
|
});
|
|
@@ -5220,7 +5220,7 @@ const create$5 = () => {
|
|
|
5220
5220
|
return widget;
|
|
5221
5221
|
};
|
|
5222
5222
|
|
|
5223
|
-
const newStateGenerator$
|
|
5223
|
+
const newStateGenerator$5 = async state => {
|
|
5224
5224
|
const latestState = {
|
|
5225
5225
|
...state,
|
|
5226
5226
|
x: 100,
|
|
@@ -5232,7 +5232,7 @@ const newStateGenerator$4 = async state => {
|
|
|
5232
5232
|
};
|
|
5233
5233
|
const openCodeGenerator = async editor => {
|
|
5234
5234
|
const fullFocus = true;
|
|
5235
|
-
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$5, newStateGenerator$
|
|
5235
|
+
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$5, newStateGenerator$5, fullFocus);
|
|
5236
5236
|
};
|
|
5237
5237
|
|
|
5238
5238
|
const create$4 = () => {
|
|
@@ -5267,19 +5267,19 @@ const launchCompletionWorker = async () => {
|
|
|
5267
5267
|
return rpc;
|
|
5268
5268
|
};
|
|
5269
5269
|
|
|
5270
|
-
let workerPromise$
|
|
5271
|
-
const getOrCreate$
|
|
5272
|
-
if (!workerPromise$
|
|
5273
|
-
workerPromise$
|
|
5270
|
+
let workerPromise$2;
|
|
5271
|
+
const getOrCreate$2 = () => {
|
|
5272
|
+
if (!workerPromise$2) {
|
|
5273
|
+
workerPromise$2 = launchCompletionWorker();
|
|
5274
5274
|
}
|
|
5275
|
-
return workerPromise$
|
|
5275
|
+
return workerPromise$2;
|
|
5276
5276
|
};
|
|
5277
|
-
const invoke$
|
|
5278
|
-
const worker = await getOrCreate$
|
|
5277
|
+
const invoke$4 = async (method, ...params) => {
|
|
5278
|
+
const worker = await getOrCreate$2();
|
|
5279
5279
|
return await worker.invoke(method, ...params);
|
|
5280
5280
|
};
|
|
5281
5281
|
|
|
5282
|
-
const newStateGenerator$
|
|
5282
|
+
const newStateGenerator$4 = async (state, parentUid) => {
|
|
5283
5283
|
const {
|
|
5284
5284
|
uid,
|
|
5285
5285
|
x,
|
|
@@ -5293,10 +5293,10 @@ const newStateGenerator$3 = async (state, parentUid) => {
|
|
|
5293
5293
|
const {
|
|
5294
5294
|
languageId
|
|
5295
5295
|
} = newState;
|
|
5296
|
-
await invoke$
|
|
5297
|
-
await invoke$
|
|
5298
|
-
const diff = await invoke$
|
|
5299
|
-
const commands = await invoke$
|
|
5296
|
+
await invoke$4('Completions.create', uid, x, y, width, height, parentUid, languageId);
|
|
5297
|
+
await invoke$4('Completions.loadContent', uid);
|
|
5298
|
+
const diff = await invoke$4('Completions.diff2', uid);
|
|
5299
|
+
const commands = await invoke$4('Completions.render2', uid, diff);
|
|
5300
5300
|
return {
|
|
5301
5301
|
...state,
|
|
5302
5302
|
commands
|
|
@@ -5304,7 +5304,7 @@ const newStateGenerator$3 = async (state, parentUid) => {
|
|
|
5304
5304
|
};
|
|
5305
5305
|
const openCompletion = async editor => {
|
|
5306
5306
|
const fullFocus = false;
|
|
5307
|
-
return addWidgetToEditor(Completion, EditorCompletion, editor, create$4, newStateGenerator$
|
|
5307
|
+
return addWidgetToEditor(Completion, EditorCompletion, editor, create$4, newStateGenerator$4, fullFocus);
|
|
5308
5308
|
};
|
|
5309
5309
|
|
|
5310
5310
|
const create$3 = () => {
|
|
@@ -5339,15 +5339,15 @@ const launchFindWidgetWorker = async () => {
|
|
|
5339
5339
|
return launchWorker(name, url);
|
|
5340
5340
|
};
|
|
5341
5341
|
|
|
5342
|
-
let workerPromise;
|
|
5343
|
-
const getOrCreate = () => {
|
|
5344
|
-
if (!workerPromise) {
|
|
5345
|
-
workerPromise = launchFindWidgetWorker();
|
|
5342
|
+
let workerPromise$1;
|
|
5343
|
+
const getOrCreate$1 = () => {
|
|
5344
|
+
if (!workerPromise$1) {
|
|
5345
|
+
workerPromise$1 = launchFindWidgetWorker();
|
|
5346
5346
|
}
|
|
5347
|
-
return workerPromise;
|
|
5347
|
+
return workerPromise$1;
|
|
5348
5348
|
};
|
|
5349
|
-
const invoke$
|
|
5350
|
-
const worker = await getOrCreate();
|
|
5349
|
+
const invoke$3 = async (method, ...params) => {
|
|
5350
|
+
const worker = await getOrCreate$1();
|
|
5351
5351
|
return await worker.invoke(method, ...params);
|
|
5352
5352
|
};
|
|
5353
5353
|
|
|
@@ -5373,22 +5373,22 @@ const loadContent$1 = async (state, parentUid) => {
|
|
|
5373
5373
|
width,
|
|
5374
5374
|
height
|
|
5375
5375
|
} = editor;
|
|
5376
|
-
await invoke$
|
|
5377
|
-
await invoke$
|
|
5378
|
-
const diff = await invoke$
|
|
5379
|
-
const commands = await invoke$
|
|
5376
|
+
await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
|
|
5377
|
+
await invoke$3('FindWidget.loadContent', uid);
|
|
5378
|
+
const diff = await invoke$3('FindWidget.diff2', uid);
|
|
5379
|
+
const commands = await invoke$3('FindWidget.render2', uid, diff);
|
|
5380
5380
|
return {
|
|
5381
5381
|
...state,
|
|
5382
5382
|
commands
|
|
5383
5383
|
};
|
|
5384
5384
|
};
|
|
5385
5385
|
|
|
5386
|
-
const newStateGenerator$
|
|
5386
|
+
const newStateGenerator$3 = (state, parentUid) => {
|
|
5387
5387
|
return loadContent$1(state, parentUid);
|
|
5388
5388
|
};
|
|
5389
5389
|
const openFind2 = async editor => {
|
|
5390
5390
|
const fullFocus = true;
|
|
5391
|
-
return addWidgetToEditor(ColorPicker, FindWidget, editor, create$3, newStateGenerator$
|
|
5391
|
+
return addWidgetToEditor(ColorPicker, FindWidget, editor, create$3, newStateGenerator$3, fullFocus);
|
|
5392
5392
|
};
|
|
5393
5393
|
|
|
5394
5394
|
const openFind = async state => {
|
|
@@ -5435,7 +5435,7 @@ const create$2 = () => {
|
|
|
5435
5435
|
return renameWidget;
|
|
5436
5436
|
};
|
|
5437
5437
|
|
|
5438
|
-
const newStateGenerator$
|
|
5438
|
+
const newStateGenerator$2 = async (state, parentUid) => {
|
|
5439
5439
|
const {
|
|
5440
5440
|
uid,
|
|
5441
5441
|
x,
|
|
@@ -5449,10 +5449,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
5449
5449
|
const {
|
|
5450
5450
|
languageId
|
|
5451
5451
|
} = newState;
|
|
5452
|
-
await invoke$
|
|
5453
|
-
await invoke$
|
|
5454
|
-
const diff = await invoke$
|
|
5455
|
-
const commands = await invoke$
|
|
5452
|
+
await invoke$5('Rename.create', uid, x, y, width, height, parentUid, languageId);
|
|
5453
|
+
await invoke$5('Rename.loadContent', uid);
|
|
5454
|
+
const diff = await invoke$5('Rename.diff2', uid);
|
|
5455
|
+
const commands = await invoke$5('Rename.render2', uid, diff);
|
|
5456
5456
|
return {
|
|
5457
5457
|
...state,
|
|
5458
5458
|
commands
|
|
@@ -5470,7 +5470,7 @@ const openRename = async editor => {
|
|
|
5470
5470
|
return editor;
|
|
5471
5471
|
}
|
|
5472
5472
|
const fullFocus = true;
|
|
5473
|
-
return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$2, newStateGenerator$
|
|
5473
|
+
return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$2, newStateGenerator$2, fullFocus);
|
|
5474
5474
|
};
|
|
5475
5475
|
|
|
5476
5476
|
const getOrganizeImportEdits = async editor => {
|
|
@@ -5499,7 +5499,7 @@ const pasteText = (editor, text) => {
|
|
|
5499
5499
|
|
|
5500
5500
|
const paste = async editor => {
|
|
5501
5501
|
// @ts-ignore
|
|
5502
|
-
const text = await invoke$
|
|
5502
|
+
const text = await invoke$8('ClipBoard.readText');
|
|
5503
5503
|
string(text);
|
|
5504
5504
|
return pasteText(editor, text);
|
|
5505
5505
|
};
|
|
@@ -5641,7 +5641,7 @@ const save = async editor => {
|
|
|
5641
5641
|
} = editor;
|
|
5642
5642
|
const newEditor = await getNewEditor(editor);
|
|
5643
5643
|
const content = getText$1(newEditor);
|
|
5644
|
-
await invoke$
|
|
5644
|
+
await invoke$8('FileSystem.writeFile', uri, content);
|
|
5645
5645
|
return newEditor;
|
|
5646
5646
|
} catch (error) {
|
|
5647
5647
|
// @ts-ignore
|
|
@@ -5948,7 +5948,7 @@ const selectInsideString = editor => {
|
|
|
5948
5948
|
|
|
5949
5949
|
const getNewSelections = async (editor, selections) => {
|
|
5950
5950
|
// @ts-ignore
|
|
5951
|
-
const newSelections = await invoke$
|
|
5951
|
+
const newSelections = await invoke$8('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
5952
5952
|
if (newSelections.length === 0) {
|
|
5953
5953
|
return selections;
|
|
5954
5954
|
}
|
|
@@ -6202,7 +6202,7 @@ const getEnabled$1 = () => {
|
|
|
6202
6202
|
|
|
6203
6203
|
const {
|
|
6204
6204
|
set: set$3,
|
|
6205
|
-
invoke: invoke$
|
|
6205
|
+
invoke: invoke$2} = SyntaxHighlightingWorker;
|
|
6206
6206
|
|
|
6207
6207
|
/**
|
|
6208
6208
|
* @enum number
|
|
@@ -6272,7 +6272,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
6272
6272
|
}
|
|
6273
6273
|
if (getEnabled$1()) {
|
|
6274
6274
|
// @ts-ignore
|
|
6275
|
-
const tokenMap = await invoke$
|
|
6275
|
+
const tokenMap = await invoke$2('Tokenizer.load', languageId, tokenizePath);
|
|
6276
6276
|
set$1(languageId, tokenMap);
|
|
6277
6277
|
return;
|
|
6278
6278
|
}
|
|
@@ -6624,24 +6624,38 @@ const loadHoverContent = async state => {
|
|
|
6624
6624
|
};
|
|
6625
6625
|
};
|
|
6626
6626
|
|
|
6627
|
-
const newStateGenerator = async state => {
|
|
6627
|
+
const newStateGenerator$1 = async state => {
|
|
6628
6628
|
return loadHoverContent(state);
|
|
6629
6629
|
};
|
|
6630
6630
|
const showHover2 = async editor => {
|
|
6631
|
-
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$1, newStateGenerator);
|
|
6631
|
+
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$1, newStateGenerator$1);
|
|
6632
6632
|
};
|
|
6633
6633
|
|
|
6634
6634
|
const EditorHover = 'EditorHover';
|
|
6635
6635
|
const showHover = async state => {
|
|
6636
|
-
await invoke$
|
|
6636
|
+
await invoke$8('Viewlet.openWidget', EditorHover);
|
|
6637
6637
|
return state;
|
|
6638
6638
|
};
|
|
6639
6639
|
|
|
6640
|
+
const filterActions = (sourceActions, languageId) => {
|
|
6641
|
+
return sourceActions.filter(action => action.languageId === languageId);
|
|
6642
|
+
};
|
|
6643
|
+
|
|
6640
6644
|
// TODO ask extension host worker instead
|
|
6641
|
-
const getEditorSourceActions = async
|
|
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;
|
|
6642
6655
|
// @ts-ignore
|
|
6643
|
-
const
|
|
6644
|
-
|
|
6656
|
+
const allActions = await invoke$8('GetEditorSourceActions.getEditorSourceActions');
|
|
6657
|
+
const filtered = filterActions(allActions, languageId);
|
|
6658
|
+
return filtered;
|
|
6645
6659
|
};
|
|
6646
6660
|
|
|
6647
6661
|
const getHeight = sourceActionCount => {
|
|
@@ -6704,7 +6718,8 @@ const create = () => {
|
|
|
6704
6718
|
height: 0,
|
|
6705
6719
|
focusedIndex: 0,
|
|
6706
6720
|
sourceActions: [],
|
|
6707
|
-
maxHeight: 0
|
|
6721
|
+
maxHeight: 0,
|
|
6722
|
+
commands: []
|
|
6708
6723
|
},
|
|
6709
6724
|
newState: {
|
|
6710
6725
|
uid: completionUid,
|
|
@@ -6714,19 +6729,67 @@ const create = () => {
|
|
|
6714
6729
|
height: 0,
|
|
6715
6730
|
focusedIndex: 0,
|
|
6716
6731
|
sourceActions: [],
|
|
6717
|
-
maxHeight: 0
|
|
6732
|
+
maxHeight: 0,
|
|
6733
|
+
commands: []
|
|
6718
6734
|
}
|
|
6719
6735
|
};
|
|
6720
6736
|
return widget;
|
|
6721
6737
|
};
|
|
6722
6738
|
|
|
6723
|
-
const showSourceActions = async editor => {
|
|
6739
|
+
const showSourceActions$1 = async editor => {
|
|
6724
6740
|
const newStateGenerator = async state => {
|
|
6725
6741
|
return loadSourceActions(editor, state);
|
|
6726
6742
|
};
|
|
6727
6743
|
return addWidgetToEditor(SourceAction$1, SourceActions, editor, create, newStateGenerator);
|
|
6728
6744
|
};
|
|
6729
6745
|
|
|
6746
|
+
const launchSourceActionWorker = async () => {
|
|
6747
|
+
const name = 'Source Action Worker';
|
|
6748
|
+
const url = 'sourceActionWorkerMain.js';
|
|
6749
|
+
const intializeCommand = 'SourceActions.initialize';
|
|
6750
|
+
const rpc = await launchWorker(name, url, intializeCommand);
|
|
6751
|
+
return rpc;
|
|
6752
|
+
};
|
|
6753
|
+
|
|
6754
|
+
let workerPromise;
|
|
6755
|
+
const getOrCreate = () => {
|
|
6756
|
+
if (!workerPromise) {
|
|
6757
|
+
workerPromise = launchSourceActionWorker();
|
|
6758
|
+
}
|
|
6759
|
+
return workerPromise;
|
|
6760
|
+
};
|
|
6761
|
+
const invoke$1 = async (method, ...params) => {
|
|
6762
|
+
const worker = await getOrCreate();
|
|
6763
|
+
return await worker.invoke(method, ...params);
|
|
6764
|
+
};
|
|
6765
|
+
|
|
6766
|
+
const newStateGenerator = async (state, parentUid) => {
|
|
6767
|
+
const {
|
|
6768
|
+
uid,
|
|
6769
|
+
x,
|
|
6770
|
+
y,
|
|
6771
|
+
width,
|
|
6772
|
+
height
|
|
6773
|
+
} = state;
|
|
6774
|
+
const {
|
|
6775
|
+
newState
|
|
6776
|
+
} = get$4(parentUid);
|
|
6777
|
+
const {
|
|
6778
|
+
languageId
|
|
6779
|
+
} = newState;
|
|
6780
|
+
await invoke$1('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
|
|
6781
|
+
await invoke$1('SourceActions.loadContent', uid);
|
|
6782
|
+
const diff = await invoke$1('SourceActions.diff2', uid);
|
|
6783
|
+
const commands = await invoke$1('SourceActions.render2', uid, diff);
|
|
6784
|
+
return {
|
|
6785
|
+
...state,
|
|
6786
|
+
commands
|
|
6787
|
+
};
|
|
6788
|
+
};
|
|
6789
|
+
const showSourceActions = async editor => {
|
|
6790
|
+
return addWidgetToEditor(SourceAction$1, SourceActions, editor, create, newStateGenerator);
|
|
6791
|
+
};
|
|
6792
|
+
|
|
6730
6793
|
const compareString = (a, b) => {
|
|
6731
6794
|
return a.localeCompare(b);
|
|
6732
6795
|
};
|
|
@@ -7301,7 +7364,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
7301
7364
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
7302
7365
|
const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
7303
7366
|
// @ts-ignore
|
|
7304
|
-
const result = await invoke$
|
|
7367
|
+
const result = await invoke$8('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
|
|
7305
7368
|
if (!result) {
|
|
7306
7369
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
7307
7370
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
@@ -7563,13 +7626,15 @@ const addWidget$1 = (widget, id, render) => {
|
|
|
7563
7626
|
const getWidgetInvoke = widgetId => {
|
|
7564
7627
|
switch (widgetId) {
|
|
7565
7628
|
case ColorPicker:
|
|
7566
|
-
return invoke$
|
|
7629
|
+
return invoke$7;
|
|
7567
7630
|
case Completion:
|
|
7568
|
-
return invoke$
|
|
7631
|
+
return invoke$4;
|
|
7569
7632
|
case Find:
|
|
7570
|
-
return invoke$
|
|
7633
|
+
return invoke$3;
|
|
7571
7634
|
case Rename:
|
|
7572
|
-
return invoke$
|
|
7635
|
+
return invoke$5;
|
|
7636
|
+
case SourceAction$1:
|
|
7637
|
+
return invoke$1;
|
|
7573
7638
|
default:
|
|
7574
7639
|
return undefined;
|
|
7575
7640
|
}
|
|
@@ -7673,45 +7738,45 @@ const remove$7 = widget => {
|
|
|
7673
7738
|
return [['Viewlet.dispose', widget.newState.uid]];
|
|
7674
7739
|
};
|
|
7675
7740
|
const {
|
|
7676
|
-
focusFirst,
|
|
7677
|
-
focusIndex: focusIndex$
|
|
7678
|
-
focusLast,
|
|
7679
|
-
focusNext: focusNext$
|
|
7680
|
-
focusPrevious: focusPrevious$
|
|
7741
|
+
focusFirst: focusFirst$1,
|
|
7742
|
+
focusIndex: focusIndex$2,
|
|
7743
|
+
focusLast: focusLast$1,
|
|
7744
|
+
focusNext: focusNext$3,
|
|
7745
|
+
focusPrevious: focusPrevious$2,
|
|
7681
7746
|
handleEditorBlur,
|
|
7682
7747
|
handleEditorClick,
|
|
7683
7748
|
handleEditorDeleteLeft: handleEditorDeleteLeft$1,
|
|
7684
7749
|
handleEditorType: handleEditorType$1,
|
|
7685
7750
|
openDetails,
|
|
7686
|
-
selectCurrent,
|
|
7687
|
-
selectIndex,
|
|
7688
|
-
toggleDetails,
|
|
7689
|
-
closeDetails,
|
|
7690
|
-
handleWheel,
|
|
7691
|
-
close: close$
|
|
7751
|
+
selectCurrent: selectCurrent$1,
|
|
7752
|
+
selectIndex: selectIndex$1,
|
|
7753
|
+
toggleDetails: toggleDetails$1,
|
|
7754
|
+
closeDetails: closeDetails$1,
|
|
7755
|
+
handleWheel: handleWheel$1,
|
|
7756
|
+
close: close$3
|
|
7692
7757
|
} = createFns(['handleEditorType', 'focusFirst', 'focusNext', 'focusPrevious', 'focusLast', 'handleEditorDeleteLeft', 'openDetails', 'focusIndex', 'handleEditorBlur', 'handleEditorClick', 'openDetails', 'selectCurrent', 'selectIndex', 'toggleDetails', 'closeDetails', 'handleWheel', 'close'], 'Completions', Completion);
|
|
7693
7758
|
|
|
7694
7759
|
const EditorCompletionWidget = {
|
|
7695
7760
|
__proto__: null,
|
|
7696
7761
|
add: add$7,
|
|
7697
|
-
close: close$
|
|
7698
|
-
closeDetails,
|
|
7699
|
-
focusFirst,
|
|
7700
|
-
focusIndex: focusIndex$
|
|
7701
|
-
focusLast,
|
|
7702
|
-
focusNext: focusNext$
|
|
7703
|
-
focusPrevious: focusPrevious$
|
|
7762
|
+
close: close$3,
|
|
7763
|
+
closeDetails: closeDetails$1,
|
|
7764
|
+
focusFirst: focusFirst$1,
|
|
7765
|
+
focusIndex: focusIndex$2,
|
|
7766
|
+
focusLast: focusLast$1,
|
|
7767
|
+
focusNext: focusNext$3,
|
|
7768
|
+
focusPrevious: focusPrevious$2,
|
|
7704
7769
|
handleEditorBlur,
|
|
7705
7770
|
handleEditorClick,
|
|
7706
7771
|
handleEditorDeleteLeft: handleEditorDeleteLeft$1,
|
|
7707
7772
|
handleEditorType: handleEditorType$1,
|
|
7708
|
-
handleWheel,
|
|
7773
|
+
handleWheel: handleWheel$1,
|
|
7709
7774
|
openDetails,
|
|
7710
7775
|
remove: remove$7,
|
|
7711
7776
|
render: render$c,
|
|
7712
|
-
selectCurrent,
|
|
7713
|
-
selectIndex,
|
|
7714
|
-
toggleDetails
|
|
7777
|
+
selectCurrent: selectCurrent$1,
|
|
7778
|
+
selectIndex: selectIndex$1,
|
|
7779
|
+
toggleDetails: toggleDetails$1
|
|
7715
7780
|
};
|
|
7716
7781
|
|
|
7717
7782
|
const renderFull$3 = (oldState, newState) => {
|
|
@@ -7743,12 +7808,12 @@ const remove$6 = widget => {
|
|
|
7743
7808
|
return [['Viewlet.dispose', widget.newState.uid]];
|
|
7744
7809
|
};
|
|
7745
7810
|
const {
|
|
7746
|
-
close: close$
|
|
7811
|
+
close: close$2,
|
|
7747
7812
|
focusCloseButton,
|
|
7748
7813
|
focusFind,
|
|
7749
|
-
focusNext: focusNext$
|
|
7814
|
+
focusNext: focusNext$2,
|
|
7750
7815
|
focusNextMatchButton,
|
|
7751
|
-
focusPrevious,
|
|
7816
|
+
focusPrevious: focusPrevious$1,
|
|
7752
7817
|
focusPreviousMatchButton,
|
|
7753
7818
|
focusReplace,
|
|
7754
7819
|
focusReplaceAllButton,
|
|
@@ -7766,12 +7831,12 @@ const {
|
|
|
7766
7831
|
const EditorFindWidget = {
|
|
7767
7832
|
__proto__: null,
|
|
7768
7833
|
add: add$6,
|
|
7769
|
-
close: close$
|
|
7834
|
+
close: close$2,
|
|
7770
7835
|
focusCloseButton,
|
|
7771
7836
|
focusFind,
|
|
7772
|
-
focusNext: focusNext$
|
|
7837
|
+
focusNext: focusNext$2,
|
|
7773
7838
|
focusNextMatchButton,
|
|
7774
|
-
focusPrevious,
|
|
7839
|
+
focusPrevious: focusPrevious$1,
|
|
7775
7840
|
focusPreviousMatchButton,
|
|
7776
7841
|
focusReplace,
|
|
7777
7842
|
focusReplaceAllButton,
|
|
@@ -8018,7 +8083,7 @@ const remove$5 = widget => {
|
|
|
8018
8083
|
};
|
|
8019
8084
|
const {
|
|
8020
8085
|
handleInput,
|
|
8021
|
-
close,
|
|
8086
|
+
close: close$1,
|
|
8022
8087
|
accept
|
|
8023
8088
|
} = createFns(['handleInput', 'close', 'accept'], 'Rename', Rename);
|
|
8024
8089
|
|
|
@@ -8026,7 +8091,7 @@ const EditorRenameWidget = {
|
|
|
8026
8091
|
__proto__: null,
|
|
8027
8092
|
accept,
|
|
8028
8093
|
add: add$5,
|
|
8029
|
-
close,
|
|
8094
|
+
close: close$1,
|
|
8030
8095
|
handleInput,
|
|
8031
8096
|
remove: remove$5,
|
|
8032
8097
|
render: render$9
|
|
@@ -8037,7 +8102,7 @@ const rerender = editor => {
|
|
|
8037
8102
|
return structuredClone(editor);
|
|
8038
8103
|
};
|
|
8039
8104
|
|
|
8040
|
-
const focusIndex = (state, index) => {
|
|
8105
|
+
const focusIndex$1 = (state, index) => {
|
|
8041
8106
|
const newState = {
|
|
8042
8107
|
...state,
|
|
8043
8108
|
focusedIndex: index
|
|
@@ -8045,57 +8110,228 @@ const focusIndex = (state, index) => {
|
|
|
8045
8110
|
return newState;
|
|
8046
8111
|
};
|
|
8047
8112
|
|
|
8048
|
-
const focusNext = state => {
|
|
8113
|
+
const focusNext$1 = state => {
|
|
8049
8114
|
const nextIndex = state.focusedIndex + 1;
|
|
8050
|
-
return focusIndex(state, nextIndex);
|
|
8115
|
+
return focusIndex$1(state, nextIndex);
|
|
8051
8116
|
};
|
|
8052
8117
|
|
|
8053
|
-
const
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
const widget = editor.widgets.find(widget => widget.id === widgetId);
|
|
8057
|
-
if (!widget) {
|
|
8058
|
-
return editor;
|
|
8059
|
-
}
|
|
8060
|
-
const {
|
|
8061
|
-
uid
|
|
8062
|
-
} = widget.newState;
|
|
8063
|
-
number(uid);
|
|
8064
|
-
await invoke(`${name}.${actualMethod}`, uid, ...params);
|
|
8065
|
-
const isWidget = widget => {
|
|
8066
|
-
return widget.id === widgetId;
|
|
8067
|
-
};
|
|
8068
|
-
const latestEditor = getEditor(editor.uid);
|
|
8069
|
-
const childIndex1 = latestEditor.widgets.findIndex(isWidget);
|
|
8070
|
-
if (childIndex1 === -1) {
|
|
8071
|
-
return latestEditor;
|
|
8072
|
-
}
|
|
8073
|
-
const diff = await invoke(`${name}.diff2`, uid);
|
|
8074
|
-
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
8075
|
-
const childIndex = editor.widgets.findIndex(isWidget);
|
|
8076
|
-
if (childIndex === -1) {
|
|
8077
|
-
return latestEditor;
|
|
8078
|
-
}
|
|
8079
|
-
const childWidget = latestEditor.widgets[childIndex];
|
|
8080
|
-
const newState = {
|
|
8081
|
-
...childWidget.newState,
|
|
8082
|
-
commands
|
|
8083
|
-
};
|
|
8084
|
-
const newEditor = updateWidget(latestEditor, widgetId, newState);
|
|
8085
|
-
return newEditor;
|
|
8118
|
+
const removeWidget$1 = widget => {
|
|
8119
|
+
// @ts-ignore
|
|
8120
|
+
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
8086
8121
|
};
|
|
8087
8122
|
|
|
8088
|
-
const
|
|
8089
|
-
const
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
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
|
+
const render$7 = widget => {
|
|
8237
|
+
const commands = doRender(widget.oldState, widget.newState);
|
|
8238
|
+
const wrappedCommands = [];
|
|
8239
|
+
const {
|
|
8240
|
+
uid
|
|
8241
|
+
} = widget.newState;
|
|
8242
|
+
for (const command of commands) {
|
|
8243
|
+
if (command[0] === SetDom2) {
|
|
8244
|
+
wrappedCommands.push(command);
|
|
8245
|
+
} else {
|
|
8246
|
+
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
8247
|
+
}
|
|
8248
|
+
}
|
|
8249
|
+
return wrappedCommands;
|
|
8250
|
+
};
|
|
8251
|
+
const add$4 = widget => {
|
|
8252
|
+
return addWidget$1(widget, 'EditorSourceActions', render$7);
|
|
8253
|
+
};
|
|
8254
|
+
const remove$4 = removeWidget$1;
|
|
8255
|
+
const {
|
|
8256
|
+
focusFirst,
|
|
8257
|
+
focusIndex,
|
|
8258
|
+
focusLast,
|
|
8259
|
+
focusNext,
|
|
8260
|
+
focusPrevious,
|
|
8261
|
+
selectCurrent,
|
|
8262
|
+
selectIndex,
|
|
8263
|
+
selectItem,
|
|
8264
|
+
toggleDetails,
|
|
8265
|
+
closeDetails,
|
|
8266
|
+
handleWheel,
|
|
8267
|
+
close
|
|
8268
|
+
} = createFns(['focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'selectCurrent', 'selectIndex', 'selectItem', 'toggleDetails', 'closeDetails', 'handleWheel', 'close'], 'SourceActions', SourceAction$1);
|
|
8269
|
+
|
|
8270
|
+
const EditorSourceActionWidget = {
|
|
8271
|
+
__proto__: null,
|
|
8272
|
+
add: add$4,
|
|
8273
|
+
close,
|
|
8274
|
+
closeDetails,
|
|
8275
|
+
focusFirst,
|
|
8276
|
+
focusIndex,
|
|
8277
|
+
focusLast,
|
|
8278
|
+
focusNext,
|
|
8279
|
+
focusPrevious,
|
|
8280
|
+
handleWheel,
|
|
8281
|
+
remove: remove$4,
|
|
8282
|
+
render: render$7,
|
|
8283
|
+
selectCurrent,
|
|
8284
|
+
selectIndex,
|
|
8285
|
+
selectItem,
|
|
8286
|
+
toggleDetails
|
|
8287
|
+
};
|
|
8288
|
+
|
|
8289
|
+
const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...params) => {
|
|
8290
|
+
const invoke = getWidgetInvoke(widgetId);
|
|
8291
|
+
const actualMethod = method.slice(name.length + 1);
|
|
8292
|
+
const widget = editor.widgets.find(widget => widget.id === widgetId);
|
|
8293
|
+
if (!widget) {
|
|
8294
|
+
return editor;
|
|
8295
|
+
}
|
|
8296
|
+
const {
|
|
8297
|
+
uid
|
|
8298
|
+
} = widget.newState;
|
|
8299
|
+
number(uid);
|
|
8300
|
+
await invoke(`${name}.${actualMethod}`, uid, ...params);
|
|
8301
|
+
const isWidget = widget => {
|
|
8302
|
+
return widget.id === widgetId;
|
|
8303
|
+
};
|
|
8304
|
+
const latestEditor = getEditor(editor.uid);
|
|
8305
|
+
const childIndex1 = latestEditor.widgets.findIndex(isWidget);
|
|
8306
|
+
if (childIndex1 === -1) {
|
|
8307
|
+
return latestEditor;
|
|
8308
|
+
}
|
|
8309
|
+
const diff = await invoke(`${name}.diff2`, uid);
|
|
8310
|
+
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
8311
|
+
const childIndex = editor.widgets.findIndex(isWidget);
|
|
8312
|
+
if (childIndex === -1) {
|
|
8313
|
+
return latestEditor;
|
|
8314
|
+
}
|
|
8315
|
+
const childWidget = latestEditor.widgets[childIndex];
|
|
8316
|
+
const newState = {
|
|
8317
|
+
...childWidget.newState,
|
|
8318
|
+
commands
|
|
8319
|
+
};
|
|
8320
|
+
const newEditor = updateWidget(latestEditor, widgetId, newState);
|
|
8321
|
+
return newEditor;
|
|
8322
|
+
};
|
|
8323
|
+
|
|
8324
|
+
const RE_WORD = /[\w\-]+$/;
|
|
8325
|
+
const getWordAtOffset = editor => {
|
|
8326
|
+
const {
|
|
8327
|
+
lines,
|
|
8328
|
+
selections
|
|
8329
|
+
} = editor;
|
|
8330
|
+
const rowIndex = selections[0];
|
|
8331
|
+
const columnIndex = selections[1];
|
|
8332
|
+
const line = lines[rowIndex];
|
|
8333
|
+
const part = line.slice(0, columnIndex);
|
|
8334
|
+
const wordMatch = part.match(RE_WORD);
|
|
8099
8335
|
if (wordMatch) {
|
|
8100
8336
|
return wordMatch[0];
|
|
8101
8337
|
}
|
|
@@ -8202,6 +8438,10 @@ const applyEdits2 = async (editorUid, edits) => {
|
|
|
8202
8438
|
const newEditor = await applyEdit(editor, edits);
|
|
8203
8439
|
set$6(editorUid, editor, newEditor);
|
|
8204
8440
|
};
|
|
8441
|
+
const getSourceActions = async editorUid => {
|
|
8442
|
+
const actions = await getEditorSourceActions(editorUid);
|
|
8443
|
+
return actions;
|
|
8444
|
+
};
|
|
8205
8445
|
|
|
8206
8446
|
const pending = Object.create(null);
|
|
8207
8447
|
const loaded = Object.create(null);
|
|
@@ -9169,13 +9409,13 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
|
|
|
9169
9409
|
languageId,
|
|
9170
9410
|
invalidStartIndex
|
|
9171
9411
|
};
|
|
9172
|
-
return invoke$
|
|
9412
|
+
return invoke$2('GetTokensViewport.getTokensViewport', slimEditor,
|
|
9173
9413
|
// @ts-ignore
|
|
9174
9414
|
startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
|
|
9175
9415
|
}
|
|
9176
9416
|
// TODO only send needed lines of text
|
|
9177
9417
|
// @ts-ignore
|
|
9178
|
-
return invoke$
|
|
9418
|
+
return invoke$2('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
|
|
9179
9419
|
}
|
|
9180
9420
|
return getTokensViewport(editor, startLineIndex, endLineIndex);
|
|
9181
9421
|
};
|
|
@@ -9451,10 +9691,6 @@ const getDiagnosticClassName = type => {
|
|
|
9451
9691
|
}
|
|
9452
9692
|
};
|
|
9453
9693
|
|
|
9454
|
-
const mergeClassNames = (...classNames) => {
|
|
9455
|
-
return classNames.filter(Boolean).join(' ');
|
|
9456
|
-
};
|
|
9457
|
-
|
|
9458
9694
|
const getDiagnosticVirtualDom = diagnostic => {
|
|
9459
9695
|
const {
|
|
9460
9696
|
x,
|
|
@@ -9537,7 +9773,7 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
9537
9773
|
const oldLine = oldState.lines[rowIndex];
|
|
9538
9774
|
const newLine = lines[rowIndex];
|
|
9539
9775
|
// @ts-ignore
|
|
9540
|
-
const incrementalEdits = await invoke$
|
|
9776
|
+
const incrementalEdits = await invoke$2(
|
|
9541
9777
|
// @ts-ignore
|
|
9542
9778
|
'TokenizeIncremental.tokenizeIncremental', newState.uid,
|
|
9543
9779
|
// @ts-ignore
|
|
@@ -9583,7 +9819,7 @@ const renderWidget = widget => {
|
|
|
9583
9819
|
}
|
|
9584
9820
|
return module.render(widget);
|
|
9585
9821
|
};
|
|
9586
|
-
const removeWidget
|
|
9822
|
+
const removeWidget = widget => {
|
|
9587
9823
|
const module = get$5(widget.id);
|
|
9588
9824
|
if (!module) {
|
|
9589
9825
|
throw new Error('unsupported widget');
|
|
@@ -9658,7 +9894,7 @@ const renderFocus$1 = {
|
|
|
9658
9894
|
// TODO avoid side effect
|
|
9659
9895
|
if (newState.focused) {
|
|
9660
9896
|
const FocusEditorText = 12;
|
|
9661
|
-
invoke$
|
|
9897
|
+
invoke$8('Focus.setFocus', FocusEditorText);
|
|
9662
9898
|
}
|
|
9663
9899
|
return [/* method */'setFocused', newState.focused];
|
|
9664
9900
|
}
|
|
@@ -9738,7 +9974,7 @@ const renderWidgets = {
|
|
|
9738
9974
|
}
|
|
9739
9975
|
const removeCommands = [];
|
|
9740
9976
|
for (const removedWidget of removedWidgets) {
|
|
9741
|
-
const childCommands = removeWidget
|
|
9977
|
+
const childCommands = removeWidget(removedWidget);
|
|
9742
9978
|
if (childCommands.length > 0) {
|
|
9743
9979
|
removeCommands.push(...childCommands);
|
|
9744
9980
|
}
|
|
@@ -9748,7 +9984,7 @@ const renderWidgets = {
|
|
|
9748
9984
|
},
|
|
9749
9985
|
multiple: true
|
|
9750
9986
|
};
|
|
9751
|
-
const render$
|
|
9987
|
+
const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets];
|
|
9752
9988
|
const renderEditor = async id => {
|
|
9753
9989
|
const instance = get$4(id);
|
|
9754
9990
|
if (!instance) {
|
|
@@ -9760,7 +9996,7 @@ const renderEditor = async id => {
|
|
|
9760
9996
|
} = instance;
|
|
9761
9997
|
const commands = [];
|
|
9762
9998
|
set$6(id, newState, newState);
|
|
9763
|
-
for (const item of render$
|
|
9999
|
+
for (const item of render$6) {
|
|
9764
10000
|
if (!item.isEqual(oldState, newState)) {
|
|
9765
10001
|
const result = await item.apply(oldState, newState);
|
|
9766
10002
|
// @ts-ignore
|
|
@@ -9846,7 +10082,7 @@ const updateDebugInfo = async debugId => {
|
|
|
9846
10082
|
};
|
|
9847
10083
|
set$6(key, oldState, newEditor);
|
|
9848
10084
|
// @ts-ignore
|
|
9849
|
-
await invoke$
|
|
10085
|
+
await invoke$8('Editor.rerender', key);
|
|
9850
10086
|
};
|
|
9851
10087
|
|
|
9852
10088
|
const editorDiagnosticEffect = {
|
|
@@ -9860,7 +10096,7 @@ const editorDiagnosticEffect = {
|
|
|
9860
10096
|
}
|
|
9861
10097
|
};
|
|
9862
10098
|
|
|
9863
|
-
const keep = ['ActivateByEvent.activateByEvent', 'ExtensionHostManagement.activateByEvent', 'Editor.applyEdit2', 'Editor.applyEdits2', 'Editor.closeFind2', 'Editor.closeWidget2', 'Editor.create', 'Editor.getKeyBindings', 'Editor.getLines2', 'Editor.getPositionAtCursor', 'Editor.getOffsetAtCursor', 'Editor.getQuickPickMenuEntries', 'Editor.getSelections', 'Editor.getSelections2', 'Editor.getText', 'Editor.getWordAt', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getUri', 'Editor.getWordBefore', 'Editor.getWordBefore2', 'Editor.offsetAt', 'Editor.render', 'Editor.setSelections2', 'Editor.updateDebugInfo', 'Editor.getLanguageId', 'Editor.getProblems', 'Editor.getKeys', 'Font.ensure', 'HandleMessagePort.handleMessagePort', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker'
|
|
10099
|
+
const keep = ['ActivateByEvent.activateByEvent', 'ExtensionHostManagement.activateByEvent', 'Editor.applyEdit2', 'Editor.applyEdits2', 'Editor.closeFind2', 'Editor.closeWidget2', 'Editor.create', 'Editor.getKeyBindings', 'Editor.getSourceActions', 'Editor.getLines2', 'Editor.getPositionAtCursor', 'Editor.getOffsetAtCursor', 'Editor.getQuickPickMenuEntries', 'Editor.getSelections', 'Editor.getSelections2', 'Editor.getText', 'Editor.getWordAt', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getUri', 'Editor.getWordBefore', 'Editor.getWordBefore2', 'Editor.offsetAt', 'Editor.render', 'Editor.setSelections2', 'Editor.updateDebugInfo', 'Editor.getLanguageId', 'Editor.getProblems', 'Editor.getKeys', 'Font.ensure', 'HandleMessagePort.handleMessagePort', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker'
|
|
9864
10100
|
// 'ColorPicker.handleSliderPointerDown',
|
|
9865
10101
|
// 'ColorPicker.handleSliderPointerMove',
|
|
9866
10102
|
// 'ColorPicker.loadContent',
|
|
@@ -9968,6 +10204,7 @@ const commandMap = {
|
|
|
9968
10204
|
'Editor.compositionEnd': compositionEnd,
|
|
9969
10205
|
'Editor.compositionStart': compositionStart,
|
|
9970
10206
|
'Editor.compositionUpdate': compositionUpdate,
|
|
10207
|
+
'Editor.applyDocumentEdits': applyDocumentEdits,
|
|
9971
10208
|
'Editor.contextMenu': handleContextMenu,
|
|
9972
10209
|
'Editor.copy': copy,
|
|
9973
10210
|
'Editor.copyLineDown': copyLineDown,
|
|
@@ -10007,6 +10244,7 @@ const commandMap = {
|
|
|
10007
10244
|
'Editor.getLines2': getLines2,
|
|
10008
10245
|
'Editor.getOffsetAtCursor': getOffsetAtCursor,
|
|
10009
10246
|
'Editor.getPositionAtCursor': getPositionAtCursor,
|
|
10247
|
+
'Editor.getSourceActions': getSourceActions,
|
|
10010
10248
|
'Editor.getProblems': getProblems,
|
|
10011
10249
|
'Editor.getQuickPickMenuEntries': getQuickPickMenuEntries,
|
|
10012
10250
|
'Editor.getSelections': getSelections,
|
|
@@ -10094,8 +10332,9 @@ const commandMap = {
|
|
|
10094
10332
|
'Editor.setSelections2': setSelections2,
|
|
10095
10333
|
'Editor.showHover': showHover,
|
|
10096
10334
|
'Editor.showHover2': showHover2,
|
|
10097
|
-
'Editor.showSourceActions': showSourceActions,
|
|
10098
|
-
'Editor.showSourceActions2': showSourceActions,
|
|
10335
|
+
'Editor.showSourceActions': showSourceActions$1,
|
|
10336
|
+
'Editor.showSourceActions2': showSourceActions$1,
|
|
10337
|
+
'Editor.showSourceActions3': showSourceActions,
|
|
10099
10338
|
'Editor.sortLinesAscending': sortLinesAscending,
|
|
10100
10339
|
'Editor.tabCompletion': tabCompletion,
|
|
10101
10340
|
'Editor.toggleBlockComment': toggleBlockComment,
|
|
@@ -10107,31 +10346,42 @@ const commandMap = {
|
|
|
10107
10346
|
'Editor.unIndent': editorUnindent,
|
|
10108
10347
|
'Editor.updateDebugInfo': updateDebugInfo,
|
|
10109
10348
|
'Editor.updateDiagnostics': updateDiagnostics,
|
|
10110
|
-
'EditorCompletion.close': close$
|
|
10111
|
-
'EditorCompletion.closeDetails': closeDetails,
|
|
10112
|
-
'EditorCompletion.focusFirst': focusFirst,
|
|
10113
|
-
'EditorCompletion.focusIndex': focusIndex$
|
|
10114
|
-
'EditorCompletion.focusNext': focusNext$
|
|
10115
|
-
'EditorCompletion.focusPrevious': focusPrevious$
|
|
10349
|
+
'EditorCompletion.close': close$3,
|
|
10350
|
+
'EditorCompletion.closeDetails': closeDetails$1,
|
|
10351
|
+
'EditorCompletion.focusFirst': focusFirst$1,
|
|
10352
|
+
'EditorCompletion.focusIndex': focusIndex$2,
|
|
10353
|
+
'EditorCompletion.focusNext': focusNext$3,
|
|
10354
|
+
'EditorCompletion.focusPrevious': focusPrevious$2,
|
|
10116
10355
|
'EditorCompletion.handleEditorBlur': handleEditorBlur,
|
|
10117
10356
|
'EditorCompletion.handleEditorClick': handleEditorClick,
|
|
10118
10357
|
'EditorCompletion.handleEditorDeleteLeft': handleEditorDeleteLeft$1,
|
|
10119
10358
|
'EditorCompletion.handleEditorType': handleEditorType$1,
|
|
10120
|
-
'EditorCompletion.handleWheel': handleWheel,
|
|
10359
|
+
'EditorCompletion.handleWheel': handleWheel$1,
|
|
10121
10360
|
'EditorCompletion.openDetails': openDetails,
|
|
10122
|
-
'EditorCompletion.selectCurrent': selectCurrent,
|
|
10123
|
-
'EditorCompletion.selectIndex': selectIndex,
|
|
10124
|
-
'EditorCompletion.toggleDetails': toggleDetails,
|
|
10361
|
+
'EditorCompletion.selectCurrent': selectCurrent$1,
|
|
10362
|
+
'EditorCompletion.selectIndex': selectIndex$1,
|
|
10363
|
+
'EditorCompletion.toggleDetails': toggleDetails$1,
|
|
10364
|
+
'EditorSourceAction.close': close,
|
|
10365
|
+
'EditorSourceAction.closeDetails': closeDetails,
|
|
10366
|
+
'EditorSourceAction.focusFirst': focusFirst,
|
|
10367
|
+
'EditorSourceAction.focusIndex': focusIndex,
|
|
10368
|
+
'EditorSourceAction.focusNext': focusNext,
|
|
10369
|
+
'EditorSourceAction.focusPrevious': focusPrevious,
|
|
10370
|
+
'EditorSourceAction.handleWheel': handleWheel,
|
|
10371
|
+
'EditorSourceAction.selectCurrent': selectCurrent,
|
|
10372
|
+
'EditorSourceAction.selectIndex': selectIndex,
|
|
10373
|
+
'EditorSourceAction.selectItem': selectItem,
|
|
10374
|
+
'EditorSourceAction.toggleDetails': toggleDetails,
|
|
10125
10375
|
'EditorRename.accept': accept,
|
|
10126
|
-
'EditorRename.close': close,
|
|
10376
|
+
'EditorRename.close': close$1,
|
|
10127
10377
|
'EditorRename.handleInput': handleInput,
|
|
10128
|
-
'EditorSourceActions.focusNext': focusNext,
|
|
10129
|
-
'FindWidget.close': close$
|
|
10378
|
+
'EditorSourceActions.focusNext': focusNext$1,
|
|
10379
|
+
'FindWidget.close': close$2,
|
|
10130
10380
|
'FindWidget.focusCloseButton': focusCloseButton,
|
|
10131
10381
|
'FindWidget.focusFind': focusFind,
|
|
10132
|
-
'FindWidget.focusNext': focusNext$
|
|
10382
|
+
'FindWidget.focusNext': focusNext$2,
|
|
10133
10383
|
'FindWidget.focusNextMatchButton': focusNextMatchButton,
|
|
10134
|
-
'FindWidget.focusPrevious': focusPrevious,
|
|
10384
|
+
'FindWidget.focusPrevious': focusPrevious$1,
|
|
10135
10385
|
'FindWidget.focusPreviousMatchButton': focusPreviousMatchButton,
|
|
10136
10386
|
'FindWidget.focusReplace': focusReplace,
|
|
10137
10387
|
'FindWidget.focusReplaceAllButton': focusReplaceAllButton,
|
|
@@ -10165,11 +10415,6 @@ const listen = async () => {
|
|
|
10165
10415
|
set$8(rpc);
|
|
10166
10416
|
};
|
|
10167
10417
|
|
|
10168
|
-
const removeWidget = widget => {
|
|
10169
|
-
// @ts-ignore
|
|
10170
|
-
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
10171
|
-
};
|
|
10172
|
-
|
|
10173
10418
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
10174
10419
|
|
|
10175
10420
|
const getCodeGeneratorVirtualDom = state => {
|
|
@@ -10201,7 +10446,7 @@ const renderContent$1 = {
|
|
|
10201
10446
|
return [SetDom2, newState.uid, dom];
|
|
10202
10447
|
}
|
|
10203
10448
|
};
|
|
10204
|
-
const renderBounds$
|
|
10449
|
+
const renderBounds$1 = {
|
|
10205
10450
|
isEqual(oldState, newState) {
|
|
10206
10451
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10207
10452
|
},
|
|
@@ -10223,10 +10468,10 @@ const renderFocus = {
|
|
|
10223
10468
|
return [Focus, '.CodeGeneratorInput', newState.focusSource];
|
|
10224
10469
|
}
|
|
10225
10470
|
};
|
|
10226
|
-
const render$
|
|
10471
|
+
const render$5 = [renderContent$1, renderBounds$1, renderFocus];
|
|
10227
10472
|
const renderFull$2 = (oldState, newState) => {
|
|
10228
10473
|
const commands = [];
|
|
10229
|
-
for (const item of render$
|
|
10474
|
+
for (const item of render$5) {
|
|
10230
10475
|
if (!item.isEqual(oldState, newState)) {
|
|
10231
10476
|
commands.push(item.apply(oldState, newState));
|
|
10232
10477
|
}
|
|
@@ -10234,7 +10479,7 @@ const renderFull$2 = (oldState, newState) => {
|
|
|
10234
10479
|
return commands;
|
|
10235
10480
|
};
|
|
10236
10481
|
|
|
10237
|
-
const render$
|
|
10482
|
+
const render$4 = widget => {
|
|
10238
10483
|
const commands = renderFull$2(widget.oldState, widget.newState);
|
|
10239
10484
|
const wrappedCommands = [];
|
|
10240
10485
|
const {
|
|
@@ -10250,16 +10495,16 @@ const render$6 = widget => {
|
|
|
10250
10495
|
}
|
|
10251
10496
|
return wrappedCommands;
|
|
10252
10497
|
};
|
|
10253
|
-
const add$
|
|
10254
|
-
return addWidget$1(widget, 'EditorCodeGenerator', render$
|
|
10498
|
+
const add$3 = widget => {
|
|
10499
|
+
return addWidget$1(widget, 'EditorCodeGenerator', render$4);
|
|
10255
10500
|
};
|
|
10256
|
-
const remove$
|
|
10501
|
+
const remove$3 = removeWidget$1;
|
|
10257
10502
|
|
|
10258
10503
|
const EditorCodeGeneratorWidget = {
|
|
10259
10504
|
__proto__: null,
|
|
10260
|
-
add: add$
|
|
10261
|
-
remove: remove$
|
|
10262
|
-
render: render$
|
|
10505
|
+
add: add$3,
|
|
10506
|
+
remove: remove$3,
|
|
10507
|
+
render: render$4
|
|
10263
10508
|
};
|
|
10264
10509
|
|
|
10265
10510
|
const renderFull$1 = (oldState, newState) => {
|
|
@@ -10269,7 +10514,7 @@ const renderFull$1 = (oldState, newState) => {
|
|
|
10269
10514
|
return commands;
|
|
10270
10515
|
};
|
|
10271
10516
|
|
|
10272
|
-
const render$
|
|
10517
|
+
const render$3 = widget => {
|
|
10273
10518
|
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
10274
10519
|
const wrappedCommands = [];
|
|
10275
10520
|
const {
|
|
@@ -10284,18 +10529,18 @@ const render$5 = widget => {
|
|
|
10284
10529
|
}
|
|
10285
10530
|
return wrappedCommands;
|
|
10286
10531
|
};
|
|
10287
|
-
const add$
|
|
10288
|
-
return addWidget$1(widget, 'ColorPicker', render$
|
|
10532
|
+
const add$2 = widget => {
|
|
10533
|
+
return addWidget$1(widget, 'ColorPicker', render$3);
|
|
10289
10534
|
};
|
|
10290
|
-
const remove$
|
|
10535
|
+
const remove$2 = removeWidget$1;
|
|
10291
10536
|
const Commands = {};
|
|
10292
10537
|
|
|
10293
10538
|
const EditorColorPickerWidget = {
|
|
10294
10539
|
__proto__: null,
|
|
10295
10540
|
Commands,
|
|
10296
|
-
add: add$
|
|
10297
|
-
remove: remove$
|
|
10298
|
-
render: render$
|
|
10541
|
+
add: add$2,
|
|
10542
|
+
remove: remove$2,
|
|
10543
|
+
render: render$3
|
|
10299
10544
|
};
|
|
10300
10545
|
|
|
10301
10546
|
const getCompletionDetailVirtualDom = content => {
|
|
@@ -10339,7 +10584,7 @@ const renderContent = {
|
|
|
10339
10584
|
return [SetDom2, newState.uid, dom];
|
|
10340
10585
|
}
|
|
10341
10586
|
};
|
|
10342
|
-
const renderBounds
|
|
10587
|
+
const renderBounds = {
|
|
10343
10588
|
isEqual(oldState, newState) {
|
|
10344
10589
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10345
10590
|
},
|
|
@@ -10353,9 +10598,9 @@ const renderBounds$1 = {
|
|
|
10353
10598
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
10354
10599
|
}
|
|
10355
10600
|
};
|
|
10356
|
-
const render$
|
|
10601
|
+
const render$2 = [renderContent, renderBounds];
|
|
10357
10602
|
const renderFull = (oldState, newState) => {
|
|
10358
|
-
return renderParts(render$
|
|
10603
|
+
return renderParts(render$2, oldState, newState);
|
|
10359
10604
|
};
|
|
10360
10605
|
|
|
10361
10606
|
const getWidgetState = (editor, id) => {
|
|
@@ -10374,7 +10619,7 @@ const getCompletionState = editor => {
|
|
|
10374
10619
|
return getWidgetState(editor, Completion);
|
|
10375
10620
|
};
|
|
10376
10621
|
|
|
10377
|
-
const render$
|
|
10622
|
+
const render$1 = widget => {
|
|
10378
10623
|
const commands = renderFull(widget.oldState, widget.newState);
|
|
10379
10624
|
const wrappedCommands = [];
|
|
10380
10625
|
const {
|
|
@@ -10389,10 +10634,10 @@ const render$3 = widget => {
|
|
|
10389
10634
|
}
|
|
10390
10635
|
return wrappedCommands;
|
|
10391
10636
|
};
|
|
10392
|
-
const add$
|
|
10393
|
-
return addWidget$1(widget, 'EditorCompletionDetails', render$
|
|
10637
|
+
const add$1 = widget => {
|
|
10638
|
+
return addWidget$1(widget, 'EditorCompletionDetails', render$1);
|
|
10394
10639
|
};
|
|
10395
|
-
const remove$
|
|
10640
|
+
const remove$1 = removeWidget$1;
|
|
10396
10641
|
const handleEditorType = (editor, state) => {
|
|
10397
10642
|
const completionState = getCompletionState(editor);
|
|
10398
10643
|
if (!completionState) {
|
|
@@ -10424,158 +10669,22 @@ const handleEditorDeleteLeft = (editor, state) => {
|
|
|
10424
10669
|
|
|
10425
10670
|
const EditorCompletionDetailWidget = {
|
|
10426
10671
|
__proto__: null,
|
|
10427
|
-
add: add$
|
|
10672
|
+
add: add$1,
|
|
10428
10673
|
handleEditorDeleteLeft,
|
|
10429
10674
|
handleEditorType,
|
|
10430
|
-
remove: remove$2,
|
|
10431
|
-
render: render$3
|
|
10432
|
-
};
|
|
10433
|
-
|
|
10434
|
-
const render$2 = widget => {
|
|
10435
|
-
const commands = renderHover(widget.oldState, widget.newState);
|
|
10436
|
-
const wrappedCommands = [];
|
|
10437
|
-
const {
|
|
10438
|
-
uid
|
|
10439
|
-
} = widget.newState;
|
|
10440
|
-
for (const command of commands) {
|
|
10441
|
-
if (command[0] === SetDom2) {
|
|
10442
|
-
wrappedCommands.push([command[0], uid, ...command.slice(1)]);
|
|
10443
|
-
} else {
|
|
10444
|
-
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
10445
|
-
}
|
|
10446
|
-
}
|
|
10447
|
-
return wrappedCommands;
|
|
10448
|
-
};
|
|
10449
|
-
const add$1 = widget => {
|
|
10450
|
-
return addWidget$1(widget, 'EditorHover', render$2);
|
|
10451
|
-
};
|
|
10452
|
-
const remove$1 = removeWidget;
|
|
10453
|
-
|
|
10454
|
-
const EditorHoverWidget = {
|
|
10455
|
-
__proto__: null,
|
|
10456
|
-
add: add$1,
|
|
10457
10675
|
remove: remove$1,
|
|
10458
|
-
render: render$
|
|
10459
|
-
};
|
|
10460
|
-
|
|
10461
|
-
const getEditorMessageVirtualDom = message => {
|
|
10462
|
-
const dom = [{
|
|
10463
|
-
type: Div,
|
|
10464
|
-
className: 'Viewlet EditorMessage',
|
|
10465
|
-
tabIndex: -1,
|
|
10466
|
-
childCount: 2
|
|
10467
|
-
}, {
|
|
10468
|
-
type: Div,
|
|
10469
|
-
className: 'EditorMessageText',
|
|
10470
|
-
childCount: 1
|
|
10471
|
-
}, text(message), {
|
|
10472
|
-
type: Div,
|
|
10473
|
-
className: 'EditorMessageTriangle',
|
|
10474
|
-
childCount: 0
|
|
10475
|
-
}];
|
|
10476
|
-
return dom;
|
|
10477
|
-
};
|
|
10478
|
-
|
|
10479
|
-
const getEmptySourceActionsVirtualDom = () => {
|
|
10480
|
-
return getEditorMessageVirtualDom(noCodeActionsAvailable());
|
|
10481
|
-
};
|
|
10482
|
-
|
|
10483
|
-
const getActionClassName = isFocused => {
|
|
10484
|
-
if (isFocused) {
|
|
10485
|
-
return mergeClassNames(SourceActionItem, SourceActionItemFocused);
|
|
10486
|
-
}
|
|
10487
|
-
return SourceActionItem;
|
|
10488
|
-
};
|
|
10489
|
-
const getSourceActionListItemVirtualDom = sourceAction => {
|
|
10490
|
-
const {
|
|
10491
|
-
name,
|
|
10492
|
-
isFocused
|
|
10493
|
-
} = sourceAction;
|
|
10494
|
-
const actionClassName = getActionClassName(isFocused);
|
|
10495
|
-
return [{
|
|
10496
|
-
type: Div,
|
|
10497
|
-
className: actionClassName,
|
|
10498
|
-
childCount: 2
|
|
10499
|
-
}, {
|
|
10500
|
-
type: Div,
|
|
10501
|
-
className: mergeClassNames(SourceActionIcon, MaskIcon, MaskIconSymbolFile)
|
|
10502
|
-
}, text(name)];
|
|
10503
|
-
};
|
|
10504
|
-
|
|
10505
|
-
const getSourceActionsVirtualDom = sourceActions => {
|
|
10506
|
-
if (sourceActions.length === 0) {
|
|
10507
|
-
return getEmptySourceActionsVirtualDom();
|
|
10508
|
-
}
|
|
10509
|
-
const dom = [{
|
|
10510
|
-
type: Div,
|
|
10511
|
-
className: mergeClassNames(Viewlet, EditorSourceActions),
|
|
10512
|
-
tabIndex: -1,
|
|
10513
|
-
childCount: 2,
|
|
10514
|
-
onFocusIn: HandleFocusIn
|
|
10515
|
-
}, {
|
|
10516
|
-
type: Div,
|
|
10517
|
-
className: SourceActionHeading,
|
|
10518
|
-
childCount: 1
|
|
10519
|
-
}, text(sourceAction()), {
|
|
10520
|
-
type: Div,
|
|
10521
|
-
className: EditorSourceActionsList,
|
|
10522
|
-
childCount: sourceActions.length,
|
|
10523
|
-
onClick: HandleClick
|
|
10524
|
-
}, ...sourceActions.flatMap(getSourceActionListItemVirtualDom)];
|
|
10525
|
-
return dom;
|
|
10526
|
-
};
|
|
10527
|
-
|
|
10528
|
-
const getVisibleSourceActions = (sourceActions, focusedIndex) => {
|
|
10529
|
-
const visible = [];
|
|
10530
|
-
for (let i = 0; i < sourceActions.length; i++) {
|
|
10531
|
-
const isFocused = i === focusedIndex;
|
|
10532
|
-
const sourceAction = sourceActions[i];
|
|
10533
|
-
visible.push({
|
|
10534
|
-
...sourceAction,
|
|
10535
|
-
isFocused
|
|
10536
|
-
});
|
|
10537
|
-
}
|
|
10538
|
-
return visible;
|
|
10539
|
-
};
|
|
10540
|
-
|
|
10541
|
-
const renderSourceActions = {
|
|
10542
|
-
isEqual(oldState, newState) {
|
|
10543
|
-
return oldState.sourceActions === newState.sourceActions && oldState.focusedIndex === newState.focusedIndex;
|
|
10544
|
-
},
|
|
10545
|
-
apply(oldStatem, newState) {
|
|
10546
|
-
const visible = getVisibleSourceActions(newState.sourceActions, newState.focusedIndex);
|
|
10547
|
-
const dom = getSourceActionsVirtualDom(visible);
|
|
10548
|
-
return [SetDom2, newState.uid, dom];
|
|
10549
|
-
}
|
|
10550
|
-
};
|
|
10551
|
-
const renderBounds = {
|
|
10552
|
-
isEqual(oldState, newState) {
|
|
10553
|
-
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10554
|
-
},
|
|
10555
|
-
apply(oldState, newState) {
|
|
10556
|
-
return [SetBounds, newState.x, newState.y, newState.width, newState.height];
|
|
10557
|
-
}
|
|
10558
|
-
};
|
|
10559
|
-
const render$1 = [renderSourceActions, renderBounds];
|
|
10560
|
-
const doRender = (oldState, newState) => {
|
|
10561
|
-
const commands = [];
|
|
10562
|
-
for (const item of render$1) {
|
|
10563
|
-
if (!item.isEqual(oldState, newState)) {
|
|
10564
|
-
commands.push(item.apply(oldState, newState));
|
|
10565
|
-
}
|
|
10566
|
-
}
|
|
10567
|
-
return commands;
|
|
10676
|
+
render: render$1
|
|
10568
10677
|
};
|
|
10569
10678
|
|
|
10570
10679
|
const render = widget => {
|
|
10571
|
-
const commands =
|
|
10680
|
+
const commands = renderHover(widget.oldState, widget.newState);
|
|
10572
10681
|
const wrappedCommands = [];
|
|
10573
10682
|
const {
|
|
10574
10683
|
uid
|
|
10575
10684
|
} = widget.newState;
|
|
10576
10685
|
for (const command of commands) {
|
|
10577
10686
|
if (command[0] === SetDom2) {
|
|
10578
|
-
wrappedCommands.push(command);
|
|
10687
|
+
wrappedCommands.push([command[0], uid, ...command.slice(1)]);
|
|
10579
10688
|
} else {
|
|
10580
10689
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
10581
10690
|
}
|
|
@@ -10583,11 +10692,11 @@ const render = widget => {
|
|
|
10583
10692
|
return wrappedCommands;
|
|
10584
10693
|
};
|
|
10585
10694
|
const add = widget => {
|
|
10586
|
-
return addWidget$1(widget, '
|
|
10695
|
+
return addWidget$1(widget, 'EditorHover', render);
|
|
10587
10696
|
};
|
|
10588
|
-
const remove = removeWidget;
|
|
10697
|
+
const remove = removeWidget$1;
|
|
10589
10698
|
|
|
10590
|
-
const
|
|
10699
|
+
const EditorHoverWidget = {
|
|
10591
10700
|
__proto__: null,
|
|
10592
10701
|
add,
|
|
10593
10702
|
remove,
|