@lvce-editor/editor-worker 19.38.0 → 19.39.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.
@@ -1032,6 +1032,34 @@ const listen$1 = async (module, options) => {
1032
1032
  return ipc;
1033
1033
  };
1034
1034
 
1035
+ const createSharedLazyRpc = factory => {
1036
+ let rpcPromise;
1037
+ const getOrCreate = () => {
1038
+ if (!rpcPromise) {
1039
+ rpcPromise = factory();
1040
+ }
1041
+ return rpcPromise;
1042
+ };
1043
+ return {
1044
+ async dispose() {
1045
+ const rpc = await getOrCreate();
1046
+ await rpc.dispose();
1047
+ },
1048
+ async invoke(method, ...params) {
1049
+ const rpc = await getOrCreate();
1050
+ return rpc.invoke(method, ...params);
1051
+ },
1052
+ async invokeAndTransfer(method, ...params) {
1053
+ const rpc = await getOrCreate();
1054
+ return rpc.invokeAndTransfer(method, ...params);
1055
+ },
1056
+ async send(method, ...params) {
1057
+ const rpc = await getOrCreate();
1058
+ rpc.send(method, ...params);
1059
+ }
1060
+ };
1061
+ };
1062
+
1035
1063
  const create$f = async ({
1036
1064
  commandMap,
1037
1065
  isMessagePortOpen = true,
@@ -1067,34 +1095,6 @@ const create$e = async ({
1067
1095
  });
1068
1096
  };
1069
1097
 
1070
- const createSharedLazyRpc = factory => {
1071
- let rpcPromise;
1072
- const getOrCreate = () => {
1073
- if (!rpcPromise) {
1074
- rpcPromise = factory();
1075
- }
1076
- return rpcPromise;
1077
- };
1078
- return {
1079
- async dispose() {
1080
- const rpc = await getOrCreate();
1081
- await rpc.dispose();
1082
- },
1083
- async invoke(method, ...params) {
1084
- const rpc = await getOrCreate();
1085
- return rpc.invoke(method, ...params);
1086
- },
1087
- async invokeAndTransfer(method, ...params) {
1088
- const rpc = await getOrCreate();
1089
- return rpc.invokeAndTransfer(method, ...params);
1090
- },
1091
- async send(method, ...params) {
1092
- const rpc = await getOrCreate();
1093
- rpc.send(method, ...params);
1094
- }
1095
- };
1096
- };
1097
-
1098
1098
  const create$d = async ({
1099
1099
  commandMap,
1100
1100
  isMessagePortOpen,
@@ -1406,6 +1406,7 @@ const KeyZ = 54;
1406
1406
  const F2 = 58;
1407
1407
  const F3 = 59;
1408
1408
  const F4 = 60;
1409
+ const F8 = 64;
1409
1410
  const F9 = 65;
1410
1411
  const F12 = 68;
1411
1412
  const Period = 87;
@@ -4352,6 +4353,69 @@ const updateColorPickerValue$1 = async (editor, value) => {
4352
4353
  };
4353
4354
  };
4354
4355
 
4356
+ const diagnosticContainsPosition = (diagnostic, rowIndex, columnIndex) => {
4357
+ const {
4358
+ columnIndex: startColumnIndex,
4359
+ endColumnIndex,
4360
+ endRowIndex,
4361
+ rowIndex: startRowIndex
4362
+ } = diagnostic;
4363
+ if (rowIndex < startRowIndex || rowIndex > endRowIndex) {
4364
+ return false;
4365
+ }
4366
+ if (startRowIndex === endRowIndex && startColumnIndex === endColumnIndex) {
4367
+ return rowIndex === startRowIndex && columnIndex === startColumnIndex;
4368
+ }
4369
+ if (rowIndex === startRowIndex && columnIndex < startColumnIndex) {
4370
+ return false;
4371
+ }
4372
+ if (rowIndex === endRowIndex && columnIndex >= endColumnIndex) {
4373
+ return false;
4374
+ }
4375
+ return true;
4376
+ };
4377
+
4378
+ const getOffsetAtCursor$1 = editor => {
4379
+ const {
4380
+ selections
4381
+ } = editor;
4382
+ const rowIndex = selections[0];
4383
+ const columnIndex = selections[1];
4384
+ const offset = offsetAt(editor, rowIndex, columnIndex);
4385
+ return offset;
4386
+ };
4387
+
4388
+ const hasDiagnosticAtPosition = (diagnostics, rowIndex, columnIndex) => diagnostics.some(diagnostic => diagnosticContainsPosition(diagnostic, rowIndex, columnIndex));
4389
+ const getLightBulbRowIndex = async editor => {
4390
+ const {
4391
+ diagnostics = [],
4392
+ languageId,
4393
+ selections,
4394
+ uri
4395
+ } = editor;
4396
+ if (!selections || selections.length !== 4 || selections[0] !== selections[2] || selections[1] !== selections[3]) {
4397
+ return -1;
4398
+ }
4399
+ const rowIndex = selections[0];
4400
+ const columnIndex = selections[1];
4401
+ if (!hasDiagnosticAtPosition(diagnostics, rowIndex, columnIndex)) {
4402
+ return -1;
4403
+ }
4404
+ const textDocument = {
4405
+ documentId: editor.uid,
4406
+ languageId,
4407
+ text: getText$1(editor),
4408
+ uri
4409
+ };
4410
+ const offset = getOffsetAtCursor$1(editor);
4411
+ try {
4412
+ const actions = await invoke$d('Extensions.executeCodeActionProviders', textDocument, offset);
4413
+ return Array.isArray(actions) && actions.length > 0 ? rowIndex : -1;
4414
+ } catch {
4415
+ return -1;
4416
+ }
4417
+ };
4418
+
4355
4419
  const maxTokenizerLoadPasses = 10;
4356
4420
  const getLine = (lineState, embeddedResults, tokenMap, lineLength) => {
4357
4421
  const embeddedResult = embeddedResults[lineState?.embeddedResultIndex];
@@ -4435,6 +4499,7 @@ const shouldUpdateDiagnosticData = (oldState, newState) => {
4435
4499
  const shouldUpdateSelectionData = (oldState, newState) => {
4436
4500
  return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.foldingRanges !== newState.foldingRanges || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
4437
4501
  };
4502
+ const shouldUpdateLightBulb = (oldState, newState) => oldState.diagnostics !== newState.diagnostics || oldState.languageId !== newState.languageId || oldState.selections !== newState.selections || oldState.uri !== newState.uri;
4438
4503
  const shouldUpdateVisibleTextData = (oldState, newState) => {
4439
4504
  if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
4440
4505
  return false;
@@ -4481,6 +4546,17 @@ const updateDerivedState = async (oldState, newState) => {
4481
4546
  visualDecorations
4482
4547
  };
4483
4548
  }
4549
+ if (oldState.lines !== nextState.lines) {
4550
+ finalState = {
4551
+ ...finalState,
4552
+ lightBulbRowIndex: -1
4553
+ };
4554
+ } else if (shouldUpdateLightBulb(oldState, nextState)) {
4555
+ finalState = {
4556
+ ...finalState,
4557
+ lightBulbRowIndex: await getLightBulbRowIndex(finalState)
4558
+ };
4559
+ }
4484
4560
  if (!shouldUpdateSelectionData(oldState, nextState)) {
4485
4561
  return finalState;
4486
4562
  }
@@ -4635,6 +4711,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
4635
4711
  itemHeight: 20,
4636
4712
  languageId: '',
4637
4713
  letterSpacing: 0,
4714
+ lightBulbRowIndex: -1,
4638
4715
  lineCache: [],
4639
4716
  lineNumbers: false,
4640
4717
  lines: [],
@@ -8320,6 +8397,52 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
8320
8397
  }
8321
8398
  };
8322
8399
 
8400
+ const getDiagnosticHoverDetail = ({
8401
+ code,
8402
+ source
8403
+ }) => {
8404
+ if (code === undefined) {
8405
+ return source || '';
8406
+ }
8407
+ if (!source) {
8408
+ return String(code);
8409
+ }
8410
+ return `${source} (${code})`;
8411
+ };
8412
+
8413
+ const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
8414
+ // @ts-ignore
8415
+ return invoke$a('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
8416
+ };
8417
+
8418
+ const maximumWidth = 600;
8419
+ const horizontalPadding = 18;
8420
+ const getDiagnosticHoverInfo = async (editor, diagnostic) => {
8421
+ const {
8422
+ columnIndex,
8423
+ message,
8424
+ rowIndex
8425
+ } = diagnostic;
8426
+ const width = Math.min(maximumWidth, editor.width);
8427
+ const detail = getDiagnosticHoverDetail(diagnostic);
8428
+ const diagnosticText = detail ? `${message} ${detail}` : message;
8429
+ const measuredHeight = await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, width - horizontalPadding);
8430
+ const height = Math.min(measuredHeight + 10, editor.height);
8431
+ const positionX = editor.x + columnIndex * editor.columnWidth - (editor.deltaX || 0);
8432
+ const x = Math.max(editor.x, Math.min(positionX, editor.x + editor.width - width));
8433
+ const rowBottom = editor.y + (rowIndex + 1) * editor.rowHeight - (editor.deltaY || 0);
8434
+ const y = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
8435
+ return {
8436
+ diagnostics: [diagnostic],
8437
+ documentation: '',
8438
+ height,
8439
+ lineInfos: [],
8440
+ width,
8441
+ x,
8442
+ y
8443
+ };
8444
+ };
8445
+
8323
8446
  const create$5 = () => {
8324
8447
  const uid = create$8();
8325
8448
  const widget = {
@@ -8380,11 +8503,6 @@ const getHover = async (editor, offset) => {
8380
8503
  return hover;
8381
8504
  };
8382
8505
 
8383
- const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
8384
- // @ts-ignore
8385
- return invoke$a('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
8386
- };
8387
-
8388
8506
  const getLineInfo = (line, tokens, TokenMap) => {
8389
8507
  const tokensLength = tokens.length;
8390
8508
  let end = 0;
@@ -8435,28 +8553,10 @@ const tokenizeCodeBlock = async (codeBlock, languageId, tokenizerPath) => {
8435
8553
  return lineInfos;
8436
8554
  };
8437
8555
 
8438
- const containsPosition = (diagnostic, rowIndex, columnIndex) => {
8439
- const {
8440
- columnIndex: startColumnIndex,
8441
- endColumnIndex,
8442
- endRowIndex,
8443
- rowIndex: startRowIndex
8444
- } = diagnostic;
8445
- if (rowIndex < startRowIndex || rowIndex > endRowIndex) {
8446
- return false;
8447
- }
8448
- if (rowIndex === startRowIndex && columnIndex < startColumnIndex) {
8449
- return false;
8450
- }
8451
- if (rowIndex === endRowIndex && columnIndex >= endColumnIndex) {
8452
- return false;
8453
- }
8454
- return true;
8455
- };
8456
8556
  const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
8457
8557
  const matching = [];
8458
8558
  for (const diagnostic of diagnostics) {
8459
- if (containsPosition(diagnostic, rowIndex, columnIndex)) {
8559
+ if (diagnosticContainsPosition(diagnostic, rowIndex, columnIndex)) {
8460
8560
  matching.push(diagnostic);
8461
8561
  }
8462
8562
  }
@@ -8573,10 +8673,17 @@ const updateWidget = (editor, widgetId, newState) => {
8573
8673
  const getHoverWidgetIndex = widgets => {
8574
8674
  return widgets.findIndex(widget => widget.id === Hover);
8575
8675
  };
8576
- const updateHover = async (editor, widgetIndex, position) => {
8676
+ const applyHoverContent = async (editor, getNewState) => {
8677
+ const {
8678
+ widgets = []
8679
+ } = editor;
8680
+ const widgetIndex = getHoverWidgetIndex(widgets);
8681
+ if (widgetIndex === -1) {
8682
+ return addWidgetToEditor(Hover, FocusEditorHover, editor, create$5, getNewState);
8683
+ }
8577
8684
  const widgetRevision = next(editor.uid);
8578
- const widget = editor.widgets[widgetIndex];
8579
- const newState = await loadHoverContent(widget.newState, position);
8685
+ const widget = widgets[widgetIndex];
8686
+ const newState = await getNewState(widget.newState);
8580
8687
  if (get$2(editor.uid) !== widgetRevision) {
8581
8688
  return editor;
8582
8689
  }
@@ -8595,17 +8702,20 @@ const updateHover = async (editor, widgetIndex, position) => {
8595
8702
  };
8596
8703
  };
8597
8704
  const showHover$1 = async (editor, position) => {
8598
- const {
8599
- widgets = []
8600
- } = editor;
8601
- const widgetIndex = getHoverWidgetIndex(widgets);
8602
- if (widgetIndex !== -1) {
8603
- return updateHover(editor, widgetIndex, position);
8604
- }
8605
8705
  const newStateGenerator = async state => {
8606
8706
  return loadHoverContent(state, position);
8607
8707
  };
8608
- return addWidgetToEditor(Hover, FocusEditorHover, editor, create$5, newStateGenerator);
8708
+ return applyHoverContent(editor, newStateGenerator);
8709
+ };
8710
+ const showDiagnostic = async (editor, diagnostic) => {
8711
+ const newStateGenerator = async state => {
8712
+ const hoverInfo = await getDiagnosticHoverInfo(editor, diagnostic);
8713
+ return {
8714
+ ...state,
8715
+ ...hoverInfo
8716
+ };
8717
+ };
8718
+ return applyHoverContent(editor, newStateGenerator);
8609
8719
  };
8610
8720
 
8611
8721
  const showHover = async (editor, position, token) => {
@@ -9333,6 +9443,74 @@ const insertLineBreak = async editor => {
9333
9443
  return scheduleDocumentAndCursorsSelections(editor, changes, selectionChanges);
9334
9444
  };
9335
9445
 
9446
+ const compareDiagnostics = (left, right) => {
9447
+ return left.rowIndex - right.rowIndex || left.columnIndex - right.columnIndex || left.endRowIndex - right.endRowIndex || left.endColumnIndex - right.endColumnIndex || left.message.localeCompare(right.message) || left.source.localeCompare(right.source) || String(left.code).localeCompare(String(right.code));
9448
+ };
9449
+ const isSelectionAtDiagnostic = (selections, diagnostic) => {
9450
+ return selections.length >= 4 && selections[0] === diagnostic.rowIndex && selections[1] === diagnostic.columnIndex && selections[2] === diagnostic.endRowIndex && selections[3] === diagnostic.endColumnIndex;
9451
+ };
9452
+ const comparePosition = (diagnostic, rowIndex, columnIndex) => {
9453
+ return diagnostic.rowIndex - rowIndex || diagnostic.columnIndex - columnIndex;
9454
+ };
9455
+ const getDiagnosticNavigationIndex = (diagnostics, selections, currentDiagnostic, direction) => {
9456
+ if (diagnostics.length === 0) {
9457
+ return undefined;
9458
+ }
9459
+ const orderedDiagnostics = diagnostics.toSorted(compareDiagnostics);
9460
+ const currentIndex = currentDiagnostic ? orderedDiagnostics.indexOf(currentDiagnostic) : -1;
9461
+ if (currentDiagnostic && currentIndex !== -1 && isSelectionAtDiagnostic(selections, currentDiagnostic)) {
9462
+ const index = (currentIndex + direction + orderedDiagnostics.length) % orderedDiagnostics.length;
9463
+ return {
9464
+ diagnostic: orderedDiagnostics[index],
9465
+ index
9466
+ };
9467
+ }
9468
+ const rowIndex = selections[2] ?? selections[0] ?? 0;
9469
+ const columnIndex = selections[3] ?? selections[1] ?? 0;
9470
+ if (direction === 1) {
9471
+ const index = orderedDiagnostics.findIndex(diagnostic => comparePosition(diagnostic, rowIndex, columnIndex) > 0);
9472
+ const wrappedIndex = index === -1 ? 0 : index;
9473
+ return {
9474
+ diagnostic: orderedDiagnostics[wrappedIndex],
9475
+ index: wrappedIndex
9476
+ };
9477
+ }
9478
+ const index = orderedDiagnostics.findLastIndex(diagnostic => comparePosition(diagnostic, rowIndex, columnIndex) < 0);
9479
+ const wrappedIndex = index === -1 ? orderedDiagnostics.length - 1 : index;
9480
+ return {
9481
+ diagnostic: orderedDiagnostics[wrappedIndex],
9482
+ index: wrappedIndex
9483
+ };
9484
+ };
9485
+
9486
+ const navigateDiagnostic = async (editor, direction) => {
9487
+ const {
9488
+ diagnostics = [],
9489
+ problemNavigationDiagnostic,
9490
+ selections
9491
+ } = editor;
9492
+ const result = getDiagnosticNavigationIndex(diagnostics, selections, problemNavigationDiagnostic, direction);
9493
+ if (!result) {
9494
+ return editor;
9495
+ }
9496
+ const {
9497
+ diagnostic
9498
+ } = result;
9499
+ const newSelections = new Uint32Array([diagnostic.rowIndex, diagnostic.columnIndex, diagnostic.endRowIndex, diagnostic.endColumnIndex]);
9500
+ const editorWithSelection = scheduleSelections(editor, newSelections);
9501
+ const editorWithNavigationState = {
9502
+ ...editorWithSelection,
9503
+ problemNavigationDiagnostic: diagnostic
9504
+ };
9505
+ return showDiagnostic(editorWithNavigationState, diagnostic);
9506
+ };
9507
+ const nextDiagnostic = editor => {
9508
+ return navigateDiagnostic(editor, 1);
9509
+ };
9510
+ const previousDiagnostic = editor => {
9511
+ return navigateDiagnostic(editor, -1);
9512
+ };
9513
+
9336
9514
  const Script = 2;
9337
9515
  const Unknown$1 = 0;
9338
9516
 
@@ -9904,16 +10082,6 @@ const openFind = async state => {
9904
10082
  return openFind2(state);
9905
10083
  };
9906
10084
 
9907
- const getOffsetAtCursor$1 = editor => {
9908
- const {
9909
- selections
9910
- } = editor;
9911
- const rowIndex = selections[0];
9912
- const columnIndex = selections[1];
9913
- const offset = offsetAt(editor, rowIndex, columnIndex);
9914
- return offset;
9915
- };
9916
-
9917
10085
  const getPositionAtCursor$1 = editor => {
9918
10086
  const {
9919
10087
  selections
@@ -11777,19 +11945,7 @@ const HandleScrollBarVerticalPointerMove = 31;
11777
11945
  const HandleScrollBarVerticalPointerUp = 32;
11778
11946
  const HandleWheel = 33;
11779
11947
  const HandleKeyUp = 34;
11780
-
11781
- const getDiagnosticHoverDetail = ({
11782
- code,
11783
- source
11784
- }) => {
11785
- if (code === undefined) {
11786
- return source || '';
11787
- }
11788
- if (!source) {
11789
- return String(code);
11790
- }
11791
- return `${source} (${code})`;
11792
- };
11948
+ const HandleLightBulbClick = 35;
11793
11949
 
11794
11950
  const Div = 4;
11795
11951
  const Input = 6;
@@ -12240,6 +12396,14 @@ const getFindWidgetFocusKeyBindings = () => {
12240
12396
  };
12241
12397
  const getKeyBindings = () => {
12242
12398
  return [{
12399
+ command: 'Editor.nextDiagnostic',
12400
+ key: F8,
12401
+ when: FocusEditorText
12402
+ }, {
12403
+ command: 'Editor.previousDiagnostic',
12404
+ key: Shift | F8,
12405
+ when: FocusEditorText
12406
+ }, {
12243
12407
  command: 'Editor.closeColorPicker',
12244
12408
  key: Escape,
12245
12409
  when: FocusColorPicker
@@ -14007,18 +14171,25 @@ const getEditorContentVirtualDom = ({
14007
14171
 
14008
14172
  const getGutterInfoVirtualDom = gutterInfo => {
14009
14173
  const isBreakpoint = typeof gutterInfo === 'object' && gutterInfo.isBreakpoint;
14174
+ const isLightBulb = typeof gutterInfo === 'object' && gutterInfo.isLightBulb;
14010
14175
  const lineNumber = typeof gutterInfo === 'object' ? gutterInfo.lineNumber : gutterInfo;
14011
- const label = `Breakpoint on line ${lineNumber}`;
14176
+ const label = isLightBulb ? `Show Code Actions on line ${lineNumber}` : `Breakpoint on line ${lineNumber}`;
14012
14177
  return [{
14013
- ...(isBreakpoint && {
14178
+ ...((isBreakpoint || isLightBulb) && {
14014
14179
  ariaLabel: label,
14015
- style: 'color:var(--DebugIconBreakpointForeground,#e51400)',
14016
14180
  title: label
14017
14181
  }),
14182
+ ...(isBreakpoint && !isLightBulb && {
14183
+ style: 'color:var(--DebugIconBreakpointForeground,#e51400)'
14184
+ }),
14018
14185
  childCount: 1,
14019
- className: isBreakpoint ? 'LineNumber LineNumberBreakpoint' : 'LineNumber',
14186
+ className: isLightBulb ? 'LineNumber LineNumberLightBulb MaskIconLightBulb' : isBreakpoint ? 'LineNumber LineNumberBreakpoint' : 'LineNumber',
14187
+ ...(isLightBulb && {
14188
+ onClick: HandleLightBulbClick,
14189
+ role: Button
14190
+ }),
14020
14191
  type: Span
14021
- }, text(isBreakpoint ? '●' : lineNumber)];
14192
+ }, text(isLightBulb ? '' : isBreakpoint ? '●' : lineNumber)];
14022
14193
  };
14023
14194
  const getEditorGutterVirtualDom$1 = gutterInfos => {
14024
14195
  const dom = gutterInfos.flatMap(getGutterInfoVirtualDom);
@@ -14034,17 +14205,29 @@ const getEditorGutterVirtualDom = gutterInfos => {
14034
14205
  }, ...gutterDom];
14035
14206
  };
14036
14207
 
14037
- const getGutterInfos = (minLineY, maxLineY, breakPoints, showLineNumbers = true, lineIndices) => {
14208
+ const getGutterInfos = (minLineY, maxLineY, breakPoints, showLineNumbers = true, lineIndices, lightBulbRowIndex = -1) => {
14038
14209
  const gutterInfos = [];
14039
14210
  const rows = lineIndices || Array.from({
14040
14211
  length: maxLineY - minLineY
14041
14212
  }, (_, index) => minLineY + index);
14042
14213
  for (const rowIndex of rows) {
14043
14214
  const lineNumber = rowIndex + 1;
14044
- gutterInfos.push(breakPoints.includes(rowIndex) ? {
14045
- isBreakpoint: true,
14046
- lineNumber
14047
- } : showLineNumbers ? lineNumber : '');
14215
+ const isBreakpoint = breakPoints.includes(rowIndex);
14216
+ const isLightBulb = rowIndex === lightBulbRowIndex;
14217
+ if (isLightBulb) {
14218
+ gutterInfos.push({
14219
+ isBreakpoint,
14220
+ isLightBulb: true,
14221
+ lineNumber
14222
+ });
14223
+ } else if (isBreakpoint) {
14224
+ gutterInfos.push({
14225
+ isBreakpoint: true,
14226
+ lineNumber
14227
+ });
14228
+ } else {
14229
+ gutterInfos.push(showLineNumbers ? lineNumber : '');
14230
+ }
14048
14231
  }
14049
14232
  return gutterInfos;
14050
14233
  };
@@ -14080,6 +14263,7 @@ const getEditorVirtualDom = ({
14080
14263
  endOfLineDecorations = [],
14081
14264
  gutterInfos = [],
14082
14265
  highlightedLine = -1,
14266
+ lightBulbRowIndex = -1,
14083
14267
  lineNumbers = true,
14084
14268
  loadError = '',
14085
14269
  maxLineY = 0,
@@ -14101,8 +14285,8 @@ const getEditorVirtualDom = ({
14101
14285
  type: Div
14102
14286
  }, textEditorErrorIconNode, textEditorErrorMessageNode, text(loadError)];
14103
14287
  }
14104
- const visibleGutterInfos = breakPoints.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices) : gutterInfos;
14105
- const showGutter = lineNumbers || breakPoints.length > 0;
14288
+ const visibleGutterInfos = breakPoints.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices, lightBulbRowIndex) : gutterInfos;
14289
+ const showGutter = lineNumbers || breakPoints.length > 0 || lightBulbRowIndex >= 0;
14106
14290
  const gutterDom = showGutter ? getEditorGutterVirtualDom(visibleGutterInfos) : [];
14107
14291
  const minimapDom = getMinimapVirtualDom(minimapEnabled, minimapLines, minLineY);
14108
14292
  return [{
@@ -14341,19 +14525,20 @@ const renderGutterInfo = {
14341
14525
  apply(oldState, newState) {
14342
14526
  const {
14343
14527
  breakPoints,
14528
+ lightBulbRowIndex,
14344
14529
  lineNumbers,
14345
14530
  maxLineY,
14346
14531
  minLineY,
14347
14532
  visibleLineIndices
14348
14533
  } = newState;
14349
- if (!lineNumbers && breakPoints.length === 0) {
14534
+ if (!lineNumbers && breakPoints.length === 0 && lightBulbRowIndex === -1) {
14350
14535
  return ['renderGutter', []];
14351
14536
  }
14352
- const gutterInfos = getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices);
14537
+ const gutterInfos = getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices, lightBulbRowIndex);
14353
14538
  const dom = getEditorGutterVirtualDom$1(gutterInfos);
14354
14539
  return ['renderGutter', dom];
14355
14540
  },
14356
- isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.foldingRanges === newState.foldingRanges && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
14541
+ isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.lightBulbRowIndex === newState.lightBulbRowIndex && oldState.foldingRanges === newState.foldingRanges && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
14357
14542
  };
14358
14543
  const renderWidgets = {
14359
14544
  apply: renderWidgets$1,
@@ -14389,6 +14574,10 @@ const renderEditor = async id => {
14389
14574
 
14390
14575
  const renderEventListeners = () => {
14391
14576
  return [{
14577
+ name: HandleLightBulbClick,
14578
+ params: ['showSourceActions3'],
14579
+ preventDefault: true
14580
+ }, {
14392
14581
  name: HandleFocus,
14393
14582
  params: ['handleFocus']
14394
14583
  }, {
@@ -14593,6 +14782,7 @@ const addDiagnostics = async (editor, diagnostics) => {
14593
14782
  ...editor,
14594
14783
  decorations,
14595
14784
  diagnostics,
14785
+ lightBulbRowIndex: -1,
14596
14786
  visualDecorations
14597
14787
  };
14598
14788
  };
@@ -14927,6 +15117,7 @@ const commandMap = {
14927
15117
  'Editor.moveRectangleSelectionPx': wrapCommand(moveRectangleSelectionPx),
14928
15118
  'Editor.moveSelection': wrapCommand(editorMoveSelection),
14929
15119
  'Editor.moveSelectionPx': wrapCommand(moveSelectionPx),
15120
+ 'Editor.nextDiagnostic': wrapCommand(nextDiagnostic),
14930
15121
  'Editor.offsetAt': offsetAt,
14931
15122
  'Editor.openCodeGenerator': wrapCommand(openCodeGenerator),
14932
15123
  'Editor.openColorPicker': wrapCommand(openColorPicker),
@@ -14937,6 +15128,7 @@ const commandMap = {
14937
15128
  'Editor.organizeImports': wrapCommand(organizeImports),
14938
15129
  'Editor.paste': wrapCommand(paste),
14939
15130
  'Editor.pasteText': wrapCommand(pasteText),
15131
+ 'Editor.previousDiagnostic': wrapCommand(previousDiagnostic),
14940
15132
  'Editor.redo': wrapCommand(redo),
14941
15133
  'Editor.render': renderEditor,
14942
15134
  'Editor.render2': render2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.38.0",
3
+ "version": "19.39.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"