@lvce-editor/editor-worker 19.28.3 → 19.29.1
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 -126
- 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
|
|
@@ -7757,21 +7787,21 @@ const loadHoverContent = async (state, position) => {
|
|
|
7757
7787
|
};
|
|
7758
7788
|
};
|
|
7759
7789
|
|
|
7760
|
-
const
|
|
7790
|
+
const showHover$1 = async (editor, position) => {
|
|
7761
7791
|
const newStateGenerator = async state => {
|
|
7762
7792
|
return loadHoverContent(state, position);
|
|
7763
7793
|
};
|
|
7764
7794
|
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$5, newStateGenerator);
|
|
7765
7795
|
};
|
|
7766
7796
|
|
|
7767
|
-
const showHover
|
|
7768
|
-
const instance = get$
|
|
7797
|
+
const showHover = async (editor, position, token) => {
|
|
7798
|
+
const instance = get$8(editor.uid);
|
|
7769
7799
|
if (!instance) {
|
|
7770
7800
|
return;
|
|
7771
7801
|
}
|
|
7772
7802
|
const latestEditor = instance.newState;
|
|
7773
|
-
const newEditor = await
|
|
7774
|
-
const latestInstance = get$
|
|
7803
|
+
const newEditor = await showHover$1(latestEditor, position);
|
|
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
|
}
|
|
@@ -7799,7 +7829,7 @@ const onHoverIdle = async token => {
|
|
|
7799
7829
|
return;
|
|
7800
7830
|
}
|
|
7801
7831
|
const position = await at(editor, x, y);
|
|
7802
|
-
await showHover
|
|
7832
|
+
await showHover(editor, position, token);
|
|
7803
7833
|
} catch {
|
|
7804
7834
|
// Hover providers are optional and should not surface errors from an idle mouse event.
|
|
7805
7835
|
}
|
|
@@ -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,18 +8871,19 @@ const createFn = (key, name, widgetId) => {
|
|
|
8844
8871
|
} = state;
|
|
8845
8872
|
const invoke = getWidgetInvoke(widgetId);
|
|
8846
8873
|
await invoke(`${name}.${key}`, uid, ...args);
|
|
8847
|
-
const latestAfterInvoke = get$
|
|
8874
|
+
const latestAfterInvoke = get$8(editor.uid).newState;
|
|
8848
8875
|
const latestChildIndex = latestAfterInvoke.widgets.findIndex(isWidget);
|
|
8849
8876
|
if (latestChildIndex === -1) {
|
|
8850
8877
|
return latestAfterInvoke;
|
|
8851
8878
|
}
|
|
8852
8879
|
const diff = await invoke(`${name}.diff2`, uid);
|
|
8853
8880
|
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
8854
|
-
const latest = get$
|
|
8855
|
-
if (
|
|
8881
|
+
const latest = get$8(editor.uid).newState;
|
|
8882
|
+
if (shouldClose) {
|
|
8856
8883
|
const newEditor = {
|
|
8857
8884
|
...latest,
|
|
8858
8885
|
focused: true,
|
|
8886
|
+
widgetRevision,
|
|
8859
8887
|
widgets: removeEditorWidget(latest.widgets, widgetId)
|
|
8860
8888
|
};
|
|
8861
8889
|
set$9(editor.uid, latest, newEditor);
|
|
@@ -8886,7 +8914,6 @@ const renderFull$4 = (oldState, newState) => {
|
|
|
8886
8914
|
return commands;
|
|
8887
8915
|
};
|
|
8888
8916
|
|
|
8889
|
-
const AppendToBody = 'Viewlet.appendToBody';
|
|
8890
8917
|
const Focus = 'focus';
|
|
8891
8918
|
const FocusSelector = 'Viewlet.focusSelector';
|
|
8892
8919
|
const RegisterEventListeners = 'Viewlet.registerEventListeners';
|
|
@@ -8899,7 +8926,7 @@ const SetCss = 'Viewlet.setCss';
|
|
|
8899
8926
|
const SetDom2 = 'Viewlet.setDom2';
|
|
8900
8927
|
const SetUid = 'Viewlet.setUid';
|
|
8901
8928
|
|
|
8902
|
-
const commandsToForward$5 = [SetDom2, SetCss,
|
|
8929
|
+
const commandsToForward$5 = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
8903
8930
|
const render$c = widget => {
|
|
8904
8931
|
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
8905
8932
|
const wrappedCommands = [];
|
|
@@ -8919,7 +8946,7 @@ const add$8 = widget => {
|
|
|
8919
8946
|
return addWidget(widget, 'FindWidget', render$c);
|
|
8920
8947
|
};
|
|
8921
8948
|
const remove$7 = widget => {
|
|
8922
|
-
return [
|
|
8949
|
+
return [];
|
|
8923
8950
|
};
|
|
8924
8951
|
const focusFindInput = editor => {
|
|
8925
8952
|
const widget = editor.widgets.find(widget => widget.id === Find);
|
|
@@ -9027,7 +9054,7 @@ const create$2 = () => {
|
|
|
9027
9054
|
};
|
|
9028
9055
|
|
|
9029
9056
|
const getEditor = editorUid => {
|
|
9030
|
-
const instance = get$
|
|
9057
|
+
const instance = get$8(editorUid);
|
|
9031
9058
|
if (!instance) {
|
|
9032
9059
|
throw new Error(`editor ${editorUid} not found`);
|
|
9033
9060
|
}
|
|
@@ -9135,7 +9162,7 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
9135
9162
|
} = state;
|
|
9136
9163
|
const {
|
|
9137
9164
|
newState
|
|
9138
|
-
} = get$
|
|
9165
|
+
} = get$8(parentUid);
|
|
9139
9166
|
const {
|
|
9140
9167
|
languageId
|
|
9141
9168
|
} = newState;
|
|
@@ -9766,12 +9793,6 @@ const setText = (editor, text) => {
|
|
|
9766
9793
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
9767
9794
|
};
|
|
9768
9795
|
|
|
9769
|
-
const EditorHover = 'EditorHover';
|
|
9770
|
-
const showHover = async state => {
|
|
9771
|
-
await invoke$b('Viewlet.openWidget', EditorHover);
|
|
9772
|
-
return state;
|
|
9773
|
-
};
|
|
9774
|
-
|
|
9775
9796
|
const clampIndex = (index, length) => {
|
|
9776
9797
|
return Math.max(0, Math.min(index, length - 1));
|
|
9777
9798
|
};
|
|
@@ -9853,7 +9874,7 @@ const getSignatureHelp = async (editor, offset) => {
|
|
|
9853
9874
|
|
|
9854
9875
|
const getSignatureHelpInfo = async editorUid => {
|
|
9855
9876
|
number(editorUid);
|
|
9856
|
-
const instance = get$
|
|
9877
|
+
const instance = get$8(editorUid);
|
|
9857
9878
|
const editor = instance.newState;
|
|
9858
9879
|
const {
|
|
9859
9880
|
selections
|
|
@@ -9965,7 +9986,7 @@ const newStateGenerator = async (state, parentUid) => {
|
|
|
9965
9986
|
} = state;
|
|
9966
9987
|
const {
|
|
9967
9988
|
newState
|
|
9968
|
-
} = get$
|
|
9989
|
+
} = get$8(parentUid);
|
|
9969
9990
|
const {
|
|
9970
9991
|
languageId
|
|
9971
9992
|
} = newState;
|
|
@@ -10787,7 +10808,7 @@ const renderFull$3 = (oldState, newState) => {
|
|
|
10787
10808
|
return commands;
|
|
10788
10809
|
};
|
|
10789
10810
|
|
|
10790
|
-
const commandsToForward$4 = [SetDom2, SetCss,
|
|
10811
|
+
const commandsToForward$4 = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
10791
10812
|
const render$b = widget => {
|
|
10792
10813
|
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
10793
10814
|
const wrappedCommands = [];
|
|
@@ -10807,7 +10828,7 @@ const add$7 = widget => {
|
|
|
10807
10828
|
return addWidget(widget, 'EditorCompletion', render$b);
|
|
10808
10829
|
};
|
|
10809
10830
|
const remove$6 = widget => {
|
|
10810
|
-
return [
|
|
10831
|
+
return [];
|
|
10811
10832
|
};
|
|
10812
10833
|
const {
|
|
10813
10834
|
close: close$3,
|
|
@@ -11069,7 +11090,7 @@ const renderHover = (oldState, newState) => {
|
|
|
11069
11090
|
return commands;
|
|
11070
11091
|
};
|
|
11071
11092
|
|
|
11072
|
-
const commandsToForward$3 = [SetDom2, SetCss,
|
|
11093
|
+
const commandsToForward$3 = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
11073
11094
|
const render$9 = widget => {
|
|
11074
11095
|
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
11075
11096
|
const wrappedCommands = [];
|
|
@@ -11089,7 +11110,7 @@ const add$6 = widget => {
|
|
|
11089
11110
|
return addWidget(widget, 'EditorRename', render$9);
|
|
11090
11111
|
};
|
|
11091
11112
|
const remove$5 = widget => {
|
|
11092
|
-
return [
|
|
11113
|
+
return [];
|
|
11093
11114
|
};
|
|
11094
11115
|
const {
|
|
11095
11116
|
accept,
|
|
@@ -11126,11 +11147,10 @@ const focusNext$1 = state => {
|
|
|
11126
11147
|
};
|
|
11127
11148
|
|
|
11128
11149
|
const removeWidget = widget => {
|
|
11129
|
-
|
|
11130
|
-
return [['Viewlet.dispose', widget.newState.uid]];
|
|
11150
|
+
return [];
|
|
11131
11151
|
};
|
|
11132
11152
|
|
|
11133
|
-
const commandsToForward$2 = [SetDom2, SetCss,
|
|
11153
|
+
const commandsToForward$2 = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
11134
11154
|
const render$8 = widget => {
|
|
11135
11155
|
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
11136
11156
|
const wrappedCommands = [];
|
|
@@ -11225,7 +11245,7 @@ const getEditorSourceActions = async editorId => {
|
|
|
11225
11245
|
}
|
|
11226
11246
|
const {
|
|
11227
11247
|
newState
|
|
11228
|
-
} = get$
|
|
11248
|
+
} = get$8(editorId);
|
|
11229
11249
|
const offset = getOffsetAtCursor$1(newState);
|
|
11230
11250
|
return execute({
|
|
11231
11251
|
args: [offset],
|
|
@@ -11338,6 +11358,7 @@ const setSelections2 = async (editorUid, selections) => {
|
|
|
11338
11358
|
};
|
|
11339
11359
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
11340
11360
|
const editor = getEditor(editorUid);
|
|
11361
|
+
const widgetRevision = next(editorUid);
|
|
11341
11362
|
const invoke = getWidgetInvoke(widgetId);
|
|
11342
11363
|
const {
|
|
11343
11364
|
widgets
|
|
@@ -11352,6 +11373,7 @@ const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocu
|
|
|
11352
11373
|
...editor,
|
|
11353
11374
|
decorations: widgetId === Rename$1 ? editor.decorations.slice(0, -4) : editor.decorations,
|
|
11354
11375
|
focused: true,
|
|
11376
|
+
widgetRevision,
|
|
11355
11377
|
widgets: newWidgets
|
|
11356
11378
|
};
|
|
11357
11379
|
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
@@ -11740,7 +11762,7 @@ const getKeyBindings = () => {
|
|
|
11740
11762
|
key: CtrlCmd | KeyA,
|
|
11741
11763
|
when: FocusEditorText
|
|
11742
11764
|
}, {
|
|
11743
|
-
command: 'Editor.
|
|
11765
|
+
command: 'Editor.showHover',
|
|
11744
11766
|
key: CtrlCmd | KeyH,
|
|
11745
11767
|
when: FocusEditorText
|
|
11746
11768
|
}, {
|
|
@@ -11874,7 +11896,7 @@ const getProblems = async () => {
|
|
|
11874
11896
|
const keys = getKeys$2();
|
|
11875
11897
|
const diagnostics = keys.flatMap(key => {
|
|
11876
11898
|
const numericKey = Number(key);
|
|
11877
|
-
const editor = get$
|
|
11899
|
+
const editor = get$8(numericKey);
|
|
11878
11900
|
if (!editor?.newState) {
|
|
11879
11901
|
return [];
|
|
11880
11902
|
}
|
|
@@ -12018,49 +12040,49 @@ const kAutoClosingBrackets = 'editor.autoclosingBrackets';
|
|
|
12018
12040
|
const kFontWeight = 'editor.fontWeight';
|
|
12019
12041
|
const kHover = 'editor.hover';
|
|
12020
12042
|
const isAutoClosingBracketsEnabled = async () => {
|
|
12021
|
-
return Boolean(await get$
|
|
12043
|
+
return Boolean(await get$3(kAutoClosingBrackets));
|
|
12022
12044
|
};
|
|
12023
12045
|
const isAutoClosingQuotesEnabled = async () => {
|
|
12024
|
-
return Boolean(await get$
|
|
12046
|
+
return Boolean(await get$3(kAutoClosingQuotes));
|
|
12025
12047
|
};
|
|
12026
12048
|
const isQuickSuggestionsEnabled = async () => {
|
|
12027
|
-
return Boolean(await get$
|
|
12049
|
+
return Boolean(await get$3(kQuickSuggestions));
|
|
12028
12050
|
};
|
|
12029
12051
|
const isAutoClosingTagsEnabled = async () => {
|
|
12030
12052
|
return true;
|
|
12031
12053
|
};
|
|
12032
12054
|
const getRowHeight = async () => {
|
|
12033
|
-
return (await get$
|
|
12055
|
+
return (await get$3(kLineHeight)) || 20;
|
|
12034
12056
|
};
|
|
12035
12057
|
const getFontSize = async () => {
|
|
12036
|
-
return (await get$
|
|
12058
|
+
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
|
|
12037
12059
|
};
|
|
12038
12060
|
const getHoverEnabled = async () => {
|
|
12039
|
-
return (await get$
|
|
12061
|
+
return (await get$3(kHover)) ?? true;
|
|
12040
12062
|
};
|
|
12041
12063
|
const getFontFamily = async () => {
|
|
12042
|
-
return (await get$
|
|
12064
|
+
return (await get$3(kFontFamily)) || 'Fira Code';
|
|
12043
12065
|
};
|
|
12044
12066
|
const getLetterSpacing = async () => {
|
|
12045
12067
|
// if (!false) {
|
|
12046
12068
|
// return 0
|
|
12047
12069
|
// }
|
|
12048
|
-
return (await get$
|
|
12070
|
+
return (await get$3(kLetterSpacing)) ?? 0.5;
|
|
12049
12071
|
};
|
|
12050
12072
|
const getTabSize = async () => {
|
|
12051
|
-
return (await get$
|
|
12073
|
+
return (await get$3(kTabSize)) || 2;
|
|
12052
12074
|
};
|
|
12053
12075
|
const getLineNumbers = async () => {
|
|
12054
|
-
return (await get$
|
|
12076
|
+
return (await get$3(kLineNumbers)) ?? false;
|
|
12055
12077
|
};
|
|
12056
12078
|
const getCompletionTriggerCharacters = async () => {
|
|
12057
12079
|
return ['.', '/'];
|
|
12058
12080
|
};
|
|
12059
12081
|
const diagnosticsEnabled = async () => {
|
|
12060
|
-
return (await get$
|
|
12082
|
+
return (await get$3(kDiagnostics)) ?? false;
|
|
12061
12083
|
};
|
|
12062
12084
|
const getFontWeight = async () => {
|
|
12063
|
-
return (await get$
|
|
12085
|
+
return (await get$3(kFontWeight)) ?? 400;
|
|
12064
12086
|
};
|
|
12065
12087
|
|
|
12066
12088
|
const getEditorPreferences = async () => {
|
|
@@ -12093,7 +12115,7 @@ const handleSettingsChanged = async state => {
|
|
|
12093
12115
|
letterSpacing,
|
|
12094
12116
|
rowHeight
|
|
12095
12117
|
} = editorPreferences;
|
|
12096
|
-
const [charWidth, completionsOnTypeRaw] = await Promise.all([measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing), get$
|
|
12118
|
+
const [charWidth, completionsOnTypeRaw] = await Promise.all([measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing), get$3('editor.completionsOnType')]);
|
|
12097
12119
|
const isMonospaceFont = fontFamily === 'Fira Code' || fontFamily === "'Fira Code'";
|
|
12098
12120
|
const editorWithUpdatedSettings = {
|
|
12099
12121
|
...state,
|
|
@@ -12173,7 +12195,7 @@ const restoreWidgetState = async (keys, savedStates) => {
|
|
|
12173
12195
|
const newEditors = [];
|
|
12174
12196
|
for (const key of keys) {
|
|
12175
12197
|
const editorUid = parseInt(key);
|
|
12176
|
-
const editor = get$
|
|
12198
|
+
const editor = get$8(editorUid);
|
|
12177
12199
|
if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
|
|
12178
12200
|
continue;
|
|
12179
12201
|
}
|
|
@@ -12226,7 +12248,7 @@ const saveSingleWidgetState = async (savedStates, key, widget) => {
|
|
|
12226
12248
|
const saveWidgetState = async keys => {
|
|
12227
12249
|
const savedStates = Object.create(null);
|
|
12228
12250
|
for (const key of keys) {
|
|
12229
|
-
const editor = get$
|
|
12251
|
+
const editor = get$8(parseInt(key));
|
|
12230
12252
|
if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
|
|
12231
12253
|
continue;
|
|
12232
12254
|
}
|
|
@@ -12387,7 +12409,7 @@ const loadContent = async (state, savedState) => {
|
|
|
12387
12409
|
};
|
|
12388
12410
|
let existingEditor;
|
|
12389
12411
|
for (const key of getKeys$2()) {
|
|
12390
|
-
const editor = get$
|
|
12412
|
+
const editor = get$8(Number(key))?.newState;
|
|
12391
12413
|
if (editor && editor.id !== id && !editor.initial && editor.uri === uri) {
|
|
12392
12414
|
existingEditor = editor;
|
|
12393
12415
|
break;
|
|
@@ -12439,7 +12461,7 @@ const loadContent = async (state, savedState) => {
|
|
|
12439
12461
|
// e.g. it might not always be necessary to send text to extension host worker
|
|
12440
12462
|
// @ts-ignore
|
|
12441
12463
|
await invoke$6(TextDocumentSyncFull, uri, id, computedLanguageId, content);
|
|
12442
|
-
const completionsOnTypeRaw = await get$
|
|
12464
|
+
const completionsOnTypeRaw = await get$3('editor.completionsOnType');
|
|
12443
12465
|
const completionsOnType = Boolean(completionsOnTypeRaw);
|
|
12444
12466
|
const newEditor5 = {
|
|
12445
12467
|
...newEditor4,
|
|
@@ -13263,7 +13285,7 @@ const render2 = (uid, diffResult) => {
|
|
|
13263
13285
|
const {
|
|
13264
13286
|
newState,
|
|
13265
13287
|
oldState
|
|
13266
|
-
} = get$
|
|
13288
|
+
} = get$8(uid);
|
|
13267
13289
|
set$9(uid, newState, newState);
|
|
13268
13290
|
const commands = applyRender(oldState, newState, diffResult);
|
|
13269
13291
|
return commands;
|
|
@@ -13347,12 +13369,12 @@ const renderGutterInfo = {
|
|
|
13347
13369
|
};
|
|
13348
13370
|
const renderWidgets = {
|
|
13349
13371
|
apply: renderWidgets$1,
|
|
13350
|
-
isEqual: (oldState, newState) => oldState.widgets === newState.widgets,
|
|
13372
|
+
isEqual: (oldState, newState) => oldState.widgets === newState.widgets && oldState.widgetRevision === newState.widgetRevision,
|
|
13351
13373
|
multiple: true
|
|
13352
13374
|
};
|
|
13353
13375
|
const render$7 = [renderLines, renderSelections, renderCss, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
13354
13376
|
const renderEditor = async id => {
|
|
13355
|
-
const instance = get$
|
|
13377
|
+
const instance = get$8(id);
|
|
13356
13378
|
if (!instance) {
|
|
13357
13379
|
return [];
|
|
13358
13380
|
}
|
|
@@ -13489,7 +13511,7 @@ const unregisterListener = (listenerType, rpcId) => {
|
|
|
13489
13511
|
};
|
|
13490
13512
|
|
|
13491
13513
|
const invoke = async (method, ...params) => {
|
|
13492
|
-
const worker = get$
|
|
13514
|
+
const worker = get$9(DebugWorker);
|
|
13493
13515
|
return worker.invoke(method, ...params);
|
|
13494
13516
|
};
|
|
13495
13517
|
|
|
@@ -13505,7 +13527,7 @@ const getKey = () => {
|
|
|
13505
13527
|
const updateDebugInfo = async debugId => {
|
|
13506
13528
|
const newInfo = await getDebugHighlight(debugId);
|
|
13507
13529
|
const key = getKey();
|
|
13508
|
-
const instance = get$
|
|
13530
|
+
const instance = get$8(key);
|
|
13509
13531
|
if (!instance) {
|
|
13510
13532
|
return;
|
|
13511
13533
|
}
|
|
@@ -13661,7 +13683,7 @@ const updateDiagnostics = async editor => {
|
|
|
13661
13683
|
}
|
|
13662
13684
|
try {
|
|
13663
13685
|
const diagnostics = await getDiagnostics(editor);
|
|
13664
|
-
const latest = get$
|
|
13686
|
+
const latest = get$8(editor.id);
|
|
13665
13687
|
if (!latest) {
|
|
13666
13688
|
return editor;
|
|
13667
13689
|
}
|
|
@@ -13688,7 +13710,7 @@ const queues = {};
|
|
|
13688
13710
|
// TODO only store editor state in editor worker, not in renderer worker also
|
|
13689
13711
|
|
|
13690
13712
|
const wrapCommand = fn => async (uid, ...args) => {
|
|
13691
|
-
const initialInstance = get$
|
|
13713
|
+
const initialInstance = get$8(uid);
|
|
13692
13714
|
const queueKey = initialInstance?.newState.uri || uid;
|
|
13693
13715
|
const previous = queues[queueKey];
|
|
13694
13716
|
const {
|
|
@@ -13700,7 +13722,7 @@ const wrapCommand = fn => async (uid, ...args) => {
|
|
|
13700
13722
|
await previous;
|
|
13701
13723
|
}
|
|
13702
13724
|
try {
|
|
13703
|
-
const oldInstance = get$
|
|
13725
|
+
const oldInstance = get$8(uid);
|
|
13704
13726
|
const state = oldInstance.newState;
|
|
13705
13727
|
const newEditor = await fn(state, ...args);
|
|
13706
13728
|
if (state === newEditor) {
|
|
@@ -13711,7 +13733,7 @@ const wrapCommand = fn => async (uid, ...args) => {
|
|
|
13711
13733
|
let finalEditor = newEditorWithDerivedState;
|
|
13712
13734
|
if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
|
|
13713
13735
|
finalEditor = await editorDiagnosticEffect.apply(newEditorWithDerivedState);
|
|
13714
|
-
if (!get$
|
|
13736
|
+
if (!get$8(uid)) {
|
|
13715
13737
|
return finalEditor;
|
|
13716
13738
|
}
|
|
13717
13739
|
set$9(uid, state, finalEditor);
|
|
@@ -13727,7 +13749,7 @@ const wrapCommand = fn => async (uid, ...args) => {
|
|
|
13727
13749
|
if (!initial && uri === finalEditor.uri && (lines !== finalEditor.lines || modified !== finalEditor.modified || redoStack !== finalEditor.redoStack || undoStack !== finalEditor.undoStack)) {
|
|
13728
13750
|
for (const key of getKeys$2()) {
|
|
13729
13751
|
const otherUid = Number(key);
|
|
13730
|
-
const instance = get$
|
|
13752
|
+
const instance = get$8(otherUid);
|
|
13731
13753
|
const editor = instance?.newState;
|
|
13732
13754
|
if (otherUid === uid || !instance || !editor || editor.initial || editor.uri !== finalEditor.uri) {
|
|
13733
13755
|
continue;
|
|
@@ -13935,8 +13957,8 @@ const commandMap = {
|
|
|
13935
13957
|
'Editor.setSelections': wrapCommand(setSelections),
|
|
13936
13958
|
'Editor.setSelections2': setSelections2,
|
|
13937
13959
|
'Editor.setText': wrapCommand(setText),
|
|
13938
|
-
'Editor.showHover': showHover,
|
|
13939
|
-
'Editor.showHover2': wrapCommand(
|
|
13960
|
+
'Editor.showHover': wrapCommand(showHover$1),
|
|
13961
|
+
'Editor.showHover2': wrapCommand(showHover$1),
|
|
13940
13962
|
'Editor.showSignatureHelp': wrapCommand(showSignatureHelp),
|
|
13941
13963
|
'Editor.showSourceActions': wrapCommand(showSourceActions),
|
|
13942
13964
|
'Editor.showSourceActions2': wrapCommand(showSourceActions),
|
|
@@ -14215,7 +14237,7 @@ const renderFull$1 = (oldState, newState) => {
|
|
|
14215
14237
|
return commands;
|
|
14216
14238
|
};
|
|
14217
14239
|
|
|
14218
|
-
const commandsToForward$1 = [SetDom2, SetCss,
|
|
14240
|
+
const commandsToForward$1 = [SetDom2, SetCss, FocusSelector, SetBounds2, RegisterEventListeners, SetUid];
|
|
14219
14241
|
const render$4 = widget => {
|
|
14220
14242
|
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
14221
14243
|
const wrappedCommands = [];
|
|
@@ -14374,7 +14396,7 @@ const EditorCompletionDetailWidget = {
|
|
|
14374
14396
|
render: render$2
|
|
14375
14397
|
};
|
|
14376
14398
|
|
|
14377
|
-
const commandsToForward = [SetDom2, SetCss,
|
|
14399
|
+
const commandsToForward = [SetDom2, SetCss, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
14378
14400
|
const render$1 = widget => {
|
|
14379
14401
|
const {
|
|
14380
14402
|
newState,
|
|
@@ -14398,7 +14420,7 @@ const add$1 = widget => {
|
|
|
14398
14420
|
return addWidget(widget, 'EditorCompletion', render$1);
|
|
14399
14421
|
};
|
|
14400
14422
|
const remove = widget => {
|
|
14401
|
-
return [
|
|
14423
|
+
return [];
|
|
14402
14424
|
};
|
|
14403
14425
|
const {
|
|
14404
14426
|
close
|