@codingame/monaco-vscode-notebook-service-override 15.0.2 → 16.0.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.
Files changed (84) hide show
  1. package/index.js +5 -11
  2. package/package.json +27 -26
  3. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css +6 -0
  4. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +10 -10
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +22 -22
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +1 -0
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +7 -3
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +5 -5
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +7 -3
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +7 -7
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +12 -3
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +10 -10
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css +17 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +4 -4
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +5 -5
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +2 -2
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +6 -6
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +14 -14
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +1 -1
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +1 -1
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +2 -2
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +2 -2
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +10 -10
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +13 -13
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +3 -3
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +28 -28
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +54 -31
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +25 -25
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +26 -26
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +25 -25
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +18 -18
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +7 -7
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +2 -2
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +22 -22
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +72 -74
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +11 -11
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +1 -1
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +2 -2
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +1 -1
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +3 -3
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +54 -12
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +4 -3
  51. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +2 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +42 -1
  53. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +10 -2
  54. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.d.ts +15 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +173 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/common/services/{notebookSimpleWorker.d.ts → notebookWebWorker.d.ts} +24 -6
  57. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +366 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain.js +5 -0
  59. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
  60. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +1 -1
  61. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +2 -2
  62. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +1 -1
  63. package/worker.js +1 -1
  64. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/contribution.js +0 -10
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.d.ts +0 -24
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.js +0 -332
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.d.ts +0 -23
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.js +0 -299
  70. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.d.ts +0 -9
  71. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.js +0 -179
  72. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.d.ts +0 -21
  73. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.js +0 -42
  74. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.d.ts +0 -25
  75. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.js +0 -77
  76. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.d.ts +0 -64
  77. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.js +0 -443
  78. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.d.ts +0 -20
  79. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.js +0 -86
  80. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
  81. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +0 -279
  82. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.d.ts +0 -1
  83. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.js +0 -5
  84. /package/vscode/src/vs/workbench/contrib/notebook/{browser/contrib/chatEdit/contribution.d.ts → common/services/notebookWebWorkerMain.d.ts} +0 -0
@@ -48,8 +48,8 @@ import { IProgressService } from '@codingame/monaco-vscode-api/vscode/vs/platfor
48
48
  var FileWorkingCopyManager_1;
49
49
  let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
50
50
  static { FileWorkingCopyManager_1 = this; }
