@lvce-editor/editor-worker 19.30.13 → 19.31.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.
@@ -3260,7 +3260,7 @@ const getEnabled = () => {
3260
3260
  };
3261
3261
 
3262
3262
  // TODO this should be in a separate scrolling module
3263
- const setDeltaY$2 = async (state, value) => {
3263
+ const setDeltaY$1 = async (state, value) => {
3264
3264
  object(state);
3265
3265
  number(value);
3266
3266
  const {
@@ -4002,11 +4002,11 @@ const applyEdit$1 = (editor, changes) => {
4002
4002
  };
4003
4003
 
4004
4004
  // TODO
4005
- const setDeltaYFixedValue$1 = (editor, value) => {
4006
- return setDeltaY$2(editor, value);
4005
+ const setDeltaYFixedValue = (editor, value) => {
4006
+ return setDeltaY$1(editor, value);
4007
4007
  };
4008
- const setDeltaY$1 = (editor, value) => {
4009
- return setDeltaYFixedValue$1(editor, editor.deltaY + value);
4008
+ const setDeltaY = (editor, value) => {
4009
+ return setDeltaYFixedValue(editor, editor.deltaY + value);
4010
4010
  };
4011
4011
  const isAutoClosingChange = change => {
4012
4012
  return change.origin === EditorTypeWithAutoClosing;
@@ -4865,9 +4865,9 @@ const createEditor = async ({
4865
4865
  if (lineToReveal && columnToReveal) {
4866
4866
  const delta = lineToReveal * rowHeight;
4867
4867
  // TODO scroll to this line
4868
- newEditor3 = await setDeltaY$2(newEditor2, delta);
4868
+ newEditor3 = await setDeltaY$1(newEditor2, delta);
4869
4869
  } else {
4870
- newEditor3 = await setDeltaY$2(newEditor2, 0);
4870
+ newEditor3 = await setDeltaY$1(newEditor2, 0);
4871
4871
  }
4872
4872
 
4873
4873
  // Detect links and initialize decorations
@@ -6942,7 +6942,7 @@ const cursorPageDown = editor => {
6942
6942
  moveRangeToPosition$1(result, index, Math.min(endRow + pageSize, lastRowIndex), endColumn);
6943
6943
  });
6944
6944
  const newEditor = scheduleSelections(editor, newSelections);
6945
- return setDeltaYFixedValue$1(newEditor, deltaY + pageSize * itemHeight);
6945
+ return setDeltaYFixedValue(newEditor, deltaY + pageSize * itemHeight);
6946
6946
  };
6947
6947
 
6948
6948
  const cursorSet = (editor, rowIndex, columnIndex) => {
@@ -7455,10 +7455,12 @@ const DeleteLine = 'Delete Line';
7455
7455
  const EditorCloseColorPicker = 'Editor: Close Color Picker';
7456
7456
  const EditorCopyLineDown = 'Editor: Copy Line Down';
7457
7457
  const EditorCopyLineUp = 'Editor: Copy Line Up';
7458
+ const EditorDecrementSelection = 'Editor: Decrement Selection';
7458
7459
  const EditorFormatDocumentForced = 'Editor: Format Document (forced)';
7459
7460
  const EditorGoToDefinition = 'Editor: Go To Definition';
7460
7461
  const EditorGoToTypeDefinition = 'Editor: Go To Type Definition';
7461
7462
  const EditorIndent = 'Editor: Indent';
7463
+ const EditorIncrementSelection = 'Editor: Increment Selection';
7462
7464
  const EditorOpenColorPicker = 'Editor: Open Color Picker';
7463
7465
  const EditorSelectAllOccurrences = 'Editor: Select All Occurrences';
7464
7466
  const EditorSelectDown = 'Editor: Select Down';
@@ -7594,6 +7596,9 @@ const editorSelectInsideString = () => {
7594
7596
  const editorIndent = () => {
7595
7597
  return i18nString(EditorIndent);
7596
7598
  };
7599
+ const editorIncrementSelection = () => {
7600
+ return i18nString(EditorIncrementSelection);
7601
+ };
7597
7602
  const editorUnindent$1 = () => {
7598
7603
  return i18nString(EditorUnindent);
7599
7604
  };
@@ -7603,6 +7608,9 @@ const editorSortLinesAscending = () => {
7603
7608
  const editorToggleComment = () => {
7604
7609
  return i18nString(EditorToggleComment);
7605
7610
  };
7611
+ const editorDecrementSelection = () => {
7612
+ return i18nString(EditorDecrementSelection);
7613
+ };
7606
7614
  const editorSelectUp = () => {
7607
7615
  return i18nString(EditorSelectUp);
7608
7616
  };
@@ -8874,7 +8882,7 @@ const handleScrollBarMove = async (state, eventY) => {
8874
8882
  const relativeY = eventY - y - handleOffset;
8875
8883
  const newPercent = getNewPercent(state, relativeY);
8876
8884
  const newDeltaY = newPercent * finalDeltaY;
8877
- const newState = await setDeltaYFixedValue$1(state, newDeltaY);
8885
+ const newState = await setDeltaYFixedValue(state, newDeltaY);
8878
8886
  return newState;
8879
8887
  };
8880
8888
  const handleScrollBarVerticalPointerMove = handleScrollBarMove;
@@ -8907,7 +8915,7 @@ const handleScrollBarPointerDown = async (state, eventY) => {
8907
8915
  percent
8908
8916
  } = getNewDeltaPercent(height, scrollBarHeight, relativeY);
8909
8917
  const newDeltaY = percent * finalDeltaY;
8910
- const newState = await setDeltaYFixedValue$1(state, newDeltaY);
8918
+ const newState = await setDeltaYFixedValue(state, newDeltaY);
8911
8919
  return {
8912
8920
  ...newState,
8913
8921
  handleOffset
@@ -8955,13 +8963,9 @@ const handleTouchStart = (editor, touchEvent) => {
8955
8963
  };
8956
8964
 
8957
8965
  // @ts-ignore
8958
- const setDeltaY = (editor, deltaY) => {
8959
- return setDeltaY$1(editor, deltaY);
8960
- };
8961
-
8962
- // @ts-ignore
8963
- const setDeltaYFixedValue = (editor, deltaY) => {
8964
- return setDeltaYFixedValue$1(editor, deltaY);
8966
+ const scrollByLines = (editor, lineCount) => {
8967
+ number(lineCount);
8968
+ return setDeltaY(editor, lineCount * editor.itemHeight);
8965
8969
  };
8966
8970
 
8967
8971
  // @ts-ignore
@@ -11985,6 +11989,13 @@ const getLines2 = editorUid => {
11985
11989
  } = editor;
11986
11990
  return lines;
11987
11991
  };
11992
+ const getVisibleLineRange = editorUid => {
11993
+ const {
11994
+ maxLineY,
11995
+ minLineY
11996
+ } = getEditor$1(editorUid);
11997
+ return [minLineY, maxLineY];
11998
+ };
11988
11999
  const getSelections2 = editorUid => {
11989
12000
  const editor = getEditor$1(editorUid);
11990
12001
  const {
@@ -12557,6 +12568,12 @@ const getQuickPickMenuEntries = () => {
12557
12568
  }, {
12558
12569
  id: 'Editor.deleteLine',
12559
12570
  label: deleteLine()
12571
+ }, {
12572
+ id: 'Editor.incrementSelection',
12573
+ label: editorIncrementSelection()
12574
+ }, {
12575
+ id: 'Editor.decrementSelection',
12576
+ label: editorDecrementSelection()
12560
12577
  }, {
12561
12578
  id: 'Editor.format',
12562
12579
  label: formatDocument()
@@ -12776,16 +12793,24 @@ const applyTabCompletion = (editor, result) => {
12776
12793
  return editorSnippet(editor, result);
12777
12794
  };
12778
12795
 
12796
+ const insertTab = editor => {
12797
+ // TODO have setting what should be inserted on tab
12798
+ return type(editor, ' ');
12799
+ };
12779
12800
  const handleTab = async editor => {
12780
12801
  if (!isEverySelectionEmpty(editor.selections)) {
12781
12802
  return indentMore(editor);
12782
12803
  }
12783
- const result = await getTabCompletion(editor);
12784
- if (!result) {
12785
- // TODO enter tab or two spaces
12786
- return editor;
12804
+ try {
12805
+ const result = await getTabCompletion(editor);
12806
+ if (!result) {
12807
+ return insertTab(editor);
12808
+ }
12809
+ return applyTabCompletion(editor, result);
12810
+ } catch (error) {
12811
+ await handleError$1(error, 'Failed to execute tab completion provider: ');
12812
+ return insertTab(editor);
12787
12813
  }
12788
- return applyTabCompletion(editor, result);
12789
12814
  };
12790
12815
 
12791
12816
  const relaunchWorkers = async () => {
@@ -14557,6 +14582,7 @@ const commandMap = {
14557
14582
  'Editor.getSourceActions': getSourceActions,
14558
14583
  'Editor.getText': getText,
14559
14584
  'Editor.getUri': getUri,
14585
+ 'Editor.getVisibleLineRange': getVisibleLineRange,
14560
14586
  'Editor.getWordAt': getWordAt$1,
14561
14587
  'Editor.getWordAt2': getWordAt,
14562
14588
  'Editor.getWordAtOffset2': getWordAtOffset2,
@@ -14629,6 +14655,7 @@ const commandMap = {
14629
14655
  'Editor.resize': wrapCommand(resize),
14630
14656
  'Editor.save': wrapCommand(save),
14631
14657
  'Editor.saveState': wrapGetter(saveState),
14658
+ 'Editor.scrollByLines': wrapCommand(scrollByLines),
14632
14659
  'Editor.selectAll': wrapCommand(selectAll),
14633
14660
  'Editor.selectAllLeft': wrapCommand(editorSelectAllLeft),
14634
14661
  'Editor.selectAllOccurrences': wrapCommand(selectAllOccurrences),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.30.13",
3
+ "version": "19.31.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"