@lvce-editor/editor-worker 19.28.2 → 19.29.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 +148 -112
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -559,7 +559,7 @@ const execute$1 = (command, ...args) => {
|
|
|
559
559
|
|
|
560
560
|
const Two$1 = '2.0';
|
|
561
561
|
const callbacks = Object.create(null);
|
|
562
|
-
const get$
|
|
562
|
+
const get$a = id => {
|
|
563
563
|
return callbacks[id];
|
|
564
564
|
};
|
|
565
565
|
const remove$9 = id => {
|
|
@@ -749,7 +749,7 @@ const warn$1 = (...args) => {
|
|
|
749
749
|
console.warn(...args);
|
|
750
750
|
};
|
|
751
751
|
const resolve = (id, response) => {
|
|
752
|
-
const fn = get$
|
|
752
|
+
const fn = get$a(id);
|
|
753
753
|
if (!fn) {
|
|
754
754
|
console.log(response);
|
|
755
755
|
warn$1(`callback ${id} may already be disposed`);
|
|
@@ -1154,7 +1154,7 @@ const rpcs = Object.create(null);
|
|
|
1154
1154
|
const set$i = (id, rpc) => {
|
|
1155
1155
|
rpcs[id] = rpc;
|
|
1156
1156
|
};
|
|
1157
|
-
const get$
|
|
1157
|
+
const get$9 = id => {
|
|
1158
1158
|
return rpcs[id];
|
|
1159
1159
|
};
|
|
1160
1160
|
const remove$8 = id => {
|
|
@@ -1165,18 +1165,18 @@ const remove$8 = id => {
|
|
|
1165
1165
|
const create$a = rpcId => {
|
|
1166
1166
|
return {
|
|
1167
1167
|
async dispose() {
|
|
1168
|
-
const rpc = get$
|
|
1168
|
+
const rpc = get$9(rpcId);
|
|
1169
1169
|
await rpc.dispose();
|
|
1170
1170
|
},
|
|
1171
1171
|
// @ts-ignore
|
|
1172
1172
|
invoke(method, ...params) {
|
|
1173
|
-
const rpc = get$
|
|
1173
|
+
const rpc = get$9(rpcId);
|
|
1174
1174
|
// @ts-ignore
|
|
1175
1175
|
return rpc.invoke(method, ...params);
|
|
1176
1176
|
},
|
|
1177
1177
|
// @ts-ignore
|
|
1178
1178
|
invokeAndTransfer(method, ...params) {
|
|
1179
|
-
const rpc = get$
|
|
1179
|
+
const rpc = get$9(rpcId);
|
|
1180
1180
|
// @ts-ignore
|
|
1181
1181
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1182
1182
|
},
|
|
@@ -1515,7 +1515,7 @@ const createLazyRpc = rpcId => {
|
|
|
1515
1515
|
const rpc = activeRpc;
|
|
1516
1516
|
activeRpc = undefined;
|
|
1517
1517
|
rpcPromise = undefined;
|
|
1518
|
-
if (rpc && get$
|
|
1518
|
+
if (rpc && get$9(rpcId) === rpc) {
|
|
1519
1519
|
remove$8(rpcId);
|
|
1520
1520
|
}
|
|
1521
1521
|
if (notify) {
|
|
@@ -1982,12 +1982,12 @@ const loadContent$3 = async (state, parentUid) => {
|
|
|
1982
1982
|
|
|
1983
1983
|
const editorStates = create$9();
|
|
1984
1984
|
const {
|
|
1985
|
-
dispose: dispose$
|
|
1985
|
+
dispose: dispose$2,
|
|
1986
1986
|
getCommandIds,
|
|
1987
1987
|
registerCommands,
|
|
1988
1988
|
wrapGetter
|
|
1989
1989
|
} = editorStates;
|
|
1990
|
-
const get$
|
|
1990
|
+
const get$8 = id => {
|
|
1991
1991
|
return editorStates.get(id);
|
|
1992
1992
|
};
|
|
1993
1993
|
const getKeys$2 = () => {
|
|
@@ -2094,6 +2094,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
2094
2094
|
validLines: [],
|
|
2095
2095
|
visibleLineIndices: [],
|
|
2096
2096
|
visualDecorations: [],
|
|
2097
|
+
widgetRevision: 0,
|
|
2097
2098
|
widgets: [],
|
|
2098
2099
|
width,
|
|
2099
2100
|
x,
|
|
@@ -2125,12 +2126,12 @@ const map$1 = Object.create(null);
|
|
|
2125
2126
|
const set$8 = (id, widget) => {
|
|
2126
2127
|
map$1[id] = widget;
|
|
2127
2128
|
};
|
|
2128
|
-
const get$
|
|
2129
|
+
const get$7 = id => {
|
|
2129
2130
|
return map$1[id];
|
|
2130
2131
|
};
|
|
2131
2132
|
|
|
2132
2133
|
const getModule = id => {
|
|
2133
|
-
return get$
|
|
2134
|
+
return get$7(id);
|
|
2134
2135
|
};
|
|
2135
2136
|
|
|
2136
2137
|
const applyWidgetChange = async (editor, widget, changes) => {
|
|
@@ -2610,7 +2611,7 @@ const has = languageId => {
|
|
|
2610
2611
|
const set$6 = (languageId, tokenizer) => {
|
|
2611
2612
|
state$9.tokenizers[languageId] = tokenizer;
|
|
2612
2613
|
};
|
|
2613
|
-
const get$
|
|
2614
|
+
const get$6 = languageId => {
|
|
2614
2615
|
return state$9.tokenizers[languageId];
|
|
2615
2616
|
};
|
|
2616
2617
|
const setTokenizePath = (languageId, tokenizePath) => {
|
|
@@ -2634,7 +2635,7 @@ const tokenMaps = Object.create(null);
|
|
|
2634
2635
|
const set$5 = (languageId, tokenMap) => {
|
|
2635
2636
|
tokenMaps[languageId] = tokenMap;
|
|
2636
2637
|
};
|
|
2637
|
-
const get$
|
|
2638
|
+
const get$5 = languageId => {
|
|
2638
2639
|
return tokenMaps[languageId] || {};
|
|
2639
2640
|
};
|
|
2640
2641
|
|
|
@@ -2672,7 +2673,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
2672
2673
|
};
|
|
2673
2674
|
const getTokenizer = languageId => {
|
|
2674
2675
|
if (has(languageId)) {
|
|
2675
|
-
return get$
|
|
2676
|
+
return get$6(languageId);
|
|
2676
2677
|
}
|
|
2677
2678
|
if (isPending(languageId)) {
|
|
2678
2679
|
return TokenizePlainText;
|
|
@@ -2684,7 +2685,7 @@ const tokenizers = Object.create(null);
|
|
|
2684
2685
|
const set$4 = (id, value) => {
|
|
2685
2686
|
tokenizers[id] = value;
|
|
2686
2687
|
};
|
|
2687
|
-
const get$
|
|
2688
|
+
const get$4 = id => {
|
|
2688
2689
|
return tokenizers[id] || TokenizePlainText;
|
|
2689
2690
|
};
|
|
2690
2691
|
|
|
@@ -2766,7 +2767,7 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
2766
2767
|
lines,
|
|
2767
2768
|
tokenizerId
|
|
2768
2769
|
} = editor;
|
|
2769
|
-
const tokenizer = get$
|
|
2770
|
+
const tokenizer = get$4(tokenizerId);
|
|
2770
2771
|
const {
|
|
2771
2772
|
hasArrayReturn,
|
|
2772
2773
|
initialLineState,
|
|
@@ -3337,7 +3338,7 @@ const getLineInfosViewport = (editor, tokens, embeddedResults, minLineY, maxLine
|
|
|
3337
3338
|
languageId,
|
|
3338
3339
|
lines
|
|
3339
3340
|
} = editor;
|
|
3340
|
-
const tokenMap = get$
|
|
3341
|
+
const tokenMap = get$5(languageId);
|
|
3341
3342
|
let offset = minLineOffset;
|
|
3342
3343
|
const tabSize = 2;
|
|
3343
3344
|
for (let i = minLineY; i < maxLineY; i++) {
|
|
@@ -3715,7 +3716,7 @@ const notifyListeners = async (listenerType, method, ...params) => {
|
|
|
3715
3716
|
// Notify all listeners in parallel
|
|
3716
3717
|
const notifications = rpcIds.map(async rpcId => {
|
|
3717
3718
|
try {
|
|
3718
|
-
const rpc = get$
|
|
3719
|
+
const rpc = get$9(rpcId);
|
|
3719
3720
|
if (rpc) {
|
|
3720
3721
|
await rpc.invoke(method, ...params);
|
|
3721
3722
|
}
|
|
@@ -4528,7 +4529,7 @@ const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpa
|
|
|
4528
4529
|
return await measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
|
|
4529
4530
|
};
|
|
4530
4531
|
|
|
4531
|
-
const get$
|
|
4532
|
+
const get$3 = async key => {
|
|
4532
4533
|
const value = await getPreference(key);
|
|
4533
4534
|
return value;
|
|
4534
4535
|
};
|
|
@@ -4649,6 +4650,7 @@ const createEditor = async ({
|
|
|
4649
4650
|
useFunctionalRendering,
|
|
4650
4651
|
validLines: [],
|
|
4651
4652
|
visibleLineIndices: [],
|
|
4653
|
+
widgetRevision: 0,
|
|
4652
4654
|
widgets: [],
|
|
4653
4655
|
width,
|
|
4654
4656
|
x,
|
|
@@ -4691,7 +4693,7 @@ const createEditor = async ({
|
|
|
4691
4693
|
// e.g. it might not always be necessary to send text to extension host worker
|
|
4692
4694
|
// @ts-ignore
|
|
4693
4695
|
await invoke$6(TextDocumentSyncFull, uri, id, languageId, content);
|
|
4694
|
-
const completionsOnTypeRaw = await get$
|
|
4696
|
+
const completionsOnTypeRaw = await get$3('editor.completionsOnType');
|
|
4695
4697
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
4696
4698
|
set$9(id, emptyEditor, {
|
|
4697
4699
|
...newEditor4,
|
|
@@ -4721,7 +4723,7 @@ const createStandaloneEditor = async ({
|
|
|
4721
4723
|
y
|
|
4722
4724
|
}) => {
|
|
4723
4725
|
createEditor2(id, uri, x, y, width, height, platform, assetDir);
|
|
4724
|
-
const createdEditor = get$
|
|
4726
|
+
const createdEditor = get$8(id).newState;
|
|
4725
4727
|
await loadTokenizer(languageId, tokenizePath);
|
|
4726
4728
|
const tokenizerId = createdEditor.tokenizerId + 1;
|
|
4727
4729
|
set$4(tokenizerId, getTokenizer(languageId));
|
|
@@ -4802,7 +4804,7 @@ const RenderWidgets = 13;
|
|
|
4802
4804
|
const RenderAdditionalFocusContext = 14;
|
|
4803
4805
|
|
|
4804
4806
|
const isEqual = (oldState, newState) => {
|
|
4805
|
-
return oldState.widgets === newState.widgets;
|
|
4807
|
+
return oldState.widgets === newState.widgets && oldState.widgetRevision === newState.widgetRevision;
|
|
4806
4808
|
};
|
|
4807
4809
|
|
|
4808
4810
|
const modules = [isEqual$1, isEqual$2, isEqual$2, isEqual$4, isEqual$3, isEqual];
|
|
@@ -4823,37 +4825,45 @@ const diff2 = uid => {
|
|
|
4823
4825
|
const {
|
|
4824
4826
|
newState,
|
|
4825
4827
|
oldState
|
|
4826
|
-
} = get$
|
|
4828
|
+
} = get$8(uid);
|
|
4827
4829
|
const result = diff(oldState, newState);
|
|
4828
4830
|
return result;
|
|
4829
4831
|
};
|
|
4830
4832
|
|
|
4831
4833
|
const addWidget$1 = widget => {
|
|
4832
|
-
const module = get$
|
|
4834
|
+
const module = get$7(widget.id);
|
|
4833
4835
|
if (!module) {
|
|
4834
4836
|
throw new Error('unsupported widget');
|
|
4835
4837
|
}
|
|
4836
4838
|
return module.add(widget);
|
|
4837
4839
|
};
|
|
4838
4840
|
const renderWidget = widget => {
|
|
4839
|
-
const module = get$
|
|
4841
|
+
const module = get$7(widget.id);
|
|
4840
4842
|
if (!module) {
|
|
4841
4843
|
throw new Error('unsupported widget');
|
|
4842
4844
|
}
|
|
4843
4845
|
return module.render(widget);
|
|
4844
4846
|
};
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
return
|
|
4847
|
+
|
|
4848
|
+
const revisions = new Map();
|
|
4849
|
+
const next = editorUid => {
|
|
4850
|
+
const revision = (revisions.get(editorUid) || 0) + 1;
|
|
4851
|
+
revisions.set(editorUid, revision);
|
|
4852
|
+
return revision;
|
|
4853
|
+
};
|
|
4854
|
+
const get$2 = editorUid => {
|
|
4855
|
+
return revisions.get(editorUid) || 0;
|
|
4856
|
+
};
|
|
4857
|
+
const record = (editorUid, revision) => {
|
|
4858
|
+
revisions.set(editorUid, Math.max(get$2(editorUid), revision));
|
|
4859
|
+
};
|
|
4860
|
+
const dispose$1 = editorUid => {
|
|
4861
|
+
revisions.delete(editorUid);
|
|
4851
4862
|
};
|
|
4852
4863
|
|
|
4853
4864
|
const renderWidgets$1 = (oldState, newState) => {
|
|
4854
4865
|
const addedWidgets = [];
|
|
4855
4866
|
const changedWidgets = [];
|
|
4856
|
-
const removedWidgets = [];
|
|
4857
4867
|
const oldWidgets = oldState.widgets || [];
|
|
4858
4868
|
const newWidgets = newState.widgets || [];
|
|
4859
4869
|
const oldWidgetMap = Object.create(null);
|
|
@@ -4867,8 +4877,6 @@ const renderWidgets$1 = (oldState, newState) => {
|
|
|
4867
4877
|
for (const oldWidget of oldWidgets) {
|
|
4868
4878
|
if (Object.hasOwn(newWidgetMap, oldWidget.id)) {
|
|
4869
4879
|
changedWidgets.push(newWidgetMap[oldWidget.id]);
|
|
4870
|
-
} else {
|
|
4871
|
-
removedWidgets.push(oldWidget);
|
|
4872
4880
|
}
|
|
4873
4881
|
}
|
|
4874
4882
|
for (const newWidget of newWidgets) {
|
|
@@ -4890,19 +4898,16 @@ const renderWidgets$1 = (oldState, newState) => {
|
|
|
4890
4898
|
changeCommands.push(...childCommands);
|
|
4891
4899
|
}
|
|
4892
4900
|
}
|
|
4893
|
-
const
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
}
|
|
4900
|
-
const allCommands = [...addCommands, ...changeCommands, ...removeCommands];
|
|
4901
|
-
return allCommands.filter(item => item[0] !== 'Viewlet.setFocusContext');
|
|
4901
|
+
const hasDeclaredRevision = typeof newState.widgetRevision === 'number' && newState.widgetRevision > (oldState.widgetRevision || 0);
|
|
4902
|
+
const declaredRevision = hasDeclaredRevision ? newState.widgetRevision : next(newState.uid);
|
|
4903
|
+
record(newState.uid, declaredRevision);
|
|
4904
|
+
const widgetUids = newWidgets.map(widget => widget.newState.uid);
|
|
4905
|
+
const allCommands = [...addCommands, ...changeCommands, ['Viewlet.setWidgets', newState.uid, declaredRevision, widgetUids]];
|
|
4906
|
+
return allCommands.filter(item => item[0] !== 'Viewlet.setFocusContext' && item[0] !== 'Viewlet.appendToBody');
|
|
4902
4907
|
};
|
|
4903
4908
|
|
|
4904
4909
|
const disposeEditor = async editorUid => {
|
|
4905
|
-
const editor = get$
|
|
4910
|
+
const editor = get$8(editorUid)?.newState;
|
|
4906
4911
|
if (!editor) {
|
|
4907
4912
|
return [];
|
|
4908
4913
|
}
|
|
@@ -4912,9 +4917,11 @@ const disposeEditor = async editorUid => {
|
|
|
4912
4917
|
}
|
|
4913
4918
|
}
|
|
4914
4919
|
const commands = renderWidgets$1(editor, {
|
|
4920
|
+
...editor,
|
|
4915
4921
|
widgets: []
|
|
4916
4922
|
});
|
|
4917
4923
|
dispose$1(editorUid);
|
|
4924
|
+
dispose$2(editorUid);
|
|
4918
4925
|
return commands;
|
|
4919
4926
|
};
|
|
4920
4927
|
|
|
@@ -5073,7 +5080,7 @@ const getOpenEditor = (currentEditor, uri) => {
|
|
|
5073
5080
|
return currentEditor;
|
|
5074
5081
|
}
|
|
5075
5082
|
for (const key of getKeys$2()) {
|
|
5076
|
-
const editor = get$
|
|
5083
|
+
const editor = get$8(Number(key))?.newState;
|
|
5077
5084
|
if (editor && !editor.initial && editor.uri === uri) {
|
|
5078
5085
|
return editor;
|
|
5079
5086
|
}
|
|
@@ -5509,16 +5516,18 @@ const handleBlur$1 = async editor => {
|
|
|
5509
5516
|
if (!editor.focused) {
|
|
5510
5517
|
return editor;
|
|
5511
5518
|
}
|
|
5519
|
+
const widgetRevision = next(editor.uid);
|
|
5512
5520
|
const newEditor = {
|
|
5513
5521
|
...editor,
|
|
5514
5522
|
additionalFocus: 0,
|
|
5515
5523
|
focused: false,
|
|
5524
|
+
widgetRevision,
|
|
5516
5525
|
widgets: closeWidgetsMaybe(editor.widgets || [])
|
|
5517
5526
|
};
|
|
5518
5527
|
if (!editor.modified) {
|
|
5519
5528
|
return newEditor;
|
|
5520
5529
|
}
|
|
5521
|
-
const autoSave = await get$
|
|
5530
|
+
const autoSave = await get$3('files.autoSave');
|
|
5522
5531
|
if (autoSave === 'off') {
|
|
5523
5532
|
return newEditor;
|
|
5524
5533
|
}
|
|
@@ -5650,6 +5659,7 @@ const closeCodeGenerator = editor => {
|
|
|
5650
5659
|
const {
|
|
5651
5660
|
widgets
|
|
5652
5661
|
} = editor;
|
|
5662
|
+
const widgetRevision = next(editor.uid);
|
|
5653
5663
|
const index = widgets.findIndex(isMatchingWidget$2);
|
|
5654
5664
|
if (index === -1) {
|
|
5655
5665
|
return editor;
|
|
@@ -5658,6 +5668,7 @@ const closeCodeGenerator = editor => {
|
|
|
5658
5668
|
return {
|
|
5659
5669
|
...editor,
|
|
5660
5670
|
focused: true,
|
|
5671
|
+
widgetRevision,
|
|
5661
5672
|
widgets: newWidgets
|
|
5662
5673
|
};
|
|
5663
5674
|
};
|
|
@@ -5666,6 +5677,7 @@ const closeCompletion = editor => {
|
|
|
5666
5677
|
const {
|
|
5667
5678
|
widgets
|
|
5668
5679
|
} = editor;
|
|
5680
|
+
const widgetRevision = next(editor.uid);
|
|
5669
5681
|
if (widgets.every(widget => widget.id !== Completion)) {
|
|
5670
5682
|
return editor;
|
|
5671
5683
|
}
|
|
@@ -5673,6 +5685,7 @@ const closeCompletion = editor => {
|
|
|
5673
5685
|
...editor,
|
|
5674
5686
|
additionalFocus: 0,
|
|
5675
5687
|
focused: true,
|
|
5688
|
+
widgetRevision,
|
|
5676
5689
|
widgets: removeEditorWidget(widgets, Completion)
|
|
5677
5690
|
};
|
|
5678
5691
|
};
|
|
@@ -5684,6 +5697,7 @@ const closeFind = editor => {
|
|
|
5684
5697
|
const {
|
|
5685
5698
|
widgets
|
|
5686
5699
|
} = editor;
|
|
5700
|
+
const widgetRevision = next(editor.uid);
|
|
5687
5701
|
const index = widgets.findIndex(isMatchingWidget$1);
|
|
5688
5702
|
if (index === -1) {
|
|
5689
5703
|
return editor;
|
|
@@ -5694,6 +5708,7 @@ const closeFind = editor => {
|
|
|
5694
5708
|
additionalFocus: 0,
|
|
5695
5709
|
focus: FocusEditorText$1,
|
|
5696
5710
|
focused: true,
|
|
5711
|
+
widgetRevision,
|
|
5697
5712
|
widgets: newWidgets
|
|
5698
5713
|
};
|
|
5699
5714
|
};
|
|
@@ -5727,17 +5742,21 @@ const closeRename = async editor => {
|
|
|
5727
5742
|
uid,
|
|
5728
5743
|
widgets
|
|
5729
5744
|
} = editor;
|
|
5745
|
+
const widgetRevision = next(uid);
|
|
5730
5746
|
const renameWidgetIndex = widgets.findIndex(isRenameWidget);
|
|
5731
5747
|
if (renameWidgetIndex === -1) {
|
|
5732
5748
|
return editor;
|
|
5733
5749
|
}
|
|
5734
5750
|
const renameWidget = widgets[renameWidgetIndex];
|
|
5735
5751
|
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
5736
|
-
const latest = get$
|
|
5752
|
+
const latest = get$8(uid);
|
|
5737
5753
|
const {
|
|
5738
5754
|
newState
|
|
5739
5755
|
} = latest;
|
|
5740
|
-
return
|
|
5756
|
+
return {
|
|
5757
|
+
...newState,
|
|
5758
|
+
widgetRevision: Math.max(newState.widgetRevision || 0, widgetRevision)
|
|
5759
|
+
};
|
|
5741
5760
|
};
|
|
5742
5761
|
|
|
5743
5762
|
const isMatchingWidget = widget => {
|
|
@@ -5747,6 +5766,7 @@ const closeSourceAction = editor => {
|
|
|
5747
5766
|
const {
|
|
5748
5767
|
widgets
|
|
5749
5768
|
} = editor;
|
|
5769
|
+
const widgetRevision = next(editor.uid);
|
|
5750
5770
|
const index = widgets.findIndex(isMatchingWidget);
|
|
5751
5771
|
if (index === -1) {
|
|
5752
5772
|
return editor;
|
|
@@ -5754,6 +5774,7 @@ const closeSourceAction = editor => {
|
|
|
5754
5774
|
const newWidgets = removeEditorWidget(widgets, SourceAction$1);
|
|
5755
5775
|
return {
|
|
5756
5776
|
...editor,
|
|
5777
|
+
widgetRevision,
|
|
5757
5778
|
widgets: newWidgets
|
|
5758
5779
|
};
|
|
5759
5780
|
};
|
|
@@ -5774,6 +5795,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
5774
5795
|
if (hasWidget(widgets, widgetId)) {
|
|
5775
5796
|
return editor;
|
|
5776
5797
|
}
|
|
5798
|
+
const widgetRevision = next(editor.uid);
|
|
5777
5799
|
const widget = factory();
|
|
5778
5800
|
// @ts-ignore
|
|
5779
5801
|
widget.newState.editorUid = editor.uid;
|
|
@@ -5781,6 +5803,9 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
5781
5803
|
if (!newState) {
|
|
5782
5804
|
return editor;
|
|
5783
5805
|
}
|
|
5806
|
+
if (get$2(editor.uid) !== widgetRevision) {
|
|
5807
|
+
return get$8(editor.uid)?.newState || editor;
|
|
5808
|
+
}
|
|
5784
5809
|
// @ts-ignore
|
|
5785
5810
|
newState.editorUid = editor.uid;
|
|
5786
5811
|
const latestWidget = {
|
|
@@ -5794,6 +5819,7 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
5794
5819
|
additionalFocus: fullFocus ? 0 : focusKey,
|
|
5795
5820
|
focus: fullFocus ? focusKey : FocusEditorText$1,
|
|
5796
5821
|
focused: newFocus,
|
|
5822
|
+
widgetRevision,
|
|
5797
5823
|
widgets: newWidgets
|
|
5798
5824
|
};
|
|
5799
5825
|
return newEditor;
|
|
@@ -5834,6 +5860,7 @@ const closeColorPicker = editor => {
|
|
|
5834
5860
|
const {
|
|
5835
5861
|
widgets
|
|
5836
5862
|
} = editor;
|
|
5863
|
+
const widgetRevision = next(editor.uid);
|
|
5837
5864
|
if (widgets.every(widget => widget.id !== ColorPicker$1)) {
|
|
5838
5865
|
return editor;
|
|
5839
5866
|
}
|
|
@@ -5842,6 +5869,7 @@ const closeColorPicker = editor => {
|
|
|
5842
5869
|
additionalFocus: 0,
|
|
5843
5870
|
focus: FocusEditorText$1,
|
|
5844
5871
|
focused: true,
|
|
5872
|
+
widgetRevision,
|
|
5845
5873
|
widgets: removeEditorWidget(widgets, ColorPicker$1)
|
|
5846
5874
|
};
|
|
5847
5875
|
};
|
|
@@ -7190,11 +7218,13 @@ const Alt = 2;
|
|
|
7190
7218
|
|
|
7191
7219
|
const handleSingleClickDefault = (editor, position) => {
|
|
7192
7220
|
const widgets = closeWidgetsMaybe(editor.widgets);
|
|
7221
|
+
const widgetRevision = next(editor.uid);
|
|
7193
7222
|
return {
|
|
7194
7223
|
...editor,
|
|
7195
7224
|
focused: true,
|
|
7196
7225
|
selectionAnchorPosition: position,
|
|
7197
7226
|
selections: new Uint32Array([position.rowIndex, position.columnIndex, position.rowIndex, position.columnIndex]),
|
|
7227
|
+
widgetRevision,
|
|
7198
7228
|
widgets
|
|
7199
7229
|
};
|
|
7200
7230
|
};
|
|
@@ -7695,7 +7725,7 @@ const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) =>
|
|
|
7695
7725
|
};
|
|
7696
7726
|
const getEditorHoverInfo = async (editorUid, position) => {
|
|
7697
7727
|
number(editorUid);
|
|
7698
|
-
const instance = get$
|
|
7728
|
+
const instance = get$8(editorUid);
|
|
7699
7729
|
const editor = instance.newState;
|
|
7700
7730
|
const {
|
|
7701
7731
|
selections
|
|
@@ -7765,13 +7795,13 @@ const showHover2 = async (editor, position) => {
|
|
|
7765
7795
|
};
|
|
7766
7796
|
|
|
7767
7797
|
const showHover$1 = async (editor, position, token) => {
|
|
7768
|
-
const instance = get$
|
|
7798
|
+
const instance = get$8(editor.uid);
|
|
7769
7799
|
if (!instance) {
|
|
7770
7800
|
return;
|
|
7771
7801
|
}
|
|
7772
7802
|
const latestEditor = instance.newState;
|
|
7773
7803
|
const newEditor = await showHover2(latestEditor, position);
|
|
7774
|
-
const latestInstance = get$
|
|
7804
|
+
const latestInstance = get$8(editor.uid);
|
|
7775
7805
|
if (latestEditor === newEditor || !latestInstance || latestInstance.newState !== latestEditor || get$1().token !== token) {
|
|
7776
7806
|
return;
|
|
7777
7807
|
}
|
|
@@ -8055,7 +8085,7 @@ const getNewEditor = (editor, position) => {
|
|
|
8055
8085
|
return editor;
|
|
8056
8086
|
};
|
|
8057
8087
|
const continueScrollingAndMovingSelection = async editorUid => {
|
|
8058
|
-
const editorState = get$
|
|
8088
|
+
const editorState = get$8(editorUid);
|
|
8059
8089
|
const editor = editorState?.newState;
|
|
8060
8090
|
if (!editor || !editor.hasListener || !editor.isSelecting) {
|
|
8061
8091
|
return;
|
|
@@ -8618,7 +8648,7 @@ const newStateGenerator$3 = async (state, parentUid) => {
|
|
|
8618
8648
|
} = state;
|
|
8619
8649
|
const {
|
|
8620
8650
|
newState
|
|
8621
|
-
} = get$
|
|
8651
|
+
} = get$8(parentUid);
|
|
8622
8652
|
const {
|
|
8623
8653
|
languageId
|
|
8624
8654
|
} = newState;
|
|
@@ -8651,7 +8681,7 @@ const isFunctional = widgetId => {
|
|
|
8651
8681
|
}
|
|
8652
8682
|
};
|
|
8653
8683
|
const addWidget = (widget, id, render) => {
|
|
8654
|
-
const commands = render(widget);
|
|
8684
|
+
const commands = render(widget).filter(command => command[0] !== 'Viewlet.appendToBody');
|
|
8655
8685
|
// TODO how to generate a unique integer id
|
|
8656
8686
|
// that doesn't collide with ids created in renderer worker?
|
|
8657
8687
|
// @ts-ignore
|
|
@@ -8661,11 +8691,6 @@ const addWidget = (widget, id, render) => {
|
|
|
8661
8691
|
const allCommands = [];
|
|
8662
8692
|
allCommands.push(['Viewlet.createFunctionalRoot', id, uid, isFunctional(widget.id)]);
|
|
8663
8693
|
allCommands.push(...commands);
|
|
8664
|
-
if (isFunctional(widget.id)) {
|
|
8665
|
-
allCommands.push(['Viewlet.appendToBody', uid]);
|
|
8666
|
-
} else {
|
|
8667
|
-
allCommands.push(['Viewlet.send', uid, 'appendWidget']);
|
|
8668
|
-
}
|
|
8669
8694
|
const focusCommandIndex = allCommands.findIndex(command => {
|
|
8670
8695
|
return command[2] === 'focus' || command[0] === 'Viewlet.focusSelector';
|
|
8671
8696
|
});
|
|
@@ -8691,18 +8716,18 @@ const launchFindWidgetWorker = async () => {
|
|
|
8691
8716
|
const rpcId = 9002;
|
|
8692
8717
|
const launch = async () => {
|
|
8693
8718
|
// TODO race condition
|
|
8694
|
-
if (get$
|
|
8719
|
+
if (get$9(rpcId)) {
|
|
8695
8720
|
return;
|
|
8696
8721
|
}
|
|
8697
8722
|
const rpc = await launchFindWidgetWorker();
|
|
8698
8723
|
set$i(rpcId, rpc);
|
|
8699
8724
|
};
|
|
8700
8725
|
const invoke$3 = async (method, ...params) => {
|
|
8701
|
-
const rpc = get$
|
|
8726
|
+
const rpc = get$9(rpcId);
|
|
8702
8727
|
return await rpc.invoke(method, ...params);
|
|
8703
8728
|
};
|
|
8704
8729
|
const dispose = async () => {
|
|
8705
|
-
const rpc = get$
|
|
8730
|
+
const rpc = get$9(rpcId);
|
|
8706
8731
|
remove$8(rpcId);
|
|
8707
8732
|
if (rpc) {
|
|
8708
8733
|
await rpc.dispose();
|
|
@@ -8800,7 +8825,7 @@ const updateWidget = (editor, widgetId, newState) => {
|
|
|
8800
8825
|
|
|
8801
8826
|
const getEditorByWidgetUid = (widgetUid, widgetId) => {
|
|
8802
8827
|
for (const key of getKeys$2()) {
|
|
8803
|
-
const editor = get$
|
|
8828
|
+
const editor = get$8(Number(key)).newState;
|
|
8804
8829
|
const widgets = editor.widgets || [];
|
|
8805
8830
|
for (const widget of widgets) {
|
|
8806
8831
|
if (widget.id === widgetId && widget.newState.uid === widgetUid) {
|
|
@@ -8814,7 +8839,7 @@ const getEditor$1 = (editorOrUid, widgetId) => {
|
|
|
8814
8839
|
if (editorOrUid && editorOrUid.widgets) {
|
|
8815
8840
|
return editorOrUid;
|
|
8816
8841
|
}
|
|
8817
|
-
const instance = get$
|
|
8842
|
+
const instance = get$8(editorOrUid);
|
|
8818
8843
|
if (instance && instance.newState && instance.newState.widgets) {
|
|
8819
8844
|
return instance.newState;
|
|
8820
8845
|
}
|
|
@@ -8832,6 +8857,8 @@ const createFn = (key, name, widgetId) => {
|
|
|
8832
8857
|
if (!editor) {
|
|
8833
8858
|
return editorOrUid;
|
|
8834
8859
|
}
|
|
8860
|
+
const shouldClose = isClose(args);
|
|
8861
|
+
const widgetRevision = shouldClose ? next(editor.uid) : editor.widgetRevision;
|
|
8835
8862
|
const childIndex = editor.widgets.findIndex(isWidget);
|
|
8836
8863
|
if (childIndex === -1) {
|
|
8837
8864
|
return editor;
|
|
@@ -8844,13 +8871,19 @@ const createFn = (key, name, widgetId) => {
|
|
|
8844
8871
|
} = state;
|
|
8845
8872
|
const invoke = getWidgetInvoke(widgetId);
|
|
8846
8873
|
await invoke(`${name}.${key}`, uid, ...args);
|
|
8874
|
+
const latestAfterInvoke = get$8(editor.uid).newState;
|
|
8875
|
+
const latestChildIndex = latestAfterInvoke.widgets.findIndex(isWidget);
|
|
8876
|
+
if (latestChildIndex === -1) {
|
|
8877
|
+
return latestAfterInvoke;
|
|
8878
|
+
}
|
|
8847
8879
|
const diff = await invoke(`${name}.diff2`, uid);
|
|
8848
8880
|
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
8849
|
-
const latest = get$
|
|
8850
|
-
if (
|
|
8881
|
+
const latest = get$8(editor.uid).newState;
|
|
8882
|
+
if (shouldClose) {
|
|
8851
8883
|
const newEditor = {
|
|
8852
8884
|
...latest,
|
|
8853
8885
|
focused: true,
|
|
8886
|
+
widgetRevision,
|
|
8854
8887
|
widgets: removeEditorWidget(latest.widgets, widgetId)
|
|
8855
8888
|
};
|
|
8856
8889
|
set$9(editor.uid, latest, newEditor);
|
|
@@ -8881,7 +8914,6 @@ const renderFull$4 = (oldState, newState) => {
|
|
|
8881
8914
|
return commands;
|
|
8882
8915
|
};
|
|
8883
8916
|
|
|
8884
|
-
const AppendToBody = 'Viewlet.appendToBody';
|
|
8885
8917
|
const Focus = 'focus';
|
|
8886
8918
|
const FocusSelector = 'Viewlet.focusSelector';
|
|
8887
8919
|
const RegisterEventListeners = 'Viewlet.registerEventListeners';
|
|
@@ -8894,7 +8926,7 @@ const SetCss = 'Viewlet.setCss';
|
|
|
8894
8926
|
const SetDom2 = 'Viewlet.setDom2';
|
|
8895
8927
|
const SetUid = 'Viewlet.setUid';
|
|
8896
8928
|
|
|
8897
|
-
const commandsToForward$5 = [SetDom2, SetCss,
|
|
8929
|
+
const commandsToForward$5 = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
8898
8930
|
const render$c = widget => {
|
|
8899
8931
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
8900
8932
|
const wrappedCommands = [];
|
|
@@ -8914,7 +8946,7 @@ const add$8 = widget => {
|
|
|
8914
8946
|
return addWidget(widget, 'FindWidget', render$c);
|
|
8915
8947
|
};
|
|
8916
8948
|
const remove$7 = widget => {
|
|
8917
|
-
return [
|
|
8949
|
+
return [];
|
|
8918
8950
|
};
|
|
8919
8951
|
const focusFindInput = editor => {
|
|
8920
8952
|
const widget = editor.widgets.find(widget => widget.id === Find);
|
|
@@ -9022,7 +9054,7 @@ const create$2 = () => {
|
|
|
9022
9054
|
};
|
|
9023
9055
|
|
|
9024
9056
|
const getEditor = editorUid => {
|
|
9025
|
-
const instance = get$
|
|
9057
|
+
const instance = get$8(editorUid);
|
|
9026
9058
|
if (!instance) {
|
|
9027
9059
|
throw new Error(`editor ${editorUid} not found`);
|
|
9028
9060
|
}
|
|
@@ -9130,7 +9162,7 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
9130
9162
|
} = state;
|
|
9131
9163
|
const {
|
|
9132
9164
|
newState
|
|
9133
|
-
} = get$
|
|
9165
|
+
} = get$8(parentUid);
|
|
9134
9166
|
const {
|
|
9135
9167
|
languageId
|
|
9136
9168
|
} = newState;
|
|
@@ -9848,7 +9880,7 @@ const getSignatureHelp = async (editor, offset) => {
|
|
|
9848
9880
|
|
|
9849
9881
|
const getSignatureHelpInfo = async editorUid => {
|
|
9850
9882
|
number(editorUid);
|
|
9851
|
-
const instance = get$
|
|
9883
|
+
const instance = get$8(editorUid);
|
|
9852
9884
|
const editor = instance.newState;
|
|
9853
9885
|
const {
|
|
9854
9886
|
selections
|
|
@@ -9960,7 +9992,7 @@ const newStateGenerator = async (state, parentUid) => {
|
|
|
9960
9992
|
} = state;
|
|
9961
9993
|
const {
|
|
9962
9994
|
newState
|
|
9963
|
-
} = get$
|
|
9995
|
+
} = get$8(parentUid);
|
|
9964
9996
|
const {
|
|
9965
9997
|
languageId
|
|
9966
9998
|
} = newState;
|
|
@@ -10782,7 +10814,7 @@ const renderFull$3 = (oldState, newState) => {
|
|
|
10782
10814
|
return commands;
|
|
10783
10815
|
};
|
|
10784
10816
|
|
|
10785
|
-
const commandsToForward$4 = [SetDom2, SetCss,
|
|
10817
|
+
const commandsToForward$4 = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
10786
10818
|
const render$b = widget => {
|
|
10787
10819
|
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
10788
10820
|
const wrappedCommands = [];
|
|
@@ -10802,7 +10834,7 @@ const add$7 = widget => {
|
|
|
10802
10834
|
return addWidget(widget, 'EditorCompletion', render$b);
|
|
10803
10835
|
};
|
|
10804
10836
|
const remove$6 = widget => {
|
|
10805
|
-
return [
|
|
10837
|
+
return [];
|
|
10806
10838
|
};
|
|
10807
10839
|
const {
|
|
10808
10840
|
close: close$3,
|
|
@@ -11064,7 +11096,7 @@ const renderHover = (oldState, newState) => {
|
|
|
11064
11096
|
return commands;
|
|
11065
11097
|
};
|
|
11066
11098
|
|
|
11067
|
-
const commandsToForward$3 = [SetDom2, SetCss,
|
|
11099
|
+
const commandsToForward$3 = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
11068
11100
|
const render$9 = widget => {
|
|
11069
11101
|
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
11070
11102
|
const wrappedCommands = [];
|
|
@@ -11084,7 +11116,7 @@ const add$6 = widget => {
|
|
|
11084
11116
|
return addWidget(widget, 'EditorRename', render$9);
|
|
11085
11117
|
};
|
|
11086
11118
|
const remove$5 = widget => {
|
|
11087
|
-
return [
|
|
11119
|
+
return [];
|
|
11088
11120
|
};
|
|
11089
11121
|
const {
|
|
11090
11122
|
accept,
|
|
@@ -11121,11 +11153,10 @@ const focusNext$1 = state => {
|
|
|
11121
11153
|
};
|
|
11122
11154
|
|
|
11123
11155
|
const removeWidget = widget => {
|
|
11124
|
-
|
|
11125
|
-
return [['Viewlet.dispose', widget.newState.uid]];
|
|
11156
|
+
return [];
|
|
11126
11157
|
};
|
|
11127
11158
|
|
|
11128
|
-
const commandsToForward$2 = [SetDom2, SetCss,
|
|
11159
|
+
const commandsToForward$2 = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
11129
11160
|
const render$8 = widget => {
|
|
11130
11161
|
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
11131
11162
|
const wrappedCommands = [];
|
|
@@ -11220,7 +11251,7 @@ const getEditorSourceActions = async editorId => {
|
|
|
11220
11251
|
}
|
|
11221
11252
|
const {
|
|
11222
11253
|
newState
|
|
11223
|
-
} = get$
|
|
11254
|
+
} = get$8(editorId);
|
|
11224
11255
|
const offset = getOffsetAtCursor$1(newState);
|
|
11225
11256
|
return execute({
|
|
11226
11257
|
args: [offset],
|
|
@@ -11333,6 +11364,7 @@ const setSelections2 = async (editorUid, selections) => {
|
|
|
11333
11364
|
};
|
|
11334
11365
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
11335
11366
|
const editor = getEditor(editorUid);
|
|
11367
|
+
const widgetRevision = next(editorUid);
|
|
11336
11368
|
const invoke = getWidgetInvoke(widgetId);
|
|
11337
11369
|
const {
|
|
11338
11370
|
widgets
|
|
@@ -11347,6 +11379,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
11347
11379
|
...editor,
|
|
11348
11380
|
decorations: widgetId === Rename$1 ? editor.decorations.slice(0, -4) : editor.decorations,
|
|
11349
11381
|
focused: true,
|
|
11382
|
+
widgetRevision,
|
|
11350
11383
|
widgets: newWidgets
|
|
11351
11384
|
};
|
|
11352
11385
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
@@ -11869,7 +11902,7 @@ const getProblems = async () => {
|
|
|
11869
11902
|
const keys = getKeys$2();
|
|
11870
11903
|
const diagnostics = keys.flatMap(key => {
|
|
11871
11904
|
const numericKey = Number(key);
|
|
11872
|
-
const editor = get$
|
|
11905
|
+
const editor = get$8(numericKey);
|
|
11873
11906
|
if (!editor?.newState) {
|
|
11874
11907
|
return [];
|
|
11875
11908
|
}
|
|
@@ -12013,49 +12046,49 @@ const kAutoClosingBrackets = 'editor.autoclosingBrackets';
|
|
|
12013
12046
|
const kFontWeight = 'editor.fontWeight';
|
|
12014
12047
|
const kHover = 'editor.hover';
|
|
12015
12048
|
const isAutoClosingBracketsEnabled = async () => {
|
|
12016
|
-
return Boolean(await get$
|
|
12049
|
+
return Boolean(await get$3(kAutoClosingBrackets));
|
|
12017
12050
|
};
|
|
12018
12051
|
const isAutoClosingQuotesEnabled = async () => {
|
|
12019
|
-
return Boolean(await get$
|
|
12052
|
+
return Boolean(await get$3(kAutoClosingQuotes));
|
|
12020
12053
|
};
|
|
12021
12054
|
const isQuickSuggestionsEnabled = async () => {
|
|
12022
|
-
return Boolean(await get$
|
|
12055
|
+
return Boolean(await get$3(kQuickSuggestions));
|
|
12023
12056
|
};
|
|
12024
12057
|
const isAutoClosingTagsEnabled = async () => {
|
|
12025
12058
|
return true;
|
|
12026
12059
|
};
|
|
12027
12060
|
const getRowHeight = async () => {
|
|
12028
|
-
return (await get$
|
|
12061
|
+
return (await get$3(kLineHeight)) || 20;
|
|
12029
12062
|
};
|
|
12030
12063
|
const getFontSize = async () => {
|
|
12031
|
-
return (await get$
|
|
12064
|
+
return (await get$3(kFontSize)) || 15; // TODO find out if it is possible to use all numeric values for settings for efficiency, maybe settings could be an array
|
|
12032
12065
|
};
|
|
12033
12066
|
const getHoverEnabled = async () => {
|
|
12034
|
-
return (await get$
|
|
12067
|
+
return (await get$3(kHover)) ?? true;
|
|
12035
12068
|
};
|
|
12036
12069
|
const getFontFamily = async () => {
|
|
12037
|
-
return (await get$
|
|
12070
|
+
return (await get$3(kFontFamily)) || 'Fira Code';
|
|
12038
12071
|
};
|
|
12039
12072
|
const getLetterSpacing = async () => {
|
|
12040
12073
|
// if (!false) {
|
|
12041
12074
|
// return 0
|
|
12042
12075
|
// }
|
|
12043
|
-
return (await get$
|
|
12076
|
+
return (await get$3(kLetterSpacing)) ?? 0.5;
|
|
12044
12077
|
};
|
|
12045
12078
|
const getTabSize = async () => {
|
|
12046
|
-
return (await get$
|
|
12079
|
+
return (await get$3(kTabSize)) || 2;
|
|
12047
12080
|
};
|
|
12048
12081
|
const getLineNumbers = async () => {
|
|
12049
|
-
return (await get$
|
|
12082
|
+
return (await get$3(kLineNumbers)) ?? false;
|
|
12050
12083
|
};
|
|
12051
12084
|
const getCompletionTriggerCharacters = async () => {
|
|
12052
12085
|
return ['.', '/'];
|
|
12053
12086
|
};
|
|
12054
12087
|
const diagnosticsEnabled = async () => {
|
|
12055
|
-
return (await get$
|
|
12088
|
+
return (await get$3(kDiagnostics)) ?? false;
|
|
12056
12089
|
};
|
|
12057
12090
|
const getFontWeight = async () => {
|
|
12058
|
-
return (await get$
|
|
12091
|
+
return (await get$3(kFontWeight)) ?? 400;
|
|
12059
12092
|
};
|
|
12060
12093
|
|
|
12061
12094
|
const getEditorPreferences = async () => {
|
|
@@ -12088,7 +12121,7 @@ const handleSettingsChanged = async state => {
|
|
|
12088
12121
|
letterSpacing,
|
|
12089
12122
|
rowHeight
|
|
12090
12123
|
} = editorPreferences;
|
|
12091
|
-
const [charWidth, completionsOnTypeRaw] = await Promise.all([measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing), get$
|
|
12124
|
+
const [charWidth, completionsOnTypeRaw] = await Promise.all([measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing), get$3('editor.completionsOnType')]);
|
|
12092
12125
|
const isMonospaceFont = fontFamily === 'Fira Code' || fontFamily === "'Fira Code'";
|
|
12093
12126
|
const editorWithUpdatedSettings = {
|
|
12094
12127
|
...state,
|
|
@@ -12168,7 +12201,7 @@ const restoreWidgetState = async (keys, savedStates) => {
|
|
|
12168
12201
|
const newEditors = [];
|
|
12169
12202
|
for (const key of keys) {
|
|
12170
12203
|
const editorUid = parseInt(key);
|
|
12171
|
-
const editor = get$
|
|
12204
|
+
const editor = get$8(editorUid);
|
|
12172
12205
|
if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
|
|
12173
12206
|
continue;
|
|
12174
12207
|
}
|
|
@@ -12221,7 +12254,7 @@ const saveSingleWidgetState = async (savedStates, key, widget) => {
|
|
|
12221
12254
|
const saveWidgetState = async keys => {
|
|
12222
12255
|
const savedStates = Object.create(null);
|
|
12223
12256
|
for (const key of keys) {
|
|
12224
|
-
const editor = get$
|
|
12257
|
+
const editor = get$8(parseInt(key));
|
|
12225
12258
|
if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
|
|
12226
12259
|
continue;
|
|
12227
12260
|
}
|
|
@@ -12382,7 +12415,7 @@ const loadContent = async (state, savedState) => {
|
|
|
12382
12415
|
};
|
|
12383
12416
|
let existingEditor;
|
|
12384
12417
|
for (const key of getKeys$2()) {
|
|
12385
|
-
const editor = get$
|
|
12418
|
+
const editor = get$8(Number(key))?.newState;
|
|
12386
12419
|
if (editor && editor.id !== id && !editor.initial && editor.uri === uri) {
|
|
12387
12420
|
existingEditor = editor;
|
|
12388
12421
|
break;
|
|
@@ -12434,7 +12467,7 @@ const loadContent = async (state, savedState) => {
|
|
|
12434
12467
|
// e.g. it might not always be necessary to send text to extension host worker
|
|
12435
12468
|
// @ts-ignore
|
|
12436
12469
|
await invoke$6(TextDocumentSyncFull, uri, id, computedLanguageId, content);
|
|
12437
|
-
const completionsOnTypeRaw = await get$
|
|
12470
|
+
const completionsOnTypeRaw = await get$3('editor.completionsOnType');
|
|
12438
12471
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
12439
12472
|
const newEditor5 = {
|
|
12440
12473
|
...newEditor4,
|
|
@@ -12573,6 +12606,9 @@ const renderCss$1 = (oldState, newState) => {
|
|
|
12573
12606
|
};
|
|
12574
12607
|
|
|
12575
12608
|
const renderFocus$2 = (oldState, newState) => {
|
|
12609
|
+
if (!newState.focused) {
|
|
12610
|
+
return [];
|
|
12611
|
+
}
|
|
12576
12612
|
const selector = '.EditorInput textarea';
|
|
12577
12613
|
return [FocusSelector$1, newState.uid, selector];
|
|
12578
12614
|
};
|
|
@@ -13255,7 +13291,7 @@ const render2 = (uid, diffResult) => {
|
|
|
13255
13291
|
const {
|
|
13256
13292
|
newState,
|
|
13257
13293
|
oldState
|
|
13258
|
-
} = get$
|
|
13294
|
+
} = get$8(uid);
|
|
13259
13295
|
set$9(uid, newState, newState);
|
|
13260
13296
|
const commands = applyRender(oldState, newState, diffResult);
|
|
13261
13297
|
return commands;
|
|
@@ -13339,12 +13375,12 @@ const renderGutterInfo = {
|
|
|
13339
13375
|
};
|
|
13340
13376
|
const renderWidgets = {
|
|
13341
13377
|
apply: renderWidgets$1,
|
|
13342
|
-
isEqual: (oldState, newState) => oldState.widgets === newState.widgets,
|
|
13378
|
+
isEqual: (oldState, newState) => oldState.widgets === newState.widgets && oldState.widgetRevision === newState.widgetRevision,
|
|
13343
13379
|
multiple: true
|
|
13344
13380
|
};
|
|
13345
13381
|
const render$7 = [renderLines, renderSelections, renderCss, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
13346
13382
|
const renderEditor = async id => {
|
|
13347
|
-
const instance = get$
|
|
13383
|
+
const instance = get$8(id);
|
|
13348
13384
|
if (!instance) {
|
|
13349
13385
|
return [];
|
|
13350
13386
|
}
|
|
@@ -13481,7 +13517,7 @@ const unregisterListener = (listenerType, rpcId) => {
|
|
|
13481
13517
|
};
|
|
13482
13518
|
|
|
13483
13519
|
const invoke = async (method, ...params) => {
|
|
13484
|
-
const worker = get$
|
|
13520
|
+
const worker = get$9(DebugWorker);
|
|
13485
13521
|
return worker.invoke(method, ...params);
|
|
13486
13522
|
};
|
|
13487
13523
|
|
|
@@ -13497,7 +13533,7 @@ const getKey = () => {
|
|
|
13497
13533
|
const updateDebugInfo = async debugId => {
|
|
13498
13534
|
const newInfo = await getDebugHighlight(debugId);
|
|
13499
13535
|
const key = getKey();
|
|
13500
|
-
const instance = get$
|
|
13536
|
+
const instance = get$8(key);
|
|
13501
13537
|
if (!instance) {
|
|
13502
13538
|
return;
|
|
13503
13539
|
}
|
|
@@ -13653,7 +13689,7 @@ const updateDiagnostics = async editor => {
|
|
|
13653
13689
|
}
|
|
13654
13690
|
try {
|
|
13655
13691
|
const diagnostics = await getDiagnostics(editor);
|
|
13656
|
-
const latest = get$
|
|
13692
|
+
const latest = get$8(editor.id);
|
|
13657
13693
|
if (!latest) {
|
|
13658
13694
|
return editor;
|
|
13659
13695
|
}
|
|
@@ -13680,7 +13716,7 @@ const queues = {};
|
|
|
13680
13716
|
// TODO only store editor state in editor worker, not in renderer worker also
|
|
13681
13717
|
|
|
13682
13718
|
const wrapCommand = fn => async (uid, ...args) => {
|
|
13683
|
-
const initialInstance = get$
|
|
13719
|
+
const initialInstance = get$8(uid);
|
|
13684
13720
|
const queueKey = initialInstance?.newState.uri || uid;
|
|
13685
13721
|
const previous = queues[queueKey];
|
|
13686
13722
|
const {
|
|
@@ -13692,7 +13728,7 @@ const wrapCommand = fn => async (uid, ...args) => {
|
|
|
13692
13728
|
await previous;
|
|
13693
13729
|
}
|
|
13694
13730
|
try {
|
|
13695
|
-
const oldInstance = get$
|
|
13731
|
+
const oldInstance = get$8(uid);
|
|
13696
13732
|
const state = oldInstance.newState;
|
|
13697
13733
|
const newEditor = await fn(state, ...args);
|
|
13698
13734
|
if (state === newEditor) {
|
|
@@ -13703,7 +13739,7 @@ const wrapCommand = fn => async (uid, ...args) => {
|
|
|
13703
13739
|
let finalEditor = newEditorWithDerivedState;
|
|
13704
13740
|
if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
|
|
13705
13741
|
finalEditor = await editorDiagnosticEffect.apply(newEditorWithDerivedState);
|
|
13706
|
-
if (!get$
|
|
13742
|
+
if (!get$8(uid)) {
|
|
13707
13743
|
return finalEditor;
|
|
13708
13744
|
}
|
|
13709
13745
|
set$9(uid, state, finalEditor);
|
|
@@ -13719,7 +13755,7 @@ const wrapCommand = fn => async (uid, ...args) => {
|
|
|
13719
13755
|
if (!initial && uri === finalEditor.uri && (lines !== finalEditor.lines || modified !== finalEditor.modified || redoStack !== finalEditor.redoStack || undoStack !== finalEditor.undoStack)) {
|
|
13720
13756
|
for (const key of getKeys$2()) {
|
|
13721
13757
|
const otherUid = Number(key);
|
|
13722
|
-
const instance = get$
|
|
13758
|
+
const instance = get$8(otherUid);
|
|
13723
13759
|
const editor = instance?.newState;
|
|
13724
13760
|
if (otherUid === uid || !instance || !editor || editor.initial || editor.uri !== finalEditor.uri) {
|
|
13725
13761
|
continue;
|
|
@@ -14207,7 +14243,7 @@ const renderFull$1 = (oldState, newState) => {
|
|
|
14207
14243
|
return commands;
|
|
14208
14244
|
};
|
|
14209
14245
|
|
|
14210
|
-
const commandsToForward$1 = [SetDom2, SetCss,
|
|
14246
|
+
const commandsToForward$1 = [SetDom2, SetCss, FocusSelector, SetBounds2, RegisterEventListeners, SetUid];
|
|
14211
14247
|
const render$4 = widget => {
|
|
14212
14248
|
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
14213
14249
|
const wrappedCommands = [];
|
|
@@ -14366,7 +14402,7 @@ const EditorCompletionDetailWidget = {
|
|
|
14366
14402
|
render: render$2
|
|
14367
14403
|
};
|
|
14368
14404
|
|
|
14369
|
-
const commandsToForward = [SetDom2, SetCss,
|
|
14405
|
+
const commandsToForward = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
14370
14406
|
const render$1 = widget => {
|
|
14371
14407
|
const {
|
|
14372
14408
|
newState,
|
|
@@ -14390,7 +14426,7 @@ const add$1 = widget => {
|
|
|
14390
14426
|
return addWidget(widget, 'EditorCompletion', render$1);
|
|
14391
14427
|
};
|
|
14392
14428
|
const remove = widget => {
|
|
14393
|
-
return [
|
|
14429
|
+
return [];
|
|
14394
14430
|
};
|
|
14395
14431
|
const {
|
|
14396
14432
|
close
|