51
- static { this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyCreate.source', ( localize(12443, "File Created"))); }
52
- static { this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyReplace.source', ( localize(12444, "File Replaced"))); }
51
+ static { this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyCreate.source', ( localize(12778, "File Created"))); }
52
+ static { this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource('fileWorkingCopyReplace.source', ( localize(12779, "File Replaced"))); }
53
53
  constructor(workingCopyTypeId, storedWorkingCopyModelFactory, untitledWorkingCopyModelFactory, fileService, lifecycleService, labelService, logService, workingCopyFileService, workingCopyBackupService, uriIdentityService, fileDialogService, filesConfigurationService, workingCopyService, notificationService, workingCopyEditorService, editorService, elevatedFileService, pathService, environmentService, dialogService, decorationsService, progressService) {
54
54
  super();
55
55
  this.workingCopyTypeId = workingCopyTypeId;
@@ -104,7 +104,7 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
104
104
  constructor(stored) {
105
105
  super();
106
106
  this.stored = stored;
107
- this.label = ( localize(12445, "File Working Copy Decorations"));
107
+ this.label = ( localize(12780, "File Working Copy Decorations"));
108
108
  this._onDidChange = this._register(( new Emitter()));
109
109
  this.onDidChange = this._onDidChange.event;
110
110
  this.registerListeners();
@@ -131,20 +131,20 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
131
131
  color: listErrorForeground,
132
132
  letter: Codicon.lockSmall,
133
133
  strikethrough: true,
134
- tooltip: ( localize(12446, "Deleted, Read-only")),
134
+ tooltip: ( localize(12781, "Deleted, Read-only")),
135
135
  };
136
136
  }
137
137
  else if (isReadonly) {
138
138
  return {
139
139
  letter: Codicon.lockSmall,
140
- tooltip: ( localize(12447, "Read-only")),
140
+ tooltip: ( localize(12782, "Read-only")),
141
141
  };
142
142
  }
143
143
  else if (isOrphaned) {
144
144
  return {
145
145
  color: listErrorForeground,
146
146
  strikethrough: true,
147
- tooltip: ( localize(12448, "Deleted")),
147
+ tooltip: ( localize(12783, "Deleted")),
148
148
  };
149
149
  }
150
150
  return undefined;
@@ -279,17 +279,17 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
279
279
  const { confirmed } = await this.dialogService.confirm({
280
280
  type: 'warning',
281
281
  message: ( localize(
282
- 12449,
282
+ 12784,
283
283
  "'{0}' already exists. Do you want to replace it?",
284
284
  basename(resource)
285
285
  )),
286
286
  detail: ( localize(
287
- 12450,
287
+ 12785,
288
288
  "A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
289
289
  basename(resource),
290
290
  basename(dirname(resource))
291
291
  )),
292
- primaryButton: ( localize(12451, "&&Replace"))
292
+ primaryButton: ( localize(12786, "&&Replace"))
293
293
  });
294
294
  return confirmed;
295
295
  }
@@ -297,12 +297,12 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
297
297
  const { confirmed } = await this.dialogService.confirm({
298
298
  type: 'warning',
299
299
  message: ( localize(
300
- 12452,
300
+ 12787,
301
301
  "'{0}' is marked as read-only. Do you want to save anyway?",
302
302
  basename(resource)
303
303
  )),
304
- detail: ( localize(12453, "Paths can be configured as read-only via settings.")),
305
- primaryButton: ( localize(12454, "&&Save Anyway"))
304
+ detail: ( localize(12788, "Paths can be configured as read-only via settings.")),
305
+ primaryButton: ( localize(12789, "&&Save Anyway"))
306
306
  });
307
307
  return confirmed;
308
308
  }
@@ -78,7 +78,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
78
78
  this._register(this.lifecycleService.onBeforeShutdown(event => event.veto(this.onBeforeShutdownWeb(), 'veto.fileWorkingCopyManager')));
79
79
  }
80
80
  else {
81
- this._register(this.lifecycleService.onWillShutdown(event => event.join(this.onWillShutdownDesktop(), { id: 'join.fileWorkingCopyManager', label: ( localize(12472, "Saving working copies")) })));
81
+ this._register(this.lifecycleService.onWillShutdown(event => event.join(this.onWillShutdownDesktop(), { id: 'join.fileWorkingCopyManager', label: ( localize(12807, "Saving working copies")) })));
82
82
  }
83
83
  }
