@lvce-editor/editor-worker 19.79.2 → 19.80.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.
@@ -38,6 +38,14 @@ export interface DocumentSymbol {
38
38
  readonly selectionStartOffset: number;
39
39
  readonly startOffset: number;
40
40
  }
41
+ export interface CodeLens {
42
+ readonly action?: string;
43
+ readonly extensionId: string;
44
+ readonly id: number;
45
+ readonly label: string;
46
+ readonly providerId: string;
47
+ }
48
+ export type CodeLensRows = Readonly<Record<number, readonly CodeLens[]>>;
41
49
  export type EditorGutterDecorationType = "added" | "deleted" | "modified";
42
50
  export interface EditorGutterDecoration {
43
51
  readonly rowIndex: number;
@@ -83,6 +91,8 @@ export interface EditorState {
83
91
  readonly breakPoints: readonly number[];
84
92
  readonly canCoalesceTyping?: boolean;
85
93
  readonly charWidth: number;
94
+ readonly codeLensEnabled?: boolean;
95
+ readonly codeLensRows?: CodeLensRows;
86
96
  readonly columnWidth: number;
87
97
  readonly combineWhitespaceTokens?: boolean;
88
98
  readonly completionsOnType?: boolean;
package/dist/diff-sdk.js CHANGED
@@ -585,9 +585,14 @@ const getRenderedLineCount = (height, rowHeight, deltaY) => {
585
585
  };
586
586
 
587
587
  const toMergeConflictActionsRow = rowIndex => ~rowIndex;
588
- const isMergeConflictActionsRow = viewRow => viewRow < 0;
588
+
589
+ // Merge conflict rows use the signed 32-bit range. Reserve a separate range for code lenses.
590
+ const firstCodeLensRow = -4294967296;
591
+ const isCodeLensRow = viewRow => viewRow <= firstCodeLensRow;
592
+ const getCodeLensRowIndex = viewRow => firstCodeLensRow - viewRow;
593
+ const isMergeConflictActionsRow = viewRow => viewRow < 0 && !isCodeLensRow(viewRow);
589
594
  const getMergeConflictRowIndex = viewRow => ~viewRow;
590
- const getViewLineIndices = (lineCount, isRowHidden, mergeConflicts) => {
595
+ const getViewLineIndices = (lineCount, isRowHidden, mergeConflicts, codeLensRows) => {
591
596
  const conflictStartRows = new Set(mergeConflicts.map(conflict => conflict.startRowIndex));
592
597
  const result = [];
593
598
  for (let rowIndex = 0; rowIndex < lineCount; rowIndex++) {
@@ -597,6 +602,9 @@ const getViewLineIndices = (lineCount, isRowHidden, mergeConflicts) => {
597
602
  if (conflictStartRows.has(rowIndex)) {
598
603
  result.push(toMergeConflictActionsRow(rowIndex));
599
604
  }
605
+ if (codeLensRows?.[rowIndex]) {
606
+ result.push(firstCodeLensRow - rowIndex);
607
+ }
600
608
  result.push(rowIndex);
601
609
  }
602
610
  return result;
@@ -605,7 +613,7 @@ const getVisibleViewLineIndices = (viewLineIndices, startVisualRow, numberOfVisi
605
613
  return viewLineIndices.slice(startVisualRow, startVisualRow + numberOfVisibleLines);
606
614
  };
607
615
  const getVisibleLineIndices = visibleViewLineIndices => {
608
- return visibleViewLineIndices.filter(viewRow => !isMergeConflictActionsRow(viewRow));
616
+ return visibleViewLineIndices.filter(viewRow => viewRow >= 0);
609
617
  };
610
618
  const getVisualRowForDocumentRow$1 = (rowIndex, viewLineIndices) => {
611
619
  const visualRow = viewLineIndices.indexOf(rowIndex);
@@ -616,6 +624,9 @@ const getDocumentRowForVisualRow$1 = (visualRow, viewLineIndices) => {
616
624
  return visualRow;
617
625
  }
618
626
  const viewRow = viewLineIndices[visualRow];
627
+ if (isCodeLensRow(viewRow)) {
628
+ return getCodeLensRowIndex(viewRow);
629
+ }
619
630
  return isMergeConflictActionsRow(viewRow) ? getMergeConflictRowIndex(viewRow) : viewRow;
620
631
  };
621
632
 
@@ -805,16 +816,16 @@ const updateLayout = (editor, foldingRanges) => {
805
816
  rowHeight
806
817
  } = editor;
807
818
  const mergeConflicts = editor.mergeConflictActionsEnabled ? getMergeConflicts(lines) : [];
808
- const hasMergeConflictRows = mergeConflicts.length > 0;
809
- const viewLineIndices = hasMergeConflictRows ? getViewLineIndices(lines.length, rowIndex => isRowHidden(rowIndex, foldingRanges), mergeConflicts) : [];
810
- const visibleLineCount = hasMergeConflictRows ? viewLineIndices.length : getVisibleLineCount(lines.length, foldingRanges);
819
+ const hasSyntheticRows = mergeConflicts.length > 0 || Boolean(editor.codeLensRows);
820
+ const viewLineIndices = hasSyntheticRows ? getViewLineIndices(lines.length, rowIndex => isRowHidden(rowIndex, foldingRanges), mergeConflicts, editor.codeLensRows) : [];
821
+ const visibleLineCount = hasSyntheticRows ? viewLineIndices.length : getVisibleLineCount(lines.length, foldingRanges);
811
822
  const finalY = Math.max(visibleLineCount - numberOfVisibleLines, 0);
812
823
  const finalDeltaY = Math.max(visibleLineCount * itemHeight - height, 0);
813
824
  const deltaY = clamp(editor.deltaY, 0, finalDeltaY);
814
825
  const startVisualRow = Math.floor(deltaY / itemHeight);
815
826
  const renderedLineCount = getRenderedLineCount(height, itemHeight, deltaY);
816
- const visibleViewLineIndices = hasMergeConflictRows ? getVisibleViewLineIndices(viewLineIndices, startVisualRow, renderedLineCount) : getViewportLineIndices(lines.length, foldingRanges, startVisualRow, renderedLineCount);
817
- const visibleLineIndices = hasMergeConflictRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
827
+ const visibleViewLineIndices = hasSyntheticRows ? getVisibleViewLineIndices(viewLineIndices, startVisualRow, renderedLineCount) : getViewportLineIndices(lines.length, foldingRanges, startVisualRow, renderedLineCount);
828
+ const visibleLineIndices = hasSyntheticRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
818
829
  const minLineY = visibleLineIndices[0] ?? 0;
819
830
  const maxLineY = visibleLineIndices.length === 0 ? 0 : visibleLineIndices.at(-1) + 1;
820
831
  const contentHeight = visibleLineCount * rowHeight;
@@ -11668,9 +11679,9 @@ const setDeltaY$1 = async (state, value) => {
11668
11679
  }
11669
11680
  const startVisualRow = Math.floor(newDeltaY / itemHeight);
11670
11681
  const renderedLineCount = getRenderedLineCount(height, itemHeight, newDeltaY);
11671
- const hasMergeConflictRows = state.viewLineIndices?.length > 0;
11672
- const visibleViewLineIndices = hasMergeConflictRows ? getVisibleViewLineIndices(state.viewLineIndices, startVisualRow, renderedLineCount) : getViewportLineIndices(state.lines.length, state.foldingRanges || [], startVisualRow, renderedLineCount);
11673
- const visibleLineIndices = hasMergeConflictRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
11682
+ const hasSyntheticRows = state.viewLineIndices?.length > 0;
11683
+ const visibleViewLineIndices = hasSyntheticRows ? getVisibleViewLineIndices(state.viewLineIndices, startVisualRow, renderedLineCount) : getViewportLineIndices(state.lines.length, state.foldingRanges || [], startVisualRow, renderedLineCount);
11684
+ const visibleLineIndices = hasSyntheticRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
11674
11685
  const minLineY = visibleLineIndices[0] ?? 0;
11675
11686
  const maxLineY = visibleLineIndices.length === 0 ? 0 : visibleLineIndices.at(-1) + 1;
11676
11687
  const newEditor1 = {
@@ -13695,6 +13706,14 @@ const updateColorPickerValue$1 = async (editor, value) => {
13695
13706
  };
13696
13707
  };
13697
13708
 
13709
+ const getDocument = editor => ({
13710
+ documentId: editor.id,
13711
+ languageId: editor.languageId,
13712
+ text: getText$1(editor),
13713
+ uri: editor.uri
13714
+ });
13715
+ const sameDocument = (left, right) => left.uri === right.uri && left.languageId === right.languageId && left.lines === right.lines && left.lifecycle === right.lifecycle;
13716
+
13698
13717
  const getTextDocument$2 = editor => ({
13699
13718
  documentId: editor.id || editor.uid,
13700
13719
  languageId: editor.languageId,
@@ -14314,8 +14333,15 @@ const mergeConflictsEqual$1 = (oldState, newState) => {
14314
14333
  };
14315
14334
  const updateDerivedState = async (oldState, newState, deferGutterDecorations = false) => {
14316
14335
  const horizontalState = oldState.initial || oldState.lines !== newState.lines || oldState.width !== newState.width || oldState.charWidth !== newState.charWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.rtl !== newState.rtl || oldState.tabSize !== newState.tabSize || oldState.lineNumbers !== newState.lineNumbers || oldState.breakPoints !== newState.breakPoints || oldState.gutterDecorations !== newState.gutterDecorations || oldState.lightBulbRowIndex !== newState.lightBulbRowIndex ? await updateHorizontalLayout(newState) : newState;
14317
- const layoutState = oldState.lines !== newState.lines && 'foldingRanges' in newState ? updateLayout(horizontalState, []) : horizontalState;
14318
- const nextState = mergeConflictsEqual$1(oldState, layoutState) ? layoutState : {
14336
+ const linesChanged = oldState.lines !== newState.lines;
14337
+ const clearCodeLenses = oldState.codeLensRows && (!newState.codeLensEnabled || !sameDocument(oldState, newState));
14338
+ const codeLensRows = clearCodeLenses ? undefined : horizontalState.codeLensRows;
14339
+ const codeLensRowsChanged = oldState.codeLensRows !== codeLensRows;
14340
+ const layoutState = (linesChanged || codeLensRowsChanged) && 'foldingRanges' in newState ? updateLayout({
14341
+ ...horizontalState,
14342
+ codeLensRows
14343
+ }, linesChanged ? [] : horizontalState.foldingRanges) : horizontalState;
14344
+ const nextState = !codeLensRowsChanged && mergeConflictsEqual$1(oldState, layoutState) ? layoutState : {
14319
14345
  ...layoutState,
14320
14346
  incrementalEdits: emptyIncrementalEdits
14321
14347
  };
@@ -14561,6 +14587,71 @@ const merge = (current, snapshot, result) => {
14561
14587
  };
14562
14588
  };
14563
14589
 
14590
+ const lensIds = {
14591
+ next: 0
14592
+ };
14593
+ const toRows = (result, lineCount) => {
14594
+ const rows = Object.create(null);
14595
+ for (const {
14596
+ extensionId,
14597
+ lenses,
14598
+ providerId
14599
+ } of result) {
14600
+ const validLenses = lenses.filter(lens => lens && Number.isSafeInteger(lens.rowIndex) && lens.rowIndex >= 0 && lens.rowIndex < lineCount && typeof lens.label === 'string');
14601
+ for (const lens of validLenses) {
14602
+ const row = rows[lens.rowIndex] ||= [];
14603
+ row.push({
14604
+ ...(typeof lens.action === 'string' && {
14605
+ action: lens.action
14606
+ }),
14607
+ extensionId,
14608
+ id: lensIds.next++,
14609
+ label: lens.label,
14610
+ providerId
14611
+ });
14612
+ }
14613
+ }
14614
+ return rows;
14615
+ };
14616
+ const request = async editor => {
14617
+ try {
14618
+ const result = await invoke$9(editor.applicationId, 'Extensions.executeCodeLensProviders', getDocument(editor));
14619
+ if (!Array.isArray(result) || result.length === 0) {
14620
+ return;
14621
+ }
14622
+ const codeLensRows = toRows(result, editor.lines.length);
14623
+ if (Object.keys(codeLensRows).length === 0) {
14624
+ return;
14625
+ }
14626
+ const committed = await enqueue(editor.uid, async () => {
14627
+ const current = get$a(editor.uid);
14628
+ if (!current?.newState.codeLensEnabled || !sameDocument(editor, current.newState)) {
14629
+ return false;
14630
+ }
14631
+ const nextState = await updateDerivedState(current.newState, {
14632
+ ...current.newState,
14633
+ codeLensRows
14634
+ });
14635
+ const latest = get$a(editor.uid);
14636
+ if (!latest || latest.newState !== current.newState || editor.lifecycle?.disposed) {
14637
+ return false;
14638
+ }
14639
+ set$b(editor.uid, latest.oldState, nextState);
14640
+ return true;
14641
+ });
14642
+ if (committed) {
14643
+ await invoke$7('Editor.renderPending', editor.uid);
14644
+ }
14645
+ } catch {
14646
+ // Code lenses are optional and should never interrupt editing.
14647
+ }
14648
+ };
14649
+ const requestIfChanged = (oldState, newState) => {
14650
+ if (newState.codeLensEnabled && !newState.initial && !newState.largeFile && !newState.loadError && (oldState.initial || !oldState.codeLensEnabled || !sameDocument(oldState, newState))) {
14651
+ void request(newState);
14652
+ }
14653
+ };
14654
+
14564
14655
  class Diff {
14565
14656
  diff(oldStr, newStr,
14566
14657
  // Type below is not accurate/complete - see above for full possibilities - but it compiles
@@ -15759,6 +15850,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
15759
15850
  if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
15760
15851
  void editorDiagnosticEffect.apply(newEditorWithDerivedState);
15761
15852
  }
15853
+ requestIfChanged(state, newEditorWithDerivedState);
15762
15854
  const finalEditor = newEditorWithDerivedState;
15763
15855
  if (deferGutterDecorations) {
15764
15856
  schedule(finalEditor);
@@ -15795,6 +15887,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
15795
15887
  continue;
15796
15888
  }
15797
15889
  set$b(otherUid, latest.oldState, synchronizedEditor);
15890
+ requestIfChanged(editor, synchronizedEditor);
15798
15891
  if (deferGutterDecorations) {
15799
15892
  schedule(synchronizedEditor);
15800
15893
  }
@@ -17204,6 +17297,30 @@ const updateAutomaticCompletion = async editor => {
17204
17297
  return openCompletion(editor, true);
17205
17298
  };
17206
17299
 
17300
+ const activateCodeLens = async (state, rowIndex, lensId) => {
17301
+ const {
17302
+ applicationId,
17303
+ codeLensEnabled,
17304
+ codeLensRows
17305
+ } = state;
17306
+ const lens = codeLensRows?.[Number(rowIndex)]?.find(({
17307
+ id
17308
+ }) => id === Number(lensId));
17309
+ if (!codeLensEnabled || !lens?.action) {
17310
+ return state;
17311
+ }
17312
+ const document = getDocument(state);
17313
+ try {
17314
+ const edit = await invoke$9(applicationId, 'Extensions.resolveCodeLens', document, lens.extensionId, lens.providerId, lens.action);
17315
+ if (!edit || !Number.isSafeInteger(edit.offset) || !Number.isSafeInteger(edit.deleted) || edit.offset < 0 || edit.deleted < 0 || edit.offset + edit.deleted > document.text.length || typeof edit.inserted !== 'string' || /[\r\n]/.test(edit.inserted)) {
17316
+ return state;
17317
+ }
17318
+ return await scheduleDocumentAndCursorsSelections(state, getTextChanges(state, [edit]));
17319
+ } catch {
17320
+ return state;
17321
+ }
17322
+ };
17323
+
17207
17324
  const getAcceptedLines = (lines, conflict, action) => {
17208
17325
  const current = lines.slice(conflict.currentStartRowIndex, conflict.currentEndRowIndex);
17209
17326
  const incoming = lines.slice(conflict.incomingStartRowIndex, conflict.incomingEndRowIndex);
@@ -24363,6 +24480,8 @@ const HandleMergeConflictActionsMouseDown = 37;
24363
24480
  const HandleMouseOut = 38;
24364
24481
  const HandleMouseOver = 39;
24365
24482
  const HandleHoverMouseDown = 40;
24483
+ const HandleCodeLensClick = 41;
24484
+ const HandleCodeLensPointerDown = 42;
24366
24485
 
24367
24486
  const getLineInfoVirtualDom = lineInfo => {
24368
24487
  const dom = [{
@@ -24642,6 +24761,7 @@ ${editorSelector} .GutterRows {
24642
24761
  display: flex;
24643
24762
  flex-direction: column;
24644
24763
  }
24764
+ ${editorSelector} .EditorCodeLenses,
24645
24765
  ${editorSelector} .MergeConflictActions,
24646
24766
  ${editorSelector} .MergeConflictActionsGutter {
24647
24767
  box-sizing: border-box;
@@ -24649,6 +24769,7 @@ ${editorSelector} .MergeConflictActionsGutter {
24649
24769
  height: var(--EditorRowHeight);
24650
24770
  line-height: var(--EditorRowHeight);
24651
24771
  }
24772
+ ${editorSelector} .EditorCodeLenses,
24652
24773
  ${editorSelector} .MergeConflictActions {
24653
24774
  align-items: center;
24654
24775
  display: flex;
@@ -24656,6 +24777,7 @@ ${editorSelector} .MergeConflictActions {
24656
24777
  padding-left: 4px;
24657
24778
  user-select: none;
24658
24779
  }
24780
+ ${editorSelector} .EditorCodeLensAction,
24659
24781
  ${editorSelector} .MergeConflictAction {
24660
24782
  appearance: none;
24661
24783
  background: none;
@@ -24665,6 +24787,8 @@ ${editorSelector} .MergeConflictAction {
24665
24787
  font: inherit;
24666
24788
  padding: 0;
24667
24789
  }
24790
+ ${editorSelector} .EditorCodeLensAction:hover,
24791
+ ${editorSelector} .EditorCodeLensAction:focus-visible,
24668
24792
  ${editorSelector} .MergeConflictAction:hover,
24669
24793
  ${editorSelector} .MergeConflictAction:focus-visible {
24670
24794
  color: var(--TextLinkActiveForeground, #4daafc);
@@ -25191,13 +25315,46 @@ const addMergeConflictActions = (dom, rowIndex) => {
25191
25315
  }, text(label));
25192
25316
  }
25193
25317
  };
25194
- const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1, diagnostics = [], deltaX = 0, width = Infinity, charWidth = 1, tabSize = 2, lines = [], horizontalVirtualizationThreshold = 500, horizontalVisibleRanges = [], rtl = false) => {
25318
+ const addCodeLenses = (dom, codeLensRows, rowIndex) => {
25319
+ const lenses = codeLensRows[rowIndex] ?? [];
25320
+ dom.push({
25321
+ childCount: lenses.length,
25322
+ className: 'EditorCodeLenses',
25323
+ onMouseDown: HandleHoverMouseDown,
25324
+ onPointerDown: HandleCodeLensPointerDown,
25325
+ type: Div
25326
+ });
25327
+ for (const {
25328
+ action,
25329
+ id,
25330
+ label
25331
+ } of lenses) {
25332
+ dom.push(action ? {
25333
+ childCount: 1,
25334
+ className: 'EditorCodeLensAction',
25335
+ 'data-action': String(id),
25336
+ 'data-rowIndex': rowIndex,
25337
+ onClick: HandleCodeLensClick,
25338
+ title: label,
25339
+ type: Button$1
25340
+ } : {
25341
+ childCount: 1,
25342
+ title: label,
25343
+ type: Span
25344
+ }, text(label));
25345
+ }
25346
+ };
25347
+ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1, diagnostics = [], deltaX = 0, width = Infinity, charWidth = 1, tabSize = 2, lines = [], horizontalVirtualizationThreshold = 500, horizontalVisibleRanges = [], rtl = false, codeLensRows = {}) => {
25195
25348
  const dom = [];
25196
25349
  const actualViewRows = visibleViewLineIndices.length === 0 ? Array.from({
25197
25350
  length: textInfos.length
25198
25351
  }, (_, index) => visibleLineIndices[index] ?? index) : visibleViewLineIndices;
25199
25352
  let textInfoIndex = 0;
25200
25353
  for (const viewRow of actualViewRows) {
25354
+ if (isCodeLensRow(viewRow)) {
25355
+ addCodeLenses(dom, codeLensRows, getCodeLensRowIndex(viewRow));
25356
+ continue;
25357
+ }
25201
25358
  if (isMergeConflictActionsRow(viewRow)) {
25202
25359
  addMergeConflictActions(dom, getMergeConflictRowIndex(viewRow));
25203
25360
  continue;
@@ -25279,8 +25436,8 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
25279
25436
  return dom;
25280
25437
  };
25281
25438
 
25282
- const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, rtl = false) => {
25283
- const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, 0, Infinity, 1, tabSize, lines, 500, horizontalVisibleRanges, rtl);
25439
+ const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, rtl = false, codeLensRows) => {
25440
+ const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, 0, Infinity, 1, tabSize, lines, 500, horizontalVisibleRanges, rtl, codeLensRows);
25284
25441
  return [{
25285
25442
  childCount: visibleViewLineIndices.length || textInfos.length,
25286
25443
  className: 'EditorRows',
@@ -25377,8 +25534,8 @@ const editorLayersNode = {
25377
25534
  className: 'EditorLayers',
25378
25535
  type: Div
25379
25536
  };
25380
- const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = [], problemsHighlightedRow = -1, roundedSelection = false, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, textDecorationDom = [], rtl = false) => {
25381
- return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused, roundedSelection), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, rtl), ...getEditorCursorsVirtualDom(cursorInfos, focused), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos, textDecorationDom)];
25537
+ const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = [], problemsHighlightedRow = -1, roundedSelection = false, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, textDecorationDom = [], rtl = false, codeLensRows) => {
25538
+ return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused, roundedSelection), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, rtl, codeLensRows), ...getEditorCursorsVirtualDom(cursorInfos, focused), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos, textDecorationDom)];
25382
25539
  };
25383
25540
 
25384
25541
  const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
@@ -25448,6 +25605,7 @@ const editorContentNode = {
25448
25605
  const getEditorContentVirtualDom = ({
25449
25606
  bracketMatchInfos = [],
25450
25607
  breadcrumbsEnabled = false,
25608
+ codeLensRows,
25451
25609
  cursorInfos = [],
25452
25610
  diagnostics = [],
25453
25611
  differences,
@@ -25475,7 +25633,7 @@ const getEditorContentVirtualDom = ({
25475
25633
  return [{
25476
25634
  ...editorContentNode,
25477
25635
  className: breadcrumbsEnabled ? 'EditorContent EditorBreadcrumbsOffset' : 'EditorContent'
25478
- }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom, rtl), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth, scrollBarLeft)];
25636
+ }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom, rtl, codeLensRows), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth, scrollBarLeft)];
25479
25637
  };
25480
25638
 
25481
25639
  const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
@@ -25618,6 +25776,7 @@ const getEditorVirtualDom = ({
25618
25776
  breadcrumbFileIcon = '',
25619
25777
  breadcrumbsEnabled = false,
25620
25778
  breakPoints = [],
25779
+ codeLensRows,
25621
25780
  combineWhitespaceTokens: combineWhitespaceTokens$1 = false,
25622
25781
  cursorInfos = [],
25623
25782
  diagnostics: fallbackDiagnostics = [],
@@ -25701,6 +25860,9 @@ const getEditorVirtualDom = ({
25701
25860
  }, ...breadcrumbsDom, ...gutterDom, ...getEditorContentVirtualDom({
25702
25861
  bracketMatchInfos,
25703
25862
  breadcrumbsEnabled,
25863
+ ...(codeLensRows && {
25864
+ codeLensRows
25865
+ }),
25704
25866
  cursorInfos,
25705
25867
  diagnostics,
25706
25868
  differences,
@@ -25827,7 +25989,7 @@ const canRenderPlainTextAppend = (oldState, newState) => {
25827
25989
  if (oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
25828
25990
  return false;
25829
25991
  }
25830
- if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.deltaX !== newState.deltaX || oldState.gutterWidth !== newState.gutterWidth || (newState.deltaX ?? 0) !== 0 && oldState.longestLineWidth !== newState.longestLineWidth || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(getHorizontalScrollDimensions(oldState).width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(getHorizontalScrollDimensions(newState).width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
25992
+ if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.deltaX !== newState.deltaX || oldState.gutterWidth !== newState.gutterWidth || (newState.deltaX ?? 0) !== 0 && oldState.longestLineWidth !== newState.longestLineWidth || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(getHorizontalScrollDimensions(oldState).width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(getHorizontalScrollDimensions(newState).width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || Boolean(oldState.codeLensRows) || Boolean(newState.codeLensRows) || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
25831
25993
  return false;
25832
25994
  }
25833
25995
  return true;
@@ -26472,7 +26634,7 @@ const getKeyBindings = () => {
26472
26634
  key: Home,
26473
26635
  when: FocusEditorCompletions
26474
26636
  }, {
26475
- command: 'EditorCompletion.toggleDetails',
26637
+ command: 'Editor.openCompletion',
26476
26638
  key: CtrlCmd | Space$1,
26477
26639
  when: FocusEditorCompletions
26478
26640
  }, {
@@ -26772,7 +26934,7 @@ const getKeyBindings = () => {
26772
26934
  key: Alt$1 | Shift | LeftArrow,
26773
26935
  when: FocusEditor
26774
26936
  }, {
26775
- command: 'Editor.showSignatureHelp',
26937
+ command: 'Editor.selectionGrow',
26776
26938
  key: CtrlCmd | Shift | Space$1,
26777
26939
  when: FocusEditorText
26778
26940
  }];
@@ -27211,9 +27373,10 @@ const getHorizontalVirtualizationThreshold = value => {
27211
27373
  return Math.floor(threshold);
27212
27374
  };
27213
27375
  const getEditorPreferences = async applicationId => {
27214
- const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, formatActions, hoverEnabled, hoverDelay, horizontalVirtualizationThreshold, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, rtl, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens, selectedTextOccurrenceMatching, disableMonospaceOptimizations, syntaxHighlightingCacheEnabled] = await Promise.all([get$2('editor.diagnostics', applicationId), getFontFamily(applicationId), getFontSize(applicationId), getFontWeight(applicationId), get$2('editor.formatOnSave', applicationId), get$2('editor.formatActions', applicationId), get$2('editor.hover', applicationId), get$2('editor.hoverDelay', applicationId), get$2('editor.horizontalVirtualizationThreshold', applicationId), get$2('editor.messageDelay', applicationId), isAutoClosingBracketsEnabled(applicationId), isAutoClosingQuotesEnabled(applicationId), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(applicationId), getLineNumbers(applicationId), getHighlightActiveLineNumber(applicationId), getRowHeight(applicationId), getTabSize(applicationId), getLetterSpacing(applicationId), getCompletionTriggerCharacters(), getMinimapEnabled(applicationId), getMergeConflictActionsEnabled(applicationId), get$2('editor.rtl', applicationId), get$2('breadcrumbs.enabled', applicationId), get$2('editor.insertSpaces', applicationId), get$2('editor.dragAndDrop', applicationId), get$2('editor.roundedSelection', applicationId), get$2('editor.combineWhitespaceTokens', applicationId), get$2('editor.selectedTextOccurrenceMatching', applicationId), get$2('editor.disableMonospaceOptimizations', applicationId), get$2('editor.syntaxHighlightingCache', applicationId)]);
27376
+ const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, formatActions, hoverEnabled, hoverDelay, horizontalVirtualizationThreshold, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, rtl, breadcrumbsEnabled, codeLensEnabled, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens, selectedTextOccurrenceMatching, disableMonospaceOptimizations, syntaxHighlightingCacheEnabled] = await Promise.all([get$2('editor.diagnostics', applicationId), getFontFamily(applicationId), getFontSize(applicationId), getFontWeight(applicationId), get$2('editor.formatOnSave', applicationId), get$2('editor.formatActions', applicationId), get$2('editor.hover', applicationId), get$2('editor.hoverDelay', applicationId), get$2('editor.horizontalVirtualizationThreshold', applicationId), get$2('editor.messageDelay', applicationId), isAutoClosingBracketsEnabled(applicationId), isAutoClosingQuotesEnabled(applicationId), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(applicationId), getLineNumbers(applicationId), getHighlightActiveLineNumber(applicationId), getRowHeight(applicationId), getTabSize(applicationId), getLetterSpacing(applicationId), getCompletionTriggerCharacters(), getMinimapEnabled(applicationId), getMergeConflictActionsEnabled(applicationId), get$2('editor.rtl', applicationId), get$2('breadcrumbs.enabled', applicationId), get$2('editor.extensionCodeLens', applicationId), get$2('editor.insertSpaces', applicationId), get$2('editor.dragAndDrop', applicationId), get$2('editor.roundedSelection', applicationId), get$2('editor.combineWhitespaceTokens', applicationId), get$2('editor.selectedTextOccurrenceMatching', applicationId), get$2('editor.disableMonospaceOptimizations', applicationId), get$2('editor.syntaxHighlightingCache', applicationId)]);
27215
27377
  return {
27216
27378
  breadcrumbsEnabled: breadcrumbsEnabled ?? false,
27379
+ codeLensEnabled: codeLensEnabled === true,
27217
27380
  combineWhitespaceTokens: combineWhitespaceTokens ?? true,
27218
27381
  completionTriggerCharacters,
27219
27382
  diagnosticsEnabled: diagnosticsEnabled ?? false,
@@ -27763,6 +27926,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
27763
27926
  } = state;
27764
27927
  const {
27765
27928
  breadcrumbsEnabled,
27929
+ codeLensEnabled,
27766
27930
  combineWhitespaceTokens,
27767
27931
  completionTriggerCharacters,
27768
27932
  diagnosticsEnabled,
@@ -27804,6 +27968,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
27804
27968
  ...state,
27805
27969
  breadcrumbsEnabled,
27806
27970
  charWidth,
27971
+ codeLensEnabled,
27807
27972
  combineWhitespaceTokens,
27808
27973
  completionTriggerCharacters,
27809
27974
  diagnosticsEnabled,
@@ -28078,10 +28243,10 @@ const renderLines = {
28078
28243
  visibleLineIndices,
28079
28244
  visibleViewLineIndices
28080
28245
  } = newState;
28081
- const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, newState.problemsHighlightedRow, diagnostics || [], newState.deltaX, newState.width, newState.charWidth, newState.tabSize, newState.lines, newState.horizontalVirtualizationThreshold, newState.horizontalVisibleRanges, newState.rtl);
28246
+ const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, newState.problemsHighlightedRow, diagnostics || [], newState.deltaX, newState.width, newState.charWidth, newState.tabSize, newState.lines, newState.horizontalVirtualizationThreshold, newState.horizontalVisibleRanges, newState.rtl, newState.codeLensRows);
28082
28247
  return [/* method */'setText', dom];
28083
28248
  },
28084
- isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.foldingRanges === newState.foldingRanges && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.diagnostics === newState.diagnostics && oldState.deltaX === newState.deltaX && oldState.charWidth === newState.charWidth && oldState.tabSize === newState.tabSize && oldState.rtl === newState.rtl && oldState.gutterWidth === newState.gutterWidth && oldState.horizontalVirtualizationThreshold === newState.horizontalVirtualizationThreshold && oldState.fontFamily === newState.fontFamily && oldState.fontSize === newState.fontSize && oldState.fontWeight === newState.fontWeight && oldState.letterSpacing === newState.letterSpacing && oldState.isMonospaceFont === newState.isMonospaceFont && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.debugEnabled === newState.debugEnabled
28249
+ isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.codeLensRows === newState.codeLensRows && oldState.foldingRanges === newState.foldingRanges && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.diagnostics === newState.diagnostics && oldState.deltaX === newState.deltaX && oldState.charWidth === newState.charWidth && oldState.tabSize === newState.tabSize && oldState.rtl === newState.rtl && oldState.gutterWidth === newState.gutterWidth && oldState.horizontalVirtualizationThreshold === newState.horizontalVirtualizationThreshold && oldState.fontFamily === newState.fontFamily && oldState.fontSize === newState.fontSize && oldState.fontWeight === newState.fontWeight && oldState.letterSpacing === newState.letterSpacing && oldState.isMonospaceFont === newState.isMonospaceFont && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.debugEnabled === newState.debugEnabled
28085
28250
  };
28086
28251
  const renderSelections = {
28087
28252
  apply: (oldState, newState) => {
@@ -28182,6 +28347,15 @@ const renderEditor = async id => {
28182
28347
 
28183
28348
  const renderEventListeners = () => {
28184
28349
  return [{
28350
+ name: HandleCodeLensClick,
28351
+ params: ['activateCodeLens', 'event.target.dataset.rowIndex', 'event.target.dataset.action'],
28352
+ preventDefault: true,
28353
+ stopPropagation: true
28354
+ }, {
28355
+ name: HandleCodeLensPointerDown,
28356
+ params: [],
28357
+ stopPropagation: true
28358
+ }, {
28185
28359
  name: HandleHoverMouseDown,
28186
28360
  params: [],
28187
28361
  stopPropagation: true
@@ -28584,6 +28758,7 @@ const commandMap = {
28584
28758
  'CodeGenerator.accept': codeGeneratorAccept,
28585
28759
  'ColorPicker.loadContent': loadContent$3,
28586
28760
  'Editor.acceptMergeConflict': wrapCommand(acceptMergeConflict),
28761
+ 'Editor.activateCodeLens': wrapCommand(activateCodeLens),
28587
28762
  'Editor.addCursorAbove': wrapCommand(addCursorAbove),
28588
28763
  'Editor.addCursorBelow': wrapCommand(addCursorBelow),
28589
28764
  'Editor.applyDocumentEdits': wrapCommand(applyDocumentEdits$1),
@@ -1986,9 +1986,14 @@ const getRenderedLineCount = (height, rowHeight, deltaY) => {
1986
1986
  };
1987
1987
 
1988
1988
  const toMergeConflictActionsRow = rowIndex => ~rowIndex;
1989
- const isMergeConflictActionsRow = viewRow => viewRow < 0;
1989
+
1990
+ // Merge conflict rows use the signed 32-bit range. Reserve a separate range for code lenses.
1991
+ const firstCodeLensRow = -4294967296;
1992
+ const isCodeLensRow = viewRow => viewRow <= firstCodeLensRow;
1993
+ const getCodeLensRowIndex = viewRow => firstCodeLensRow - viewRow;
1994
+ const isMergeConflictActionsRow = viewRow => viewRow < 0 && !isCodeLensRow(viewRow);
1990
1995
  const getMergeConflictRowIndex = viewRow => ~viewRow;
1991
- const getViewLineIndices = (lineCount, isRowHidden, mergeConflicts) => {
1996
+ const getViewLineIndices = (lineCount, isRowHidden, mergeConflicts, codeLensRows) => {
1992
1997
  const conflictStartRows = new Set(mergeConflicts.map(conflict => conflict.startRowIndex));
1993
1998
  const result = [];
1994
1999
  for (let rowIndex = 0; rowIndex < lineCount; rowIndex++) {
@@ -1998,6 +2003,9 @@ const getViewLineIndices = (lineCount, isRowHidden, mergeConflicts) => {
1998
2003
  if (conflictStartRows.has(rowIndex)) {
1999
2004
  result.push(toMergeConflictActionsRow(rowIndex));
2000
2005
  }
2006
+ if (codeLensRows?.[rowIndex]) {
2007
+ result.push(firstCodeLensRow - rowIndex);
2008
+ }
2001
2009
  result.push(rowIndex);
2002
2010
  }
2003
2011
  return result;
@@ -2006,7 +2014,7 @@ const getVisibleViewLineIndices = (viewLineIndices, startVisualRow, numberOfVisi
2006
2014
  return viewLineIndices.slice(startVisualRow, startVisualRow + numberOfVisibleLines);
2007
2015
  };
2008
2016
  const getVisibleLineIndices = visibleViewLineIndices => {
2009
- return visibleViewLineIndices.filter(viewRow => !isMergeConflictActionsRow(viewRow));
2017
+ return visibleViewLineIndices.filter(viewRow => viewRow >= 0);
2010
2018
  };
2011
2019
  const getVisualRowForDocumentRow$1 = (rowIndex, viewLineIndices) => {
2012
2020
  const visualRow = viewLineIndices.indexOf(rowIndex);
@@ -2017,6 +2025,9 @@ const getDocumentRowForVisualRow$1 = (visualRow, viewLineIndices) => {
2017
2025
  return visualRow;
2018
2026
  }
2019
2027
  const viewRow = viewLineIndices[visualRow];
2028
+ if (isCodeLensRow(viewRow)) {
2029
+ return getCodeLensRowIndex(viewRow);
2030
+ }
2020
2031
  return isMergeConflictActionsRow(viewRow) ? getMergeConflictRowIndex(viewRow) : viewRow;
2021
2032
  };
2022
2033
 
@@ -2206,16 +2217,16 @@ const updateLayout = (editor, foldingRanges) => {
2206
2217
  rowHeight
2207
2218
  } = editor;
2208
2219
  const mergeConflicts = editor.mergeConflictActionsEnabled ? getMergeConflicts(lines) : [];
2209
- const hasMergeConflictRows = mergeConflicts.length > 0;
2210
- const viewLineIndices = hasMergeConflictRows ? getViewLineIndices(lines.length, rowIndex => isRowHidden(rowIndex, foldingRanges), mergeConflicts) : [];
2211
- const visibleLineCount = hasMergeConflictRows ? viewLineIndices.length : getVisibleLineCount(lines.length, foldingRanges);
2220
+ const hasSyntheticRows = mergeConflicts.length > 0 || Boolean(editor.codeLensRows);
2221
+ const viewLineIndices = hasSyntheticRows ? getViewLineIndices(lines.length, rowIndex => isRowHidden(rowIndex, foldingRanges), mergeConflicts, editor.codeLensRows) : [];
2222
+ const visibleLineCount = hasSyntheticRows ? viewLineIndices.length : getVisibleLineCount(lines.length, foldingRanges);
2212
2223
  const finalY = Math.max(visibleLineCount - numberOfVisibleLines, 0);
2213
2224
  const finalDeltaY = Math.max(visibleLineCount * itemHeight - height, 0);
2214
2225
  const deltaY = clamp(editor.deltaY, 0, finalDeltaY);
2215
2226
  const startVisualRow = Math.floor(deltaY / itemHeight);
2216
2227
  const renderedLineCount = getRenderedLineCount(height, itemHeight, deltaY);
2217
- const visibleViewLineIndices = hasMergeConflictRows ? getVisibleViewLineIndices(viewLineIndices, startVisualRow, renderedLineCount) : getViewportLineIndices(lines.length, foldingRanges, startVisualRow, renderedLineCount);
2218
- const visibleLineIndices = hasMergeConflictRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
2228
+ const visibleViewLineIndices = hasSyntheticRows ? getVisibleViewLineIndices(viewLineIndices, startVisualRow, renderedLineCount) : getViewportLineIndices(lines.length, foldingRanges, startVisualRow, renderedLineCount);
2229
+ const visibleLineIndices = hasSyntheticRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
2219
2230
  const minLineY = visibleLineIndices[0] ?? 0;
2220
2231
  const maxLineY = visibleLineIndices.length === 0 ? 0 : visibleLineIndices.at(-1) + 1;
2221
2232
  const contentHeight = visibleLineCount * rowHeight;
@@ -12128,9 +12139,9 @@ const setDeltaY$1 = async (state, value) => {
12128
12139
  }
12129
12140
  const startVisualRow = Math.floor(newDeltaY / itemHeight);
12130
12141
  const renderedLineCount = getRenderedLineCount(height, itemHeight, newDeltaY);
12131
- const hasMergeConflictRows = state.viewLineIndices?.length > 0;
12132
- const visibleViewLineIndices = hasMergeConflictRows ? getVisibleViewLineIndices(state.viewLineIndices, startVisualRow, renderedLineCount) : getViewportLineIndices(state.lines.length, state.foldingRanges || [], startVisualRow, renderedLineCount);
12133
- const visibleLineIndices = hasMergeConflictRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
12142
+ const hasSyntheticRows = state.viewLineIndices?.length > 0;
12143
+ const visibleViewLineIndices = hasSyntheticRows ? getVisibleViewLineIndices(state.viewLineIndices, startVisualRow, renderedLineCount) : getViewportLineIndices(state.lines.length, state.foldingRanges || [], startVisualRow, renderedLineCount);
12144
+ const visibleLineIndices = hasSyntheticRows ? getVisibleLineIndices(visibleViewLineIndices) : visibleViewLineIndices;
12134
12145
  const minLineY = visibleLineIndices[0] ?? 0;
12135
12146
  const maxLineY = visibleLineIndices.length === 0 ? 0 : visibleLineIndices.at(-1) + 1;
12136
12147
  const newEditor1 = {
@@ -14155,6 +14166,14 @@ const updateColorPickerValue$1 = async (editor, value) => {
14155
14166
  };
14156
14167
  };
14157
14168
 
14169
+ const getDocument = editor => ({
14170
+ documentId: editor.id,
14171
+ languageId: editor.languageId,
14172
+ text: getText$1(editor),
14173
+ uri: editor.uri
14174
+ });
14175
+ const sameDocument = (left, right) => left.uri === right.uri && left.languageId === right.languageId && left.lines === right.lines && left.lifecycle === right.lifecycle;
14176
+
14158
14177
  const getTextDocument$2 = editor => ({
14159
14178
  documentId: editor.id || editor.uid,
14160
14179
  languageId: editor.languageId,
@@ -14774,8 +14793,15 @@ const mergeConflictsEqual$1 = (oldState, newState) => {
14774
14793
  };
14775
14794
  const updateDerivedState = async (oldState, newState, deferGutterDecorations = false) => {
14776
14795
  const horizontalState = oldState.initial || oldState.lines !== newState.lines || oldState.width !== newState.width || oldState.charWidth !== newState.charWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.rtl !== newState.rtl || oldState.tabSize !== newState.tabSize || oldState.lineNumbers !== newState.lineNumbers || oldState.breakPoints !== newState.breakPoints || oldState.gutterDecorations !== newState.gutterDecorations || oldState.lightBulbRowIndex !== newState.lightBulbRowIndex ? await updateHorizontalLayout(newState) : newState;
14777
- const layoutState = oldState.lines !== newState.lines && 'foldingRanges' in newState ? updateLayout(horizontalState, []) : horizontalState;
14778
- const nextState = mergeConflictsEqual$1(oldState, layoutState) ? layoutState : {
14796
+ const linesChanged = oldState.lines !== newState.lines;
14797
+ const clearCodeLenses = oldState.codeLensRows && (!newState.codeLensEnabled || !sameDocument(oldState, newState));
14798
+ const codeLensRows = clearCodeLenses ? undefined : horizontalState.codeLensRows;
14799
+ const codeLensRowsChanged = oldState.codeLensRows !== codeLensRows;
14800
+ const layoutState = (linesChanged || codeLensRowsChanged) && 'foldingRanges' in newState ? updateLayout({
14801
+ ...horizontalState,
14802
+ codeLensRows
14803
+ }, linesChanged ? [] : horizontalState.foldingRanges) : horizontalState;
14804
+ const nextState = !codeLensRowsChanged && mergeConflictsEqual$1(oldState, layoutState) ? layoutState : {
14779
14805
  ...layoutState,
14780
14806
  incrementalEdits: emptyIncrementalEdits
14781
14807
  };
@@ -15021,6 +15047,71 @@ const merge = (current, snapshot, result) => {
15021
15047
  };
15022
15048
  };
15023
15049
 
15050
+ const lensIds = {
15051
+ next: 0
15052
+ };
15053
+ const toRows = (result, lineCount) => {
15054
+ const rows = Object.create(null);
15055
+ for (const {
15056
+ extensionId,
15057
+ lenses,
15058
+ providerId
15059
+ } of result) {
15060
+ const validLenses = lenses.filter(lens => lens && Number.isSafeInteger(lens.rowIndex) && lens.rowIndex >= 0 && lens.rowIndex < lineCount && typeof lens.label === 'string');
15061
+ for (const lens of validLenses) {
15062
+ const row = rows[lens.rowIndex] ||= [];
15063
+ row.push({
15064
+ ...(typeof lens.action === 'string' && {
15065
+ action: lens.action
15066
+ }),
15067
+ extensionId,
15068
+ id: lensIds.next++,
15069
+ label: lens.label,
15070
+ providerId
15071
+ });
15072
+ }
15073
+ }
15074
+ return rows;
15075
+ };
15076
+ const request = async editor => {
15077
+ try {
15078
+ const result = await invoke$9(editor.applicationId, 'Extensions.executeCodeLensProviders', getDocument(editor));
15079
+ if (!Array.isArray(result) || result.length === 0) {
15080
+ return;
15081
+ }
15082
+ const codeLensRows = toRows(result, editor.lines.length);
15083
+ if (Object.keys(codeLensRows).length === 0) {
15084
+ return;
15085
+ }
15086
+ const committed = await enqueue(editor.uid, async () => {
15087
+ const current = get$9(editor.uid);
15088
+ if (!current?.newState.codeLensEnabled || !sameDocument(editor, current.newState)) {
15089
+ return false;
15090
+ }
15091
+ const nextState = await updateDerivedState(current.newState, {
15092
+ ...current.newState,
15093
+ codeLensRows
15094
+ });
15095
+ const latest = get$9(editor.uid);
15096
+ if (!latest || latest.newState !== current.newState || editor.lifecycle?.disposed) {
15097
+ return false;
15098
+ }
15099
+ set$b(editor.uid, latest.oldState, nextState);
15100
+ return true;
15101
+ });
15102
+ if (committed) {
15103
+ await invoke$7('Editor.renderPending', editor.uid);
15104
+ }
15105
+ } catch {
15106
+ // Code lenses are optional and should never interrupt editing.
15107
+ }
15108
+ };
15109
+ const requestIfChanged = (oldState, newState) => {
15110
+ if (newState.codeLensEnabled && !newState.initial && !newState.largeFile && !newState.loadError && (oldState.initial || !oldState.codeLensEnabled || !sameDocument(oldState, newState))) {
15111
+ void request(newState);
15112
+ }
15113
+ };
15114
+
15024
15115
  class Diff {
15025
15116
  diff(oldStr, newStr,
15026
15117
  // Type below is not accurate/complete - see above for full possibilities - but it compiles
@@ -16214,6 +16305,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
16214
16305
  if (editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
16215
16306
  void editorDiagnosticEffect.apply(newEditorWithDerivedState);
16216
16307
  }
16308
+ requestIfChanged(state, newEditorWithDerivedState);
16217
16309
  const finalEditor = newEditorWithDerivedState;
16218
16310
  if (deferGutterDecorations) {
16219
16311
  schedule(finalEditor);
@@ -16250,6 +16342,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
16250
16342
  continue;
16251
16343
  }
16252
16344
  set$b(otherUid, latest.oldState, synchronizedEditor);
16345
+ requestIfChanged(editor, synchronizedEditor);
16253
16346
  if (deferGutterDecorations) {
16254
16347
  schedule(synchronizedEditor);
16255
16348
  }
@@ -17655,6 +17748,30 @@ const updateAutomaticCompletion = async editor => {
17655
17748
  return openCompletion(editor, true);
17656
17749
  };
17657
17750
 
17751
+ const activateCodeLens = async (state, rowIndex, lensId) => {
17752
+ const {
17753
+ applicationId,
17754
+ codeLensEnabled,
17755
+ codeLensRows
17756
+ } = state;
17757
+ const lens = codeLensRows?.[Number(rowIndex)]?.find(({
17758
+ id
17759
+ }) => id === Number(lensId));
17760
+ if (!codeLensEnabled || !lens?.action) {
17761
+ return state;
17762
+ }
17763
+ const document = getDocument(state);
17764
+ try {
17765
+ const edit = await invoke$9(applicationId, 'Extensions.resolveCodeLens', document, lens.extensionId, lens.providerId, lens.action);
17766
+ if (!edit || !Number.isSafeInteger(edit.offset) || !Number.isSafeInteger(edit.deleted) || edit.offset < 0 || edit.deleted < 0 || edit.offset + edit.deleted > document.text.length || typeof edit.inserted !== 'string' || /[\r\n]/.test(edit.inserted)) {
17767
+ return state;
17768
+ }
17769
+ return await scheduleDocumentAndCursorsSelections(state, getTextChanges(state, [edit]));
17770
+ } catch {
17771
+ return state;
17772
+ }
17773
+ };
17774
+
17658
17775
  const getAcceptedLines = (lines, conflict, action) => {
17659
17776
  const current = lines.slice(conflict.currentStartRowIndex, conflict.currentEndRowIndex);
17660
17777
  const incoming = lines.slice(conflict.incomingStartRowIndex, conflict.incomingEndRowIndex);
@@ -24814,6 +24931,8 @@ const HandleMergeConflictActionsMouseDown = 37;
24814
24931
  const HandleMouseOut = 38;
24815
24932
  const HandleMouseOver = 39;
24816
24933
  const HandleHoverMouseDown = 40;
24934
+ const HandleCodeLensClick = 41;
24935
+ const HandleCodeLensPointerDown = 42;
24817
24936
 
24818
24937
  const getLineInfoVirtualDom = lineInfo => {
24819
24938
  const dom = [{
@@ -25093,6 +25212,7 @@ ${editorSelector} .GutterRows {
25093
25212
  display: flex;
25094
25213
  flex-direction: column;
25095
25214
  }
25215
+ ${editorSelector} .EditorCodeLenses,
25096
25216
  ${editorSelector} .MergeConflictActions,
25097
25217
  ${editorSelector} .MergeConflictActionsGutter {
25098
25218
  box-sizing: border-box;
@@ -25100,6 +25220,7 @@ ${editorSelector} .MergeConflictActionsGutter {
25100
25220
  height: var(--EditorRowHeight);
25101
25221
  line-height: var(--EditorRowHeight);
25102
25222
  }
25223
+ ${editorSelector} .EditorCodeLenses,
25103
25224
  ${editorSelector} .MergeConflictActions {
25104
25225
  align-items: center;
25105
25226
  display: flex;
@@ -25107,6 +25228,7 @@ ${editorSelector} .MergeConflictActions {
25107
25228
  padding-left: 4px;
25108
25229
  user-select: none;
25109
25230
  }
25231
+ ${editorSelector} .EditorCodeLensAction,
25110
25232
  ${editorSelector} .MergeConflictAction {
25111
25233
  appearance: none;
25112
25234
  background: none;
@@ -25116,6 +25238,8 @@ ${editorSelector} .MergeConflictAction {
25116
25238
  font: inherit;
25117
25239
  padding: 0;
25118
25240
  }
25241
+ ${editorSelector} .EditorCodeLensAction:hover,
25242
+ ${editorSelector} .EditorCodeLensAction:focus-visible,
25119
25243
  ${editorSelector} .MergeConflictAction:hover,
25120
25244
  ${editorSelector} .MergeConflictAction:focus-visible {
25121
25245
  color: var(--TextLinkActiveForeground, #4daafc);
@@ -25642,13 +25766,46 @@ const addMergeConflictActions = (dom, rowIndex) => {
25642
25766
  }, text(label));
25643
25767
  }
25644
25768
  };
25645
- const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1, diagnostics = [], deltaX = 0, width = Infinity, charWidth = 1, tabSize = 2, lines = [], horizontalVirtualizationThreshold = 500, horizontalVisibleRanges = [], rtl = false) => {
25769
+ const addCodeLenses = (dom, codeLensRows, rowIndex) => {
25770
+ const lenses = codeLensRows[rowIndex] ?? [];
25771
+ dom.push({
25772
+ childCount: lenses.length,
25773
+ className: 'EditorCodeLenses',
25774
+ onMouseDown: HandleHoverMouseDown,
25775
+ onPointerDown: HandleCodeLensPointerDown,
25776
+ type: Div
25777
+ });
25778
+ for (const {
25779
+ action,
25780
+ id,
25781
+ label
25782
+ } of lenses) {
25783
+ dom.push(action ? {
25784
+ childCount: 1,
25785
+ className: 'EditorCodeLensAction',
25786
+ 'data-action': String(id),
25787
+ 'data-rowIndex': rowIndex,
25788
+ onClick: HandleCodeLensClick,
25789
+ title: label,
25790
+ type: Button$1
25791
+ } : {
25792
+ childCount: 1,
25793
+ title: label,
25794
+ type: Span
25795
+ }, text(label));
25796
+ }
25797
+ };
25798
+ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1, diagnostics = [], deltaX = 0, width = Infinity, charWidth = 1, tabSize = 2, lines = [], horizontalVirtualizationThreshold = 500, horizontalVisibleRanges = [], rtl = false, codeLensRows = {}) => {
25646
25799
  const dom = [];
25647
25800
  const actualViewRows = visibleViewLineIndices.length === 0 ? Array.from({
25648
25801
  length: textInfos.length
25649
25802
  }, (_, index) => visibleLineIndices[index] ?? index) : visibleViewLineIndices;
25650
25803
  let textInfoIndex = 0;
25651
25804
  for (const viewRow of actualViewRows) {
25805
+ if (isCodeLensRow(viewRow)) {
25806
+ addCodeLenses(dom, codeLensRows, getCodeLensRowIndex(viewRow));
25807
+ continue;
25808
+ }
25652
25809
  if (isMergeConflictActionsRow(viewRow)) {
25653
25810
  addMergeConflictActions(dom, getMergeConflictRowIndex(viewRow));
25654
25811
  continue;
@@ -25730,8 +25887,8 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
25730
25887
  return dom;
25731
25888
  };
25732
25889
 
25733
- const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, rtl = false) => {
25734
- const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, 0, Infinity, 1, tabSize, lines, 500, horizontalVisibleRanges, rtl);
25890
+ const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, rtl = false, codeLensRows) => {
25891
+ const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, 0, Infinity, 1, tabSize, lines, 500, horizontalVisibleRanges, rtl, codeLensRows);
25735
25892
  return [{
25736
25893
  childCount: visibleViewLineIndices.length || textInfos.length,
25737
25894
  className: 'EditorRows',
@@ -25828,8 +25985,8 @@ const editorLayersNode = {
25828
25985
  className: 'EditorLayers',
25829
25986
  type: Div
25830
25987
  };
25831
- const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = [], problemsHighlightedRow = -1, roundedSelection = false, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, textDecorationDom = [], rtl = false) => {
25832
- return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused, roundedSelection), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, rtl), ...getEditorCursorsVirtualDom(cursorInfos, focused), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos, textDecorationDom)];
25988
+ const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = [], problemsHighlightedRow = -1, roundedSelection = false, unnecessaryDiagnostics = [], horizontalVisibleRanges = [], lines = [], tabSize = 2, textDecorationDom = [], rtl = false, codeLensRows) => {
25989
+ return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused, roundedSelection), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, rtl, codeLensRows), ...getEditorCursorsVirtualDom(cursorInfos, focused), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos, textDecorationDom)];
25833
25990
  };
25834
25991
 
25835
25992
  const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
@@ -25899,6 +26056,7 @@ const editorContentNode = {
25899
26056
  const getEditorContentVirtualDom = ({
25900
26057
  bracketMatchInfos = [],
25901
26058
  breadcrumbsEnabled = false,
26059
+ codeLensRows,
25902
26060
  cursorInfos = [],
25903
26061
  diagnostics = [],
25904
26062
  differences,
@@ -25926,7 +26084,7 @@ const getEditorContentVirtualDom = ({
25926
26084
  return [{
25927
26085
  ...editorContentNode,
25928
26086
  className: breadcrumbsEnabled ? 'EditorContent EditorBreadcrumbsOffset' : 'EditorContent'
25929
- }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom, rtl), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth, scrollBarLeft)];
26087
+ }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom, rtl, codeLensRows), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth, scrollBarLeft)];
25930
26088
  };
25931
26089
 
25932
26090
  const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
@@ -26069,6 +26227,7 @@ const getEditorVirtualDom = ({
26069
26227
  breadcrumbFileIcon = '',
26070
26228
  breadcrumbsEnabled = false,
26071
26229
  breakPoints = [],
26230
+ codeLensRows,
26072
26231
  combineWhitespaceTokens: combineWhitespaceTokens$1 = false,
26073
26232
  cursorInfos = [],
26074
26233
  diagnostics: fallbackDiagnostics = [],
@@ -26152,6 +26311,9 @@ const getEditorVirtualDom = ({
26152
26311
  }, ...breadcrumbsDom, ...gutterDom, ...getEditorContentVirtualDom({
26153
26312
  bracketMatchInfos,
26154
26313
  breadcrumbsEnabled,
26314
+ ...(codeLensRows && {
26315
+ codeLensRows
26316
+ }),
26155
26317
  cursorInfos,
26156
26318
  diagnostics,
26157
26319
  differences,
@@ -26278,7 +26440,7 @@ const canRenderPlainTextAppend = (oldState, newState) => {
26278
26440
  if (oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
26279
26441
  return false;
26280
26442
  }
26281
- if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.deltaX !== newState.deltaX || oldState.gutterWidth !== newState.gutterWidth || (newState.deltaX ?? 0) !== 0 && oldState.longestLineWidth !== newState.longestLineWidth || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(getHorizontalScrollDimensions(oldState).width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(getHorizontalScrollDimensions(newState).width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
26443
+ if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.deltaX !== newState.deltaX || oldState.gutterWidth !== newState.gutterWidth || (newState.deltaX ?? 0) !== 0 && oldState.longestLineWidth !== newState.longestLineWidth || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(getHorizontalScrollDimensions(oldState).width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(getHorizontalScrollDimensions(newState).width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || Boolean(oldState.codeLensRows) || Boolean(newState.codeLensRows) || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
26282
26444
  return false;
26283
26445
  }
26284
26446
  return true;
@@ -26923,7 +27085,7 @@ const getKeyBindings = () => {
26923
27085
  key: Home,
26924
27086
  when: FocusEditorCompletions
26925
27087
  }, {
26926
- command: 'EditorCompletion.toggleDetails',
27088
+ command: 'Editor.openCompletion',
26927
27089
  key: CtrlCmd | Space$1,
26928
27090
  when: FocusEditorCompletions
26929
27091
  }, {
@@ -27223,7 +27385,7 @@ const getKeyBindings = () => {
27223
27385
  key: Alt$1 | Shift | LeftArrow,
27224
27386
  when: FocusEditor
27225
27387
  }, {
27226
- command: 'Editor.showSignatureHelp',
27388
+ command: 'Editor.selectionGrow',
27227
27389
  key: CtrlCmd | Shift | Space$1,
27228
27390
  when: FocusEditorText
27229
27391
  }];
@@ -27662,9 +27824,10 @@ const getHorizontalVirtualizationThreshold = value => {
27662
27824
  return Math.floor(threshold);
27663
27825
  };
27664
27826
  const getEditorPreferences = async applicationId => {
27665
- const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, formatActions, hoverEnabled, hoverDelay, horizontalVirtualizationThreshold, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, rtl, breadcrumbsEnabled, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens, selectedTextOccurrenceMatching, disableMonospaceOptimizations, syntaxHighlightingCacheEnabled] = await Promise.all([get$2('editor.diagnostics', applicationId), getFontFamily(applicationId), getFontSize(applicationId), getFontWeight(applicationId), get$2('editor.formatOnSave', applicationId), get$2('editor.formatActions', applicationId), get$2('editor.hover', applicationId), get$2('editor.hoverDelay', applicationId), get$2('editor.horizontalVirtualizationThreshold', applicationId), get$2('editor.messageDelay', applicationId), isAutoClosingBracketsEnabled(applicationId), isAutoClosingQuotesEnabled(applicationId), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(applicationId), getLineNumbers(applicationId), getHighlightActiveLineNumber(applicationId), getRowHeight(applicationId), getTabSize(applicationId), getLetterSpacing(applicationId), getCompletionTriggerCharacters(), getMinimapEnabled(applicationId), getMergeConflictActionsEnabled(applicationId), get$2('editor.rtl', applicationId), get$2('breadcrumbs.enabled', applicationId), get$2('editor.insertSpaces', applicationId), get$2('editor.dragAndDrop', applicationId), get$2('editor.roundedSelection', applicationId), get$2('editor.combineWhitespaceTokens', applicationId), get$2('editor.selectedTextOccurrenceMatching', applicationId), get$2('editor.disableMonospaceOptimizations', applicationId), get$2('editor.syntaxHighlightingCache', applicationId)]);
27827
+ const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, formatActions, hoverEnabled, hoverDelay, horizontalVirtualizationThreshold, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, rtl, breadcrumbsEnabled, codeLensEnabled, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens, selectedTextOccurrenceMatching, disableMonospaceOptimizations, syntaxHighlightingCacheEnabled] = await Promise.all([get$2('editor.diagnostics', applicationId), getFontFamily(applicationId), getFontSize(applicationId), getFontWeight(applicationId), get$2('editor.formatOnSave', applicationId), get$2('editor.formatActions', applicationId), get$2('editor.hover', applicationId), get$2('editor.hoverDelay', applicationId), get$2('editor.horizontalVirtualizationThreshold', applicationId), get$2('editor.messageDelay', applicationId), isAutoClosingBracketsEnabled(applicationId), isAutoClosingQuotesEnabled(applicationId), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(applicationId), getLineNumbers(applicationId), getHighlightActiveLineNumber(applicationId), getRowHeight(applicationId), getTabSize(applicationId), getLetterSpacing(applicationId), getCompletionTriggerCharacters(), getMinimapEnabled(applicationId), getMergeConflictActionsEnabled(applicationId), get$2('editor.rtl', applicationId), get$2('breadcrumbs.enabled', applicationId), get$2('editor.extensionCodeLens', applicationId), get$2('editor.insertSpaces', applicationId), get$2('editor.dragAndDrop', applicationId), get$2('editor.roundedSelection', applicationId), get$2('editor.combineWhitespaceTokens', applicationId), get$2('editor.selectedTextOccurrenceMatching', applicationId), get$2('editor.disableMonospaceOptimizations', applicationId), get$2('editor.syntaxHighlightingCache', applicationId)]);
27666
27828
  return {
27667
27829
  breadcrumbsEnabled: breadcrumbsEnabled ?? false,
27830
+ codeLensEnabled: codeLensEnabled === true,
27668
27831
  combineWhitespaceTokens: combineWhitespaceTokens ?? true,
27669
27832
  completionTriggerCharacters,
27670
27833
  diagnosticsEnabled: diagnosticsEnabled ?? false,
@@ -28214,6 +28377,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
28214
28377
  } = state;
28215
28378
  const {
28216
28379
  breadcrumbsEnabled,
28380
+ codeLensEnabled,
28217
28381
  combineWhitespaceTokens,
28218
28382
  completionTriggerCharacters,
28219
28383
  diagnosticsEnabled,
@@ -28255,6 +28419,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
28255
28419
  ...state,
28256
28420
  breadcrumbsEnabled,
28257
28421
  charWidth,
28422
+ codeLensEnabled,
28258
28423
  combineWhitespaceTokens,
28259
28424
  completionTriggerCharacters,
28260
28425
  diagnosticsEnabled,
@@ -28529,10 +28694,10 @@ const renderLines = {
28529
28694
  visibleLineIndices,
28530
28695
  visibleViewLineIndices
28531
28696
  } = newState;
28532
- const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, newState.problemsHighlightedRow, diagnostics || [], newState.deltaX, newState.width, newState.charWidth, newState.tabSize, newState.lines, newState.horizontalVirtualizationThreshold, newState.horizontalVisibleRanges, newState.rtl);
28697
+ const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, newState.problemsHighlightedRow, diagnostics || [], newState.deltaX, newState.width, newState.charWidth, newState.tabSize, newState.lines, newState.horizontalVirtualizationThreshold, newState.horizontalVisibleRanges, newState.rtl, newState.codeLensRows);
28533
28698
  return [/* method */'setText', dom];
28534
28699
  },
28535
- isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.foldingRanges === newState.foldingRanges && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.diagnostics === newState.diagnostics && oldState.deltaX === newState.deltaX && oldState.charWidth === newState.charWidth && oldState.tabSize === newState.tabSize && oldState.rtl === newState.rtl && oldState.gutterWidth === newState.gutterWidth && oldState.horizontalVirtualizationThreshold === newState.horizontalVirtualizationThreshold && oldState.fontFamily === newState.fontFamily && oldState.fontSize === newState.fontSize && oldState.fontWeight === newState.fontWeight && oldState.letterSpacing === newState.letterSpacing && oldState.isMonospaceFont === newState.isMonospaceFont && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.debugEnabled === newState.debugEnabled
28700
+ isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.codeLensRows === newState.codeLensRows && oldState.foldingRanges === newState.foldingRanges && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.diagnostics === newState.diagnostics && oldState.deltaX === newState.deltaX && oldState.charWidth === newState.charWidth && oldState.tabSize === newState.tabSize && oldState.rtl === newState.rtl && oldState.gutterWidth === newState.gutterWidth && oldState.horizontalVirtualizationThreshold === newState.horizontalVirtualizationThreshold && oldState.fontFamily === newState.fontFamily && oldState.fontSize === newState.fontSize && oldState.fontWeight === newState.fontWeight && oldState.letterSpacing === newState.letterSpacing && oldState.isMonospaceFont === newState.isMonospaceFont && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.debugEnabled === newState.debugEnabled
28536
28701
  };
28537
28702
  const renderSelections = {
28538
28703
  apply: (oldState, newState) => {
@@ -28633,6 +28798,15 @@ const renderEditor = async id => {
28633
28798
 
28634
28799
  const renderEventListeners = () => {
28635
28800
  return [{
28801
+ name: HandleCodeLensClick,
28802
+ params: ['activateCodeLens', 'event.target.dataset.rowIndex', 'event.target.dataset.action'],
28803
+ preventDefault: true,
28804
+ stopPropagation: true
28805
+ }, {
28806
+ name: HandleCodeLensPointerDown,
28807
+ params: [],
28808
+ stopPropagation: true
28809
+ }, {
28636
28810
  name: HandleHoverMouseDown,
28637
28811
  params: [],
28638
28812
  stopPropagation: true
@@ -29032,6 +29206,7 @@ const commandMap = {
29032
29206
  'CodeGenerator.accept': codeGeneratorAccept,
29033
29207
  'ColorPicker.loadContent': loadContent$3,
29034
29208
  'Editor.acceptMergeConflict': wrapCommand(acceptMergeConflict),
29209
+ 'Editor.activateCodeLens': wrapCommand(activateCodeLens),
29035
29210
  'Editor.addCursorAbove': wrapCommand(addCursorAbove),
29036
29211
  'Editor.addCursorBelow': wrapCommand(addCursorBelow),
29037
29212
  'Editor.applyDocumentEdits': wrapCommand(applyDocumentEdits$1),
@@ -158,6 +158,14 @@
158
158
  "type": "enum",
159
159
  "value": "on"
160
160
  },
161
+ {
162
+ "category": "text-editor",
163
+ "description": "Show information and actions above lines, including dependency version hints from Version Lens",
164
+ "heading": "Extension Code Lens",
165
+ "id": "editor.extensionCodeLens",
166
+ "type": "boolean",
167
+ "value": false
168
+ },
161
169
  {
162
170
  "category": "text-editor",
163
171
  "description": "Controls whether actions for accepting merge conflict changes are shown in the editor",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.79.2",
3
+ "version": "19.80.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"