@lvce-editor/editor-worker 19.47.1 → 19.49.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.
@@ -5040,6 +5040,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
5040
5040
  handleOffsetX: 0,
5041
5041
  hasListener: false,
5042
5042
  height,
5043
+ highlightActiveLineNumber: true,
5043
5044
  highlightedLine: -1,
5044
5045
  hoverEnabled: false,
5045
5046
  id,
@@ -5275,6 +5276,7 @@ const createEditor = async ({
5275
5276
  fontWeight,
5276
5277
  formatOnSave,
5277
5278
  height,
5279
+ highlightActiveLineNumber = true,
5278
5280
  hoverEnabled,
5279
5281
  id,
5280
5282
  isAutoClosingBracketsEnabled,
@@ -5338,6 +5340,7 @@ const createEditor = async ({
5338
5340
  handleOffsetX: 0,
5339
5341
  hasListener: false,
5340
5342
  height,
5343
+ highlightActiveLineNumber,
5341
5344
  id,
5342
5345
  incrementalEdits: emptyIncrementalEdits,
5343
5346
  insertSpaces: true,
@@ -5532,7 +5535,7 @@ const isEqual$3 = (oldState, newState) => {
5532
5535
  };
5533
5536
 
5534
5537
  const isEqual$2 = (oldState, newState) => {
5535
- return oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
5538
+ return oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
5536
5539
  };
5537
5540
 
5538
5541
  const isEqual$1 = (oldState, newState) => {
@@ -12552,6 +12555,7 @@ const HoverProblemMessage = 'HoverProblemMessage';
12552
12555
  const IconClose = 'IconClose';
12553
12556
  const InputBox = 'InputBox';
12554
12557
  const MaskIcon = 'MaskIcon';
12558
+ const SelectionUnfocused = 'SelectionUnfocused';
12555
12559
  const Viewlet = 'Viewlet';
12556
12560
 
12557
12561
  const HandleBeforeInput = 1;
@@ -13685,6 +13689,7 @@ const kLetterSpacing = 'editor.letterSpacing';
13685
13689
  const kTabSize = 'editor.tabSize';
13686
13690
  const kInsertSpaces = 'editor.insertSpaces';
13687
13691
  const kLineNumbers = 'editor.lineNumbers';
13692
+ const kHighlightActiveLineNumber = 'editor.highlightActiveLineNumber';
13688
13693
  const kDiagnostics = 'editor.diagnostics';
13689
13694
  const kQuickSuggestions = 'editor.quickSuggestions';
13690
13695
  const kAutoClosingQuotes = 'editor.autoClosingQuotes';
@@ -13736,6 +13741,9 @@ const getInsertSpaces = async () => {
13736
13741
  const getLineNumbers = async () => {
13737
13742
  return (await get$3(kLineNumbers)) ?? false;
13738
13743
  };
13744
+ const getHighlightActiveLineNumber = async () => {
13745
+ return (await get$3(kHighlightActiveLineNumber)) ?? true;
13746
+ };
13739
13747
  const getCompletionTriggerCharacters = async () => {
13740
13748
  return ['.', '/'];
13741
13749
  };
@@ -13753,7 +13761,7 @@ const getBreadcrumbsEnabled = async () => {
13753
13761
  };
13754
13762
 
13755
13763
  const getEditorPreferences = async () => {
13756
- const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getBreadcrumbsEnabled(), getInsertSpaces(), getDragAndDropEnabled()]);
13764
+ const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getHighlightActiveLineNumber(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getBreadcrumbsEnabled(), getInsertSpaces(), getDragAndDropEnabled()]);
13757
13765
  return {
13758
13766
  breadcrumbsEnabled,
13759
13767
  completionTriggerCharacters,
@@ -13762,6 +13770,7 @@ const getEditorPreferences = async () => {
13762
13770
  fontFamily,
13763
13771
  fontSize,
13764
13772
  fontWeight,
13773
+ highlightActiveLineNumber,
13765
13774
  hoverEnabled,
13766
13775
  insertSpaces,
13767
13776
  isAutoClosingBracketsEnabled: isAutoClosingBracketsEnabled$1,
@@ -14102,6 +14111,7 @@ const loadContent = async (state, savedState) => {
14102
14111
  fontFamily,
14103
14112
  fontSize,
14104
14113
  fontWeight,
14114
+ highlightActiveLineNumber,
14105
14115
  hoverEnabled,
14106
14116
  insertSpaces,
14107
14117
  isAutoClosingBracketsEnabled,
@@ -14134,6 +14144,7 @@ const loadContent = async (state, savedState) => {
14134
14144
  fontFamily,
14135
14145
  fontSize,
14136
14146
  fontWeight,
14147
+ highlightActiveLineNumber,
14137
14148
  hoverEnabled,
14138
14149
  insertSpaces,
14139
14150
  isAutoClosingBracketsEnabled,
@@ -14961,8 +14972,9 @@ const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, hig
14961
14972
  }, ...rowsDom];
14962
14973
  };
14963
14974
 
14964
- const getSelectionsVirtualDom = selections => {
14975
+ const getSelectionsVirtualDom = (selections, focused = true) => {
14965
14976
  const dom = [];
14977
+ const className = focused ? EditorSelection : mergeClassNames(EditorSelection, SelectionUnfocused);
14966
14978
  for (let i = 0; i < selections.length; i += 4) {
14967
14979
  const x = selections[i];
14968
14980
  const y = selections[i + 1];
@@ -14970,7 +14982,7 @@ const getSelectionsVirtualDom = selections => {
14970
14982
  const height = selections[i + 3];
14971
14983
  dom.push({
14972
14984
  childCount: 0,
14973
- className: EditorSelection,
14985
+ className,
14974
14986
  height,
14975
14987
  left: x,
14976
14988
  top: y,
@@ -14981,8 +14993,8 @@ const getSelectionsVirtualDom = selections => {
14981
14993
  return dom;
14982
14994
  };
14983
14995
 
14984
- const getEditorSelectionsVirtualDom = selectionInfos => {
14985
- const selectionsDom = getSelectionsVirtualDom(selectionInfos);
14996
+ const getEditorSelectionsVirtualDom = (selectionInfos, focused = true) => {
14997
+ const selectionsDom = getSelectionsVirtualDom(selectionInfos, focused);
14986
14998
  return [{
14987
14999
  childCount: selectionInfos.length / 4,
14988
15000
  className: 'Selections',
@@ -14995,8 +15007,8 @@ const editorLayersNode = {
14995
15007
  className: 'EditorLayers',
14996
15008
  type: Div
14997
15009
  };
14998
- const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = []) => {
14999
- return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations), ...getEditorCursorsVirtualDom(cursorInfos), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
15010
+ const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true) => {
15011
+ return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations), ...getEditorCursorsVirtualDom(cursorInfos), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
15000
15012
  };
15001
15013
 
15002
15014
  const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
@@ -15058,6 +15070,7 @@ const getEditorContentVirtualDom = ({
15058
15070
  diagnostics = [],
15059
15071
  differences,
15060
15072
  endOfLineDecorations = [],
15073
+ focused = true,
15061
15074
  highlightedLine = -1,
15062
15075
  lineNumbers = true,
15063
15076
  scrollBarDiagnostics = [],
@@ -15065,7 +15078,7 @@ const getEditorContentVirtualDom = ({
15065
15078
  textInfos,
15066
15079
  visibleLineIndices = []
15067
15080
  }) => {
15068
- return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
15081
+ return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
15069
15082
  };
15070
15083
 
15071
15084
  const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
@@ -15194,8 +15207,10 @@ const getEditorVirtualDom = ({
15194
15207
  differences,
15195
15208
  documentSymbols = [],
15196
15209
  endOfLineDecorations = [],
15210
+ focused = true,
15197
15211
  gutterDecorations = [],
15198
15212
  gutterInfos = [],
15213
+ highlightActiveLineNumber = true,
15199
15214
  highlightedLine = -1,
15200
15215
  lightBulbRowIndex = -1,
15201
15216
  lineNumbers = true,
@@ -15227,7 +15242,8 @@ const getEditorVirtualDom = ({
15227
15242
  const visibleGutterInfos = breakPoints.length > 0 || gutterDecorations.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices, lightBulbRowIndex, gutterDecorations) : gutterInfos;
15228
15243
  const showGutter = lineNumbers || breakPoints.length > 0 || lightBulbRowIndex >= 0 || gutterDecorations.length > 0;
15229
15244
  const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
15230
- const gutterDom = showGutter ? getEditorGutterVirtualDom(visibleGutterInfos, primaryCursorRowIndex + 1) : [];
15245
+ const activeLineNumber = highlightActiveLineNumber ? primaryCursorRowIndex + 1 : -1;
15246
+ const gutterDom = showGutter ? getEditorGutterVirtualDom(visibleGutterInfos, activeLineNumber) : [];
15231
15247
  const minimapDom = getMinimapVirtualDom(minimapEnabled, minimapLines, minLineY);
15232
15248
  const breadcrumbsDom = breadcrumbsEnabled ? getEditorBreadcrumbsVirtualDom({
15233
15249
  breadcrumbsEnabled,
@@ -15251,6 +15267,7 @@ const getEditorVirtualDom = ({
15251
15267
  diagnostics,
15252
15268
  differences,
15253
15269
  endOfLineDecorations,
15270
+ focused,
15254
15271
  highlightedLine,
15255
15272
  lineNumbers,
15256
15273
  scrollBarDiagnostics,
@@ -15457,10 +15474,10 @@ const renderSelections = {
15457
15474
  selectionInfos = []
15458
15475
  } = newState;
15459
15476
  const cursorsDom = getCursorsVirtualDom(cursorInfos);
15460
- const selectionsDom = getSelectionsVirtualDom(selectionInfos);
15477
+ const selectionsDom = getSelectionsVirtualDom(selectionInfos, newState.focused);
15461
15478
  return [/* method */'setSelections', cursorsDom, selectionsDom];
15462
15479
  },
15463
- isEqual: (oldState, newState) => oldState.cursorInfos === newState.cursorInfos && oldState.selectionInfos === newState.selectionInfos
15480
+ isEqual: (oldState, newState) => oldState.cursorInfos === newState.cursorInfos && oldState.selectionInfos === newState.selectionInfos && oldState.focused === newState.focused
15464
15481
  };
15465
15482
  const renderCss = {
15466
15483
  apply: renderCss$1,
@@ -15492,6 +15509,7 @@ const renderGutterInfo = {
15492
15509
  const {
15493
15510
  breakPoints,
15494
15511
  gutterDecorations,
15512
+ highlightActiveLineNumber,
15495
15513
  lightBulbRowIndex,
15496
15514
  lineNumbers,
15497
15515
  maxLineY,
@@ -15505,10 +15523,11 @@ const renderGutterInfo = {
15505
15523
  }
15506
15524
  const gutterInfos = getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices, lightBulbRowIndex, gutterDecorations);
15507
15525
  const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
15508
- const dom = getEditorGutterVirtualDom$1(gutterInfos, primaryCursorRowIndex + 1);
15526
+ const activeLineNumber = highlightActiveLineNumber ? primaryCursorRowIndex + 1 : -1;
15527
+ const dom = getEditorGutterVirtualDom$1(gutterInfos, activeLineNumber);
15509
15528
  return ['renderGutter', dom];
15510
15529
  },
15511
- isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.gutterDecorations === newState.gutterDecorations && oldState.lightBulbRowIndex === newState.lightBulbRowIndex && oldState.foldingRanges === newState.foldingRanges && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && getPrimaryCursorRowIndex(oldState.selections, oldState.primarySelectionIndex) === getPrimaryCursorRowIndex(newState.selections, newState.primarySelectionIndex)
15530
+ isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.gutterDecorations === newState.gutterDecorations && oldState.lightBulbRowIndex === newState.lightBulbRowIndex && oldState.foldingRanges === newState.foldingRanges && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && (!newState.highlightActiveLineNumber || getPrimaryCursorRowIndex(oldState.selections, oldState.primarySelectionIndex) === getPrimaryCursorRowIndex(newState.selections, newState.primarySelectionIndex))
15512
15531
  };
15513
15532
  const renderWidgets = {
15514
15533
  apply: renderWidgets$1,
@@ -53,6 +53,14 @@
53
53
  "type": 1,
54
54
  "value": "on"
55
55
  },
56
+ {
57
+ "category": "text-editor",
58
+ "description": "Controls whether the primary cursor line number is highlighted",
59
+ "heading": "Highlight Active Line Number",
60
+ "id": "editor.highlightActiveLineNumber",
61
+ "type": 3,
62
+ "value": true
63
+ },
56
64
  {
57
65
  "category": "text-editor",
58
66
  "description": "Controls whether the minimap is shown",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.47.1",
3
+ "version": "19.49.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"