84
84
  onBeforeShutdownWeb() {
@@ -1,6 +1,6 @@
1
1
  import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
2
2
  import { VSBufferReadableStream } from "@codingame/monaco-vscode-api/vscode/vs/base/common/buffer";
3
- import { IWorkingCopyBackup, IWorkingCopySaveEvent } from "@codingame/monaco-vscode-86d65fc6-30f9-5dca-9501-e249de688591-common/vscode/vs/workbench/services/workingCopy/common/workingCopy";
3
+ import { IWorkingCopyBackup, IWorkingCopySaveEvent, WorkingCopyCapabilities } from "@codingame/monaco-vscode-86d65fc6-30f9-5dca-9501-e249de688591-common/vscode/vs/workbench/services/workingCopy/common/workingCopy";
4
4
  import { IFileWorkingCopy, IFileWorkingCopyModel, IFileWorkingCopyModelFactory } from "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy";
5
5
  import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
6
6
  import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
@@ -42,7 +42,7 @@ export declare class UntitledFileWorkingCopy<M extends IUntitledFileWorkingCopyM
42
42
  private readonly saveDelegate;
43
43
  private readonly workingCopyBackupService;
44
44
  private readonly logService;
45
- readonly capabilities: number;
45
+ readonly capabilities: WorkingCopyCapabilities;
46
46
  private _model;
47
47
  get model(): M | undefined;
48
48
  private readonly _onDidChangeContent;
@@ -25,7 +25,6 @@ let UntitledFileWorkingCopy = class UntitledFileWorkingCopy extends Disposable {
25
25
  this.saveDelegate = saveDelegate;
26
26
  this.workingCopyBackupService = workingCopyBackupService;
27
27
  this.logService = logService;
28
- this.capabilities = this.isScratchpad ? WorkingCopyCapabilities.Untitled | WorkingCopyCapabilities.Scratchpad : WorkingCopyCapabilities.Untitled;
29
28
  this._model = undefined;
30
29
  this._onDidChangeContent = this._register(( new Emitter()));
31
30
  this.onDidChangeContent = this._onDidChangeContent.event;
@@ -37,6 +36,7 @@ let UntitledFileWorkingCopy = class UntitledFileWorkingCopy extends Disposable {
37
36
  this.onDidRevert = this._onDidRevert.event;
38
37
  this._onWillDispose = this._register(( new Emitter()));
39
38
  this.onWillDispose = this._onWillDispose.event;
39
+ this.capabilities = this.isScratchpad ? WorkingCopyCapabilities.Untitled | WorkingCopyCapabilities.Scratchpad : WorkingCopyCapabilities.Untitled;
40
40
  this.modified = this.hasAssociatedFilePath || Boolean(this.initialContents && this.initialContents.markModified !== false);
41
41
  this._register(workingCopyService.registerWorkingCopy(this));
42
42
  }
package/worker.js CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- import './vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.js';
2
+ import './vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain.js';
@@ -1,6 +0,0 @@
1
- import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
2
-
3
- var css = ".monaco-editor .contentWidgets .empty-editor-hint{color:var(--vscode-input-placeholderForeground)}.monaco-editor .contentWidgets .empty-editor-hint a{color:var(--vscode-textLink-foreground)}";
4
- n(css,{});
5
-
6
- export { css, css as default };
@@ -1,10 +0,0 @@
1
-
2
- import './notebookSynchronizer.js';
3
- import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
4
- import './notebookOriginalModelRefFactory.js';
5
- import { registerNotebookContribution } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
6
- import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
7
- import './notebookOriginalCellModelFactory.js';
8
- import { NotebookChatEditorControllerContrib } from './notebookChatEditController.js';
9
-
10
- registerNotebookContribution(NotebookChatEditorControllerContrib.ID, NotebookChatEditorControllerContrib);
@@ -1,24 +0,0 @@
1
- import { DisposableStore } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service";
3
- import { INotebookEditor } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
4
- import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
5
- import { IEditorWorkerService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service";
6
- import { NotebookCellTextModel } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel";
7
- import { INotebookOriginalCellModelFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.service";
8
- export declare class NotebookCellDiffDecorator extends DisposableStore {
9
- readonly modifiedCell: NotebookCellTextModel;
10
- readonly originalCell: NotebookCellTextModel;
11
- private readonly _chatEditingService;
12
- private readonly _editorWorkerService;
13
- private readonly originalCellModelFactory;
14
- private _viewZones;
15
- private readonly throttledDecorator;
16
- private diffForPreviouslyAppliedDecorators?;
17
- private readonly perEditorDisposables;
18
- constructor(notebookEditor: INotebookEditor, modifiedCell: NotebookCellTextModel, originalCell: NotebookCellTextModel, _chatEditingService: IChatEditingService, _editorWorkerService: IEditorWorkerService, originalCellModelFactory: INotebookOriginalCellModelFactory);
19
- update(editor: ICodeEditor): void;
20
- private _updateImpl;
21
- private _originalModel?;
22
- private getOrCreateOriginalModel;
23
- private _updateWithDiff;
24
- }
@@ -1,332 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
5
- import { ChatEditingSessionState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
6
- import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
7
- import { ThrottledDelayer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
8
- import { IEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service';
9
- import { EditorOption } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/config/editorOptions';
10
- import { themeColorFromId } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
11
- import { RenderOptions, LineSource, renderLines } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines';
12
- import { diffAddDecoration, diffWholeLineAddDecoration, diffDeleteDecoration } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/registrations.contribution';
13
- import { TrackedRangeStickiness, MinimapPosition, OverviewRulerLane } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
14
- import { ModelDecorationOptions } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model/textModel';
15
- import { InlineDecoration, InlineDecorationType } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/viewModel';
16
- import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
17
- import { INotebookOriginalCellModelFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.service';
18
- import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
19
- import { overviewRulerModifiedForeground, minimapGutterModifiedBackground, overviewRulerAddedForeground, minimapGutterAddedBackground, overviewRulerDeletedForeground, minimapGutterDeletedBackground } from '@codingame/monaco-vscode-1bb39316-6fbf-572e-ab6a-818a2496c14f-common/vscode/vs/workbench/contrib/scm/common/quickDiff';
20
- import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
21
- import { autorunWithStore, autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
22
- import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
23
-
24
- let NotebookCellDiffDecorator = class NotebookCellDiffDecorator extends DisposableStore {
25
- constructor(notebookEditor, modifiedCell, originalCell, _chatEditingService, _editorWorkerService, originalCellModelFactory) {
26
- super();
27
- this.modifiedCell = modifiedCell;
28
- this.originalCell = originalCell;
29
- this._chatEditingService = _chatEditingService;
30
- this._editorWorkerService = _editorWorkerService;
31
- this.originalCellModelFactory = originalCellModelFactory;
32
- this._viewZones = [];
33
- this.throttledDecorator = ( new ThrottledDelayer(50));
34
- this.perEditorDisposables = this.add(( new DisposableStore()));
35
- const onDidChangeVisibleRanges = observableFromEvent(notebookEditor.onDidChangeVisibleRanges, () => notebookEditor.visibleRanges);
36
- const editorObs = derived((r) => {
37
- const visibleRanges = onDidChangeVisibleRanges.read(r);
38
- const visibleCellHandles = ( ( visibleRanges.map(range => notebookEditor.getCellsInRange(range))).flat().map(c => c.handle));
39
- if (!visibleCellHandles.includes(modifiedCell.handle)) {
40
- return;
41
- }
42
- const editor = notebookEditor.codeEditors.find(item => item[0].handle === modifiedCell.handle)?.[1];
43
- if (editor?.getModel() !== this.modifiedCell.textModel) {
44
- return;
45
- }
46
- return editor;
47
- });
48
- this.add(autorunWithStore((r, store) => {
49
- const editor = editorObs.read(r);
50
- this.perEditorDisposables.clear();
51
- if (editor) {
52
- store.add(editor.onDidChangeModel(() => {
53
- this.perEditorDisposables.clear();
54
- }));
55
- store.add(editor.onDidChangeModelContent(() => {
56
- this.update(editor);
57
- }));
58
- store.add(editor.onDidChangeConfiguration((e) => {
59
- if (e.hasChanged(EditorOption.fontInfo) || e.hasChanged(EditorOption.lineHeight)) {
60
- this.update(editor);
61
- }
62
- }));
63
- this.update(editor);
64
- }
65
- }));
66
- const shouldBeReadOnly = derived(this, r => {
67
- const editorUri = editorObs.read(r)?.getModel()?.uri;
68
- if (!editorUri) {
69
- return false;
70
- }
71
- const sessions = this._chatEditingService.editingSessionsObs.read(r);
72
- const session = sessions.find(s => ( s.entries.read(r).some(e => isEqual(e.modifiedURI, editorUri))));
73
- return session?.state.read(r) === ChatEditingSessionState.StreamingEdits;
74
- });
75
- let actualReadonly;
76
- let actualDeco;
77
- this.add(autorun((r) => {
78
- const editor = editorObs.read(r);
79
- if (!editor) {
80
- return;
81
- }
82
- const value = shouldBeReadOnly.read(r);
83
- if (value) {
84
- actualReadonly ??= editor.getOption(EditorOption.readOnly);
85
- actualDeco ??= editor.getOption(EditorOption.renderValidationDecorations);
86
- editor.updateOptions({
87
- readOnly: true,
88
- renderValidationDecorations: 'off'
89
- });
90
- }
91
- else {
92
- if (actualReadonly !== undefined && actualDeco !== undefined) {
93
- editor.updateOptions({
94
- readOnly: actualReadonly,
95
- renderValidationDecorations: actualDeco
96
- });
97
- actualReadonly = undefined;
98
- actualDeco = undefined;
99
- }
100
- }
101
- }));
102
- }
103
- update(editor) {
104
- this.throttledDecorator.trigger(() => this._updateImpl(editor));
105
- }
106
- async _updateImpl(editor) {
107
- if (this.isDisposed) {
108
- return;
109
- }
110
- if (editor.getOption(EditorOption.inDiffEditor)) {
111
- this.perEditorDisposables.clear();
112
- return;
113
- }
114
- const model = editor.getModel();
115
- if (!model || model !== this.modifiedCell.textModel) {
116
- this.perEditorDisposables.clear();
117
- return;
118
- }
119
- const originalModel = this.getOrCreateOriginalModel(editor);
120
- if (!originalModel) {
121
- this.perEditorDisposables.clear();
122
- return;
123
- }
124
- const version = model.getVersionId();
125
- const diff = await this._editorWorkerService.computeDiff(originalModel.uri, model.uri, { computeMoves: true, ignoreTrimWhitespace: false, maxComputationTimeMs: Number.MAX_SAFE_INTEGER }, 'advanced');
126
- if (this.isDisposed) {
127
- return;
128
- }
129
- if (diff && !diff.identical && originalModel && model === editor.getModel() && editor.getModel()?.getVersionId() === version) {
130
- this._updateWithDiff(editor, originalModel, diff);
131
- }
132
- else {
133
- this.perEditorDisposables.clear();
134
- }
135
- }
136
- getOrCreateOriginalModel(editor) {
137
- if (!this._originalModel) {
138
- const model = editor.getModel();
139
- if (!model) {
140
- return;
141
- }
142
- this._originalModel = this.add(this.originalCellModelFactory.getOrCreate(model.uri, this.originalCell.getValue(), model.getLanguageId(), this.modifiedCell.cellKind)).object;
143
- }
144
- return this._originalModel;
145
- }
146
- _updateWithDiff(editor, originalModel, diff) {
147
- if (areDiffsEqual(diff, this.diffForPreviouslyAppliedDecorators)) {
148
- return;
149
- }
150
- this.perEditorDisposables.clear();
151
- const decorations = editor.createDecorationsCollection();
152
- this.perEditorDisposables.add(toDisposable(() => {
153
- editor.changeViewZones((viewZoneChangeAccessor) => {
154
- for (const id of this._viewZones) {
155
- viewZoneChangeAccessor.removeZone(id);
156
- }
157
- });
158
- this._viewZones = [];
159
- decorations.clear();
160
- this.diffForPreviouslyAppliedDecorators = undefined;
161
- }));
162
- this.diffForPreviouslyAppliedDecorators = diff;
163
- const chatDiffAddDecoration = ModelDecorationOptions.createDynamic({
164
- ...diffAddDecoration,
165
- stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges
166
- });
167
- const chatDiffWholeLineAddDecoration = ModelDecorationOptions.createDynamic({
168
- ...diffWholeLineAddDecoration,
169
- stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
170
- });
171
- const createOverviewDecoration = (overviewRulerColor, minimapColor) => {
172
- return ModelDecorationOptions.createDynamic({
173
- description: 'chat-editing-decoration',
174
- overviewRuler: { color: themeColorFromId(overviewRulerColor), position: OverviewRulerLane.Left },
175
- minimap: { color: themeColorFromId(minimapColor), position: MinimapPosition.Gutter },
176
- });
177
- };
178
- const modifiedDecoration = createOverviewDecoration(overviewRulerModifiedForeground, minimapGutterModifiedBackground);
179
- const addedDecoration = createOverviewDecoration(overviewRulerAddedForeground, minimapGutterAddedBackground);
180
- const deletedDecoration = createOverviewDecoration(overviewRulerDeletedForeground, minimapGutterDeletedBackground);
181
- editor.changeViewZones((viewZoneChangeAccessor) => {
182
- for (const id of this._viewZones) {
183
- viewZoneChangeAccessor.removeZone(id);
184
- }
185
- this._viewZones = [];
186
- const modifiedDecorations = [];
187
- const mightContainNonBasicASCII = originalModel?.mightContainNonBasicASCII();
188
- const mightContainRTL = originalModel?.mightContainRTL();
189
- const renderOptions = RenderOptions.fromEditor(editor);
190
- for (const diffEntry of diff.changes) {
191
- const originalRange = diffEntry.original;
192
- if (originalModel) {
193
- originalModel.tokenization.forceTokenization(Math.max(1, originalRange.endLineNumberExclusive - 1));
194
- }
195
- const source = ( new LineSource(
196
- (originalRange.length && originalModel) ? originalRange.mapToLineArray(l => originalModel.tokenization.getLineTokens(l)) : [],
197
- [],
198
- mightContainNonBasicASCII,
199
- mightContainRTL
200
- ));
201
- const decorations = [];
202
- for (const i of diffEntry.innerChanges || []) {
203
- decorations.push(( new InlineDecoration(
204
- i.originalRange.delta(-(diffEntry.original.startLineNumber - 1)),
205
- diffDeleteDecoration.className,
206
- InlineDecorationType.Regular
207
- )));
208
- modifiedDecorations.push({
209
- range: i.modifiedRange, options: chatDiffAddDecoration
210
- });
211
- }
212
- if (!diffEntry.modified.isEmpty) {
213
- modifiedDecorations.push({
214
- range: diffEntry.modified.toInclusiveRange(), options: chatDiffWholeLineAddDecoration
215
- });
216
- }
217
- if (diffEntry.original.isEmpty) {
218
- modifiedDecorations.push({
219
- range: diffEntry.modified.toInclusiveRange(),
220
- options: addedDecoration
221
- });
222
- }
223
- else if (diffEntry.modified.isEmpty) {
224
- modifiedDecorations.push({
225
- range: ( new Range(
226
- diffEntry.modified.startLineNumber - 1,
227
- 1,
228
- diffEntry.modified.startLineNumber,
229
- 1
230
- )),
231
- options: deletedDecoration
232
- });
233
- }
234
- else {
235
- modifiedDecorations.push({
236
- range: diffEntry.modified.toInclusiveRange(),
237
- options: modifiedDecoration
238
- });
239
- }
240
- const domNode = document.createElement('div');
241
- domNode.className = 'chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text';
242
- const result = renderLines(source, renderOptions, decorations, domNode);
243
- const isCreatedContent = decorations.length === 1 && decorations[0].range.isEmpty() && decorations[0].range.startLineNumber === 1;
244
- if (!isCreatedContent) {
245
- const viewZoneData = {
246
- afterLineNumber: diffEntry.modified.startLineNumber - 1,
247
- heightInLines: result.heightInLines,
248
- domNode,
249
- ordinal: 50000 + 2
250
- };
251
- this._viewZones.push(viewZoneChangeAccessor.addZone(viewZoneData));
252
- }
253
- }
254
- decorations.set(modifiedDecorations);
255
- });
256
- }
257
- };
258
- NotebookCellDiffDecorator = ( __decorate([
259
- ( __param(3, IChatEditingService)),
260
- ( __param(4, IEditorWorkerService)),
261
- ( __param(5, INotebookOriginalCellModelFactory))
262
- ], NotebookCellDiffDecorator));
263
- function areDiffsEqual(a, b) {
264
- if (a && b) {
265
- if (a.changes.length !== b.changes.length) {
266
- return false;
267
- }
268
- if (a.moves.length !== b.moves.length) {
269
- return false;
270
- }
271
- if (!areLineRangeMappinsEqual(a.changes, b.changes)) {
272
- return false;
273
- }
274
- if (!( a.moves.some((move, i) => {
275
- const bMove = b.moves[i];
276
- if (!areLineRangeMappinsEqual(move.changes, bMove.changes)) {
277
- return true;
278
- }
279
- if (move.lineRangeMapping.changedLineCount !== bMove.lineRangeMapping.changedLineCount) {
280
- return true;
281
- }
282
- if (!move.lineRangeMapping.modified.equals(bMove.lineRangeMapping.modified)) {
283
- return true;
284
- }
285
- if (!move.lineRangeMapping.original.equals(bMove.lineRangeMapping.original)) {
286
- return true;
287
- }
288
- return false;
289
- }))) {
290
- return false;
291
- }
292
- return true;
293
- }
294
- else if (!a && !b) {
295
- return true;
296
- }
297
- else {
298
- return false;
299
- }
300
- }
301
- function areLineRangeMappinsEqual(a, b) {
302
- if (a.length !== b.length) {
303
- return false;
304
- }
305
- if (( a.some((c, i) => {
306
- const bChange = b[i];
307
- if (c.changedLineCount !== bChange.changedLineCount) {
308
- return true;
309
- }
310
- if ((c.innerChanges || []).length !== (bChange.innerChanges || []).length) {
311
- return true;
312
- }
313
- if (( (c.innerChanges || []).some((innerC, innerIdx) => {
314
- const bInnerC = bChange.innerChanges[innerIdx];
315
- if (!innerC.modifiedRange.equalsRange(bInnerC.modifiedRange)) {
316
- return true;
317
- }
318
- if (!innerC.originalRange.equalsRange(bInnerC.originalRange)) {
319
- return true;
320
- }
321
- return false;
322
- }))) {
323
- return true;
324
- }
325
- return false;
326
- }))) {
327
- return false;
328
- }
329
- return true;
330
- }
331
-
332
- export { NotebookCellDiffDecorator };
@@ -1,23 +0,0 @@
1
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { INotebookEditor } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
3
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
4
- import { IModifiedFileEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService";
5
- import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service";
6
- import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
7
- import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
8
- import { CellDiffInfo } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel";
9
- import { INotebookDeletedCellDecorator } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator";
10
- export declare class NotebookChatActionsOverlayController extends Disposable {
11
- private readonly notebookEditor;
12
- private readonly _chatEditingService;
13
- constructor(notebookEditor: INotebookEditor, cellDiffInfo: IObservable<CellDiffInfo[] | undefined>, deletedCellDecorator: INotebookDeletedCellDecorator, _chatEditingService: IChatEditingService, instantiationService: IInstantiationService);
14
- }
15
- export declare class NotebookChatActionsOverlay extends Disposable {
16
- private readonly notebookEditor;
17
- private readonly focusedDiff;
18
- private readonly toolbarNode;
19
- private added;
20
- constructor(notebookEditor: INotebookEditor, entry: IModifiedFileEntry, cellDiffInfo: IObservable<CellDiffInfo[] | undefined>, nextEntry: IModifiedFileEntry, previousEntry: IModifiedFileEntry, deletedCellDecorator: INotebookDeletedCellDecorator, _editorService: IEditorService, instaService: IInstantiationService);
21
- private show;
22
- private hide;
23
- }