@lvce-editor/editor-worker 1.14.0 → 1.16.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 +32 -18
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -274,7 +274,7 @@ const applyEdits = (textDocument, changes) => {
|
|
|
274
274
|
const getLine = (textDocument, index) => {
|
|
275
275
|
return textDocument.lines[index];
|
|
276
276
|
};
|
|
277
|
-
const getText = state => {
|
|
277
|
+
const getText$1 = state => {
|
|
278
278
|
return joinLines$2(state.lines);
|
|
279
279
|
};
|
|
280
280
|
const RE_WHITESPACE = /^\s+/;
|
|
@@ -2771,7 +2771,6 @@ const editorCursorHorizontalRight = (editor, getDelta) => {
|
|
|
2771
2771
|
return scheduleSelections(editor, newSelections);
|
|
2772
2772
|
};
|
|
2773
2773
|
|
|
2774
|
-
// @ts-ignore
|
|
2775
2774
|
const cursorCharacterRight = editor => {
|
|
2776
2775
|
return editorCursorHorizontalRight(editor, characterRight);
|
|
2777
2776
|
};
|
|
@@ -4458,6 +4457,25 @@ const openFind = async state => {
|
|
|
4458
4457
|
return state;
|
|
4459
4458
|
};
|
|
4460
4459
|
|
|
4460
|
+
const getEditor = editorUid => {
|
|
4461
|
+
const instance = get$6(editorUid);
|
|
4462
|
+
if (!instance) {
|
|
4463
|
+
throw new Error(`editor ${editorUid} not found`);
|
|
4464
|
+
}
|
|
4465
|
+
const {
|
|
4466
|
+
newState
|
|
4467
|
+
} = instance;
|
|
4468
|
+
return newState;
|
|
4469
|
+
};
|
|
4470
|
+
|
|
4471
|
+
const getText = editorUid => {
|
|
4472
|
+
const editor = getEditor(editorUid);
|
|
4473
|
+
const {
|
|
4474
|
+
lines
|
|
4475
|
+
} = editor;
|
|
4476
|
+
return lines.join('\n');
|
|
4477
|
+
};
|
|
4478
|
+
|
|
4461
4479
|
const organizeImports = async editor => {
|
|
4462
4480
|
// TODO ask extension host worker directly
|
|
4463
4481
|
const edits = await invoke$3('ExtensionHostOrganizeImports.organizeImports', editor);
|
|
@@ -4614,7 +4632,7 @@ const save = async editor => {
|
|
|
4614
4632
|
try {
|
|
4615
4633
|
const uri = editor.uri;
|
|
4616
4634
|
const newEditor = await getNewEditor(editor);
|
|
4617
|
-
const content = getText(newEditor);
|
|
4635
|
+
const content = getText$1(newEditor);
|
|
4618
4636
|
await invoke$3('FileSystem.writeFile', uri, content);
|
|
4619
4637
|
return newEditor;
|
|
4620
4638
|
} catch (error) {
|
|
@@ -5171,17 +5189,6 @@ const setDecorations = (editor, decorations, diagnostics) => {
|
|
|
5171
5189
|
};
|
|
5172
5190
|
};
|
|
5173
5191
|
|
|
5174
|
-
const getEditor = editorUid => {
|
|
5175
|
-
const instance = get$6(editorUid);
|
|
5176
|
-
if (!instance) {
|
|
5177
|
-
throw new Error(`editor ${editorUid} not found`);
|
|
5178
|
-
}
|
|
5179
|
-
const {
|
|
5180
|
-
newState
|
|
5181
|
-
} = instance;
|
|
5182
|
-
return newState;
|
|
5183
|
-
};
|
|
5184
|
-
|
|
5185
5192
|
/**
|
|
5186
5193
|
* @enum number
|
|
5187
5194
|
*/
|
|
@@ -6864,6 +6871,14 @@ const ensure = async (fontName, fontUrl) => {
|
|
|
6864
6871
|
setLoaded(fontName);
|
|
6865
6872
|
};
|
|
6866
6873
|
|
|
6874
|
+
const getSelections = editorUid => {
|
|
6875
|
+
const editor = getEditor(editorUid);
|
|
6876
|
+
const {
|
|
6877
|
+
selections
|
|
6878
|
+
} = editor;
|
|
6879
|
+
return selections;
|
|
6880
|
+
};
|
|
6881
|
+
|
|
6867
6882
|
const executeHoverProvider = (editor, offset) => {
|
|
6868
6883
|
object(editor);
|
|
6869
6884
|
number$1(offset);
|
|
@@ -7914,7 +7929,7 @@ const renderEditor = async id => {
|
|
|
7914
7929
|
return commands;
|
|
7915
7930
|
};
|
|
7916
7931
|
|
|
7917
|
-
const keep = ['ColorPicker.handleSliderPointerDown', 'ColorPicker.handleSliderPointerMove', 'ColorPicker.loadContent', 'Editor.create', 'Editor.getWordAt', 'Editor.getWordBefore', 'Editor.offsetAt', 'Editor.render', '
|
|
7932
|
+
const keep = ['ColorPicker.handleSliderPointerDown', 'ColorPicker.handleSliderPointerMove', 'ColorPicker.loadContent', 'Editor.create', 'Editor.getWordAt', 'Editor.getWordBefore', 'Editor.offsetAt', 'Editor.render', 'ColorPicker.render', 'Editor.getText', 'Editor.getSelections', 'EditorCompletion.advance', 'EditorCompletion.handleEditorBlur', 'EditorCompletion.handleEditorClick', 'EditorCompletion.handleEditorDeleteLeft', 'EditorCompletion.handleEditorType', 'EditorCompletion.loadContent', 'EditorCompletion.selectCurrent', 'EditorCompletion.selectIndex', 'FindWidget.focusFirst', 'FindWidget.focusIndex', 'FindWidget.focusLast', 'FindWidget.focusNext', 'FindWidget.focusPrevious', 'FindWidget.handleInput', 'FindWidget.loadContent', 'Font.ensure', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize'];
|
|
7918
7933
|
|
|
7919
7934
|
// TODO wrap commands globally, not per editor
|
|
7920
7935
|
// TODO only store editor state in editor worker, not in renderer worker also
|
|
@@ -8132,9 +8147,6 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
|
|
|
8132
8147
|
childCount: 0,
|
|
8133
8148
|
onPointerDown: HandleSashPointerDown
|
|
8134
8149
|
});
|
|
8135
|
-
console.log({
|
|
8136
|
-
dom
|
|
8137
|
-
});
|
|
8138
8150
|
return dom;
|
|
8139
8151
|
};
|
|
8140
8152
|
|
|
@@ -8223,6 +8235,7 @@ const commandMap = {
|
|
|
8223
8235
|
'Editor.findAllReferences': findAllReferences,
|
|
8224
8236
|
'Editor.format': format,
|
|
8225
8237
|
'Editor.getWordAt': getWordAt,
|
|
8238
|
+
'Editor.getText': getText,
|
|
8226
8239
|
'Editor.getWordBefore': getWordBefore,
|
|
8227
8240
|
'Editor.goToDefinition': goToDefinition,
|
|
8228
8241
|
'Editor.goToTypeDefinition': goToTypeDefinition,
|
|
@@ -8299,6 +8312,7 @@ const commandMap = {
|
|
|
8299
8312
|
'Editor.typeWithAutoClosing': typeWithAutoClosing,
|
|
8300
8313
|
'Editor.undo': undo,
|
|
8301
8314
|
'Editor.unIndent': editorUnindent,
|
|
8315
|
+
'Editor.getSelections': getSelections,
|
|
8302
8316
|
'EditorCompletion.advance': advance,
|
|
8303
8317
|
'EditorCompletion.handleEditorBlur': handleEditorBlur,
|
|
8304
8318
|
'EditorCompletion.handleEditorClick': handleEditorClick,
|