@lvce-editor/editor-worker 5.4.0 → 5.5.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 +31 -30
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -147,9 +147,10 @@ const Format = 'format';
|
|
|
147
147
|
const IndentLess = 'indentLess';
|
|
148
148
|
const IndentMore = 'indentMore';
|
|
149
149
|
const InsertLineBreak = 'insertLineBreak';
|
|
150
|
+
const LineComment = 'lineComment';
|
|
151
|
+
const Rename$1 = 'rename';
|
|
150
152
|
const ReplaceAll$2 = 'replaceAll';
|
|
151
153
|
const ToggleBlockComment = 'toggleBlockComment';
|
|
152
|
-
const Rename$1 = 'rename';
|
|
153
154
|
|
|
154
155
|
const map$1 = Object.create(null);
|
|
155
156
|
const set$7 = (id, widget) => {
|
|
@@ -1852,6 +1853,9 @@ const updateDiagnostics = async newState => {
|
|
|
1852
1853
|
// TODO sync and ask for diagnostics at the same time?
|
|
1853
1854
|
// TODO throttle diagnostics
|
|
1854
1855
|
const content = getText$1(newState);
|
|
1856
|
+
|
|
1857
|
+
// TODO don't really need text document sync response
|
|
1858
|
+
// could perhaps save a lot of messages by using send instead of invoke
|
|
1855
1859
|
await invoke$2(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
|
|
1856
1860
|
const diagnostics = await executeDiagnosticProvider(newState);
|
|
1857
1861
|
const latest = get$6(newState.id);
|
|
@@ -7168,14 +7172,11 @@ const getBlockComment = async editor => {
|
|
|
7168
7172
|
|
|
7169
7173
|
const RE_WHITESPACE_AT_START$1 = /^\s+/;
|
|
7170
7174
|
const RE_WHITESPACE_AT_END = /\s+$/;
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
return editor;
|
|
7177
|
-
}
|
|
7178
|
-
const rowIndex = editor.selections[0];
|
|
7175
|
+
const getBlockCommentEdits = (editor, blockComment) => {
|
|
7176
|
+
const {
|
|
7177
|
+
selections
|
|
7178
|
+
} = editor;
|
|
7179
|
+
const [rowIndex] = selections;
|
|
7179
7180
|
const line = getLine(editor, rowIndex);
|
|
7180
7181
|
const numberOfLines = editor.lines.length;
|
|
7181
7182
|
let endRowIndex = rowIndex;
|
|
@@ -7229,18 +7230,7 @@ const toggleBlockComment = async editor => {
|
|
|
7229
7230
|
deleted: [blockCommentEnd],
|
|
7230
7231
|
origin: ToggleBlockComment
|
|
7231
7232
|
};
|
|
7232
|
-
// @ts-ignore
|
|
7233
7233
|
changes.push(change1, change2);
|
|
7234
|
-
// Editor.moveCursors(editor, (editor, cursor) => {
|
|
7235
|
-
// let newColumnIndex = cursor.columnIndex - blockComment[0].length
|
|
7236
|
-
// if (cursor.columnIndex === endColumnIndex + blockComment[1].length) {
|
|
7237
|
-
// newColumnIndex -= blockComment[1].length
|
|
7238
|
-
// }
|
|
7239
|
-
// return {
|
|
7240
|
-
// rowIndex: cursor.rowIndex,
|
|
7241
|
-
// columnIndex: newColumnIndex,
|
|
7242
|
-
// }
|
|
7243
|
-
// })
|
|
7244
7234
|
} else {
|
|
7245
7235
|
const change1 = {
|
|
7246
7236
|
start: {
|
|
@@ -7363,7 +7353,16 @@ const toggleBlockComment = async editor => {
|
|
|
7363
7353
|
// }
|
|
7364
7354
|
// RendererProcess.invoke(/* setLines */ 2135, /* lines */ lines)
|
|
7365
7355
|
|
|
7366
|
-
return
|
|
7356
|
+
return changes;
|
|
7357
|
+
};
|
|
7358
|
+
|
|
7359
|
+
const toggleBlockComment = async editor => {
|
|
7360
|
+
const blockComment = await getBlockComment(editor);
|
|
7361
|
+
if (!blockComment) {
|
|
7362
|
+
return editor;
|
|
7363
|
+
}
|
|
7364
|
+
const edits = getBlockCommentEdits(editor, blockComment);
|
|
7365
|
+
return scheduleDocument(editor, edits);
|
|
7367
7366
|
};
|
|
7368
7367
|
|
|
7369
7368
|
const getLineComment = async editor => {
|
|
@@ -7383,7 +7382,7 @@ const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
|
7383
7382
|
if (line[index + lineComment.length] === ' ') {
|
|
7384
7383
|
return {
|
|
7385
7384
|
inserted: [''],
|
|
7386
|
-
deleted: [lineComment
|
|
7385
|
+
deleted: [lineComment + ' '],
|
|
7387
7386
|
start: {
|
|
7388
7387
|
rowIndex,
|
|
7389
7388
|
columnIndex: index
|
|
@@ -7392,7 +7391,7 @@ const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
|
7392
7391
|
rowIndex,
|
|
7393
7392
|
columnIndex: index + lineComment.length + 1
|
|
7394
7393
|
},
|
|
7395
|
-
|
|
7394
|
+
origin: LineComment
|
|
7396
7395
|
};
|
|
7397
7396
|
}
|
|
7398
7397
|
return {
|
|
@@ -7406,7 +7405,7 @@ const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
|
7406
7405
|
rowIndex,
|
|
7407
7406
|
columnIndex: index + lineComment.length
|
|
7408
7407
|
},
|
|
7409
|
-
|
|
7408
|
+
origin: LineComment
|
|
7410
7409
|
};
|
|
7411
7410
|
}
|
|
7412
7411
|
return {
|
|
@@ -7420,11 +7419,10 @@ const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
|
7420
7419
|
rowIndex,
|
|
7421
7420
|
columnIndex: index
|
|
7422
7421
|
},
|
|
7423
|
-
|
|
7422
|
+
origin: LineComment
|
|
7424
7423
|
};
|
|
7425
7424
|
};
|
|
7426
7425
|
|
|
7427
|
-
// @ts-ignore
|
|
7428
7426
|
const editorToggleLineComment = async editor => {
|
|
7429
7427
|
const lineComment = await getLineComment(editor);
|
|
7430
7428
|
if (!lineComment) {
|
|
@@ -8020,7 +8018,7 @@ const handleSashPointerUp = (state, eventX, eventY) => {
|
|
|
8020
8018
|
return state;
|
|
8021
8019
|
};
|
|
8022
8020
|
|
|
8023
|
-
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
8021
|
+
const CodeGeneratorInput$1 = 'CodeGeneratorInput';
|
|
8024
8022
|
const CodeGeneratorMessage = 'CodeGeneratorMessage';
|
|
8025
8023
|
const CodeGeneratorWidget = 'CodeGeneratorWidget';
|
|
8026
8024
|
const ColoredMaskIcon = 'ColoredMaskIcon';
|
|
@@ -10166,6 +10164,9 @@ const removeWidget = widget => {
|
|
|
10166
10164
|
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
10167
10165
|
};
|
|
10168
10166
|
|
|
10167
|
+
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
10168
|
+
const ToggleReplace$1 = 'ToggleReplace';
|
|
10169
|
+
|
|
10169
10170
|
const getCodeGeneratorVirtualDom = state => {
|
|
10170
10171
|
const escapeToClose$1 = escapeToClose();
|
|
10171
10172
|
const enterCode$1 = enterCode();
|
|
@@ -10175,10 +10176,10 @@ const getCodeGeneratorVirtualDom = state => {
|
|
|
10175
10176
|
childCount: 2
|
|
10176
10177
|
}, {
|
|
10177
10178
|
type: Input,
|
|
10178
|
-
className: mergeClassNames(CodeGeneratorInput, InputBox),
|
|
10179
|
+
className: mergeClassNames(CodeGeneratorInput$1, InputBox),
|
|
10179
10180
|
childCount: 0,
|
|
10180
10181
|
placeholder: enterCode$1,
|
|
10181
|
-
name:
|
|
10182
|
+
name: CodeGeneratorInput
|
|
10182
10183
|
}, {
|
|
10183
10184
|
type: Div,
|
|
10184
10185
|
className: CodeGeneratorMessage,
|
|
@@ -11103,7 +11104,7 @@ const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
|
11103
11104
|
title: 'Toggle Replace',
|
|
11104
11105
|
ariaLabel: 'Toggle Replace',
|
|
11105
11106
|
ariaExpanded: replaceExpanded,
|
|
11106
|
-
name:
|
|
11107
|
+
name: ToggleReplace$1,
|
|
11107
11108
|
childCount: 1,
|
|
11108
11109
|
'data-command': 'toggleReplace',
|
|
11109
11110
|
onClick,
|