@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
@@ -1,299 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { Disposable, toDisposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
- import { getNotebookEditorFromEditorPane, CellEditState } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
5
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
6
- import { MenuWorkbenchToolBar, HiddenItemStrategy } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/toolbar';
7
- import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
8
- import { ActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
9
- import { ActionRunner } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
10
- import { $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
11
- import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
12
- import { ACTIVE_GROUP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService';
13
- import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
14
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
15
- import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
16
- import { navigationBearingFakeActionId, AcceptAction, RejectAction } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions';
17
- import { ChatEditingModifiedDocumentEntry } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry';
18
- import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
19
- import { autorunWithStore, autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
20
- import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
21
-
22
- let NotebookChatActionsOverlayController = class NotebookChatActionsOverlayController extends Disposable {
23
- constructor(notebookEditor, cellDiffInfo, deletedCellDecorator, _chatEditingService, instantiationService) {
24
- super();
25
- this.notebookEditor = notebookEditor;
26
- this._chatEditingService = _chatEditingService;
27
- const notebookModel = observableFromEvent(this.notebookEditor.onDidChangeModel, e => e);
28
- this._register(autorunWithStore((r, store) => {
29
- const model = notebookModel.read(r);
30
- if (!model) {
31
- return;
32
- }
33
- const sessions = this._chatEditingService.editingSessionsObs.read(r);
34
- const session = sessions.find(s => s.readEntry(model.uri, r));
35
- const entry = session?.readEntry(model.uri, r);
36
- if (!session || !entry || !(entry instanceof ChatEditingModifiedDocumentEntry)) {
37
- return;
38
- }
39
- const entries = session.entries.read(r);
40
- const idx = entries.findIndex(e => isEqual(e.modifiedURI, model.uri));
41
- if (idx >= 0) {
42
- const entry = entries[idx];
43
- const nextEntry = entries[(idx + 1) % entries.length];
44
- const previousEntry = entries[(idx - 1 + entries.length) % entries.length];
45
- store.add(instantiationService.createInstance(NotebookChatActionsOverlay, notebookEditor, entry, cellDiffInfo, nextEntry, previousEntry, deletedCellDecorator));
46
- }
47
- }));
48
- }
49
- };
50
- NotebookChatActionsOverlayController = ( __decorate([
51
- ( __param(3, IChatEditingService)),
52
- ( __param(4, IInstantiationService))
53
- ], NotebookChatActionsOverlayController));
54
- let NotebookChatActionsOverlay = class NotebookChatActionsOverlay extends Disposable {
55
- constructor(notebookEditor, entry, cellDiffInfo, nextEntry, previousEntry, deletedCellDecorator, _editorService, instaService) {
56
- super();
57
- this.notebookEditor = notebookEditor;
58
- this.focusedDiff = observableValue('focusedDiff', undefined);
59
- this.added = false;
60
- this._register(notebookEditor.onDidBlurWidget(() => {
61
- if (getNotebookEditorFromEditorPane(_editorService.activeEditorPane) !== notebookEditor) {
62
- this.focusedDiff.set(undefined, undefined);
63
- }
64
- }));
65
- this._register(notebookEditor.onDidChangeActiveEditor(e => {
66
- if (e !== notebookEditor) {
67
- this.focusedDiff.set(undefined, undefined);
68
- }
69
- }));
70
- this.toolbarNode = $('div');
71
- this.toolbarNode.classList.add('notebook-chat-editor-overlay-widget');
72
- this._register(toDisposable(() => this.hide()));
73
- this._register(autorun(r => {
74
- const diffs = cellDiffInfo.read(r);
75
- if (diffs?.some(d => d.type !== 'unchanged')) {
76
- this.show();
77
- }
78
- else {
79
- this.hide();
80
- }
81
- }));
82
- const focusedDiff = this.focusedDiff;
83
- const _toolbar = instaService.createInstance(MenuWorkbenchToolBar, this.toolbarNode, MenuId.ChatEditingEditorContent, {
84
- telemetrySource: 'chatEditor.overlayToolbar',
85
- hiddenItemStrategy: HiddenItemStrategy.Ignore,
86
- toolbarOptions: {
87
- primaryGroup: () => true,
88
- useSeparatorsInPrimaryActions: true
89
- },
90
- menuOptions: { renderShortTitle: true },
91
- actionViewItemProvider: (action, options) => {
92
- if (action.id === navigationBearingFakeActionId) {
93
- return this._register(new (class extends ActionViewItem {
94
- constructor() {
95
- super(undefined, action, { ...options, icon: false, label: false, keybindingNotRenderedWithLabel: true });
96
- }
97
- }));
98
- }
99
- if (action.id === AcceptAction.ID || action.id === RejectAction.ID) {
100
- return this._register(new (class extends ActionViewItem {
101
- constructor() {
102
- super(undefined, action, { ...options, icon: false, label: true, keybindingNotRenderedWithLabel: true });
103
- this._reveal = this._store.add(( new MutableDisposable()));
104
- }
105
- set actionRunner(actionRunner) {
106
- super.actionRunner = actionRunner;
107
- const store = ( new DisposableStore());
108
- store.add(actionRunner.onWillRun(_e => {
109
- notebookEditor.focus();
110
- }));
111
- store.add(actionRunner.onDidRun(e => {
112
- if (e.action !== this.action) {
113
- return;
114
- }
115
- if (entry === nextEntry) {
116
- return;
117
- }
118
- }));
119
- this._reveal.value = store;
120
- }
121
- get actionRunner() {
122
- return super.actionRunner;
123
- }
124
- }));
125
- }
126
- if (action.id === 'chatEditor.action.navigateNext' || action.id === 'chatEditor.action.navigatePrevious') {
127
- return this._register(new (class extends ActionViewItem {
128
- constructor() {
129
- super(undefined, action, { ...options, icon: true, label: false, keybindingNotRenderedWithLabel: true });
130
- }
131
- set actionRunner(_) {
132
- const next = action.id === 'chatEditor.action.navigateNext' ? nextEntry : previousEntry;
133
- const direction = action.id === 'chatEditor.action.navigateNext' ? 'next' : 'previous';
134
- super.actionRunner = this._register(( new NextPreviousChangeActionRunner(
135
- notebookEditor,
136
- cellDiffInfo,
137
- entry,
138
- next,
139
- direction,
140
- _editorService,
141
- deletedCellDecorator,
142
- focusedDiff
143
- )));
144
- }
145
- get actionRunner() {
146
- return super.actionRunner;
147
- }
148
- }));
149
- }
150
- return undefined;
151
- }
152
- });
153
- this._register(_toolbar);
154
- }
155
- show() {
156
- if (!this.added) {
157
- this.notebookEditor.getDomNode().appendChild(this.toolbarNode);
158
- this.added = true;
159
- }
160
- }
161
- hide() {
162
- if (this.added) {
163
- this.notebookEditor.getDomNode().removeChild(this.toolbarNode);
164
- this.added = false;
165
- }
166
- }
167
- };
168
- NotebookChatActionsOverlay = ( __decorate([
169
- ( __param(6, IEditorService)),
170
- ( __param(7, IInstantiationService))
171
- ], NotebookChatActionsOverlay));
172
- class NextPreviousChangeActionRunner extends ActionRunner {
173
- constructor(notebookEditor, cellDiffInfo, entry, next, direction, editorService, deletedCellDecorator, focusedDiff) {
174
- super();
175
- this.notebookEditor = notebookEditor;
176
- this.cellDiffInfo = cellDiffInfo;
177
- this.entry = entry;
178
- this.next = next;
179
- this.direction = direction;
180
- this.editorService = editorService;
181
- this.deletedCellDecorator = deletedCellDecorator;
182
- this.focusedDiff = focusedDiff;
183
- }
184
- async runAction(_action, _context) {
185
- const viewModel = this.notebookEditor.getViewModel();
186
- const activeCell = this.notebookEditor.activeCellAndCodeEditor;
187
- const cellDiff = this.cellDiffInfo.read(undefined);
188
- if (!viewModel || !cellDiff?.length || (!activeCell && this.focusedDiff.read(undefined))) {
189
- return this.goToNextEntry();
190
- }
191
- const nextDiff = this.getNextCellDiff(cellDiff, viewModel);
192
- if (nextDiff && (await this.focusDiff(nextDiff, viewModel))) {
193
- return;
194
- }
195
- return this.goToNextEntry();
196
- }
197
- async focusDiff(diff, viewModel) {
198
- if (diff.type === 'delete') {
199
- const top = this.deletedCellDecorator.getTop(diff.originalCellIndex);
200
- if (typeof top === 'number') {
201
- this.focusedDiff.set(diff, undefined);
202
- this.notebookEditor.setScrollTop(top);
203
- return true;
204
- }
205
- }
206
- else {
207
- const index = diff.modifiedCellIndex;
208
- this.focusedDiff.set(diff, undefined);
209
- await this.notebookEditor.focusNotebookCell(viewModel.viewCells[index], 'container');
210
- this.notebookEditor.revealInViewAtTop(viewModel.viewCells[index]);
211
- viewModel.viewCells[index].updateEditState(CellEditState.Editing, 'chatEdit');
212
- return true;
213
- }
214
- return false;
215
- }
216
- getNextCellDiff(cellDiffInfo, viewModel) {
217
- const activeCell = this.notebookEditor.activeCellAndCodeEditor;
218
- const currentCellIndex = activeCell ? viewModel.viewCells.findIndex(c => c.handle === activeCell[0].handle) : (this.direction === 'next' ? 0 : viewModel.viewCells.length - 1);
219
- if (this.focusedDiff.read(undefined)) {
220
- const changes = cellDiffInfo.filter(d => d.type !== 'unchanged');
221
- const idx = changes.findIndex(d => d === this.focusedDiff.read(undefined));
222
- if (idx >= 0) {
223
- const next = this.direction === 'next' ? idx + 1 : idx - 1;
224
- if (next >= 0 && next < changes.length) {
225
- return changes[next];
226
- }
227
- }
228
- }
229
- else if (this.direction === 'next') {
230
- let currentIndex = 0;
231
- let next;
232
- cellDiffInfo
233
- .forEach((d, i) => {
234
- if (next) {
235
- return;
236
- }
237
- if (d.type === 'insert' || d.type === 'modified') {
238
- if (d.modifiedCellIndex > currentCellIndex) {
239
- next = d;
240
- }
241
- currentIndex = d.modifiedCellIndex;
242
- }
243
- else if (d.type === 'unchanged') {
244
- currentIndex = d.modifiedCellIndex;
245
- }
246
- else if (currentIndex >= currentCellIndex) {
247
- next = d;
248
- }
249
- });
250
- if (next) {
251
- return next;
252
- }
253
- }
254
- else {
255
- let currentIndex = 0;
256
- let previous;
257
- cellDiffInfo
258
- .forEach((d, i) => {
259
- if (d.type === 'insert' || d.type === 'modified') {
260
- if (d.modifiedCellIndex < currentCellIndex) {
261
- previous = d;
262
- }
263
- currentIndex = d.modifiedCellIndex;
264
- }
265
- else if (d.type === 'unchanged') {
266
- currentIndex = d.modifiedCellIndex;
267
- }
268
- else if (currentIndex <= currentCellIndex) {
269
- previous = d;
270
- }
271
- });
272
- if (previous) {
273
- return previous;
274
- }
275
- }
276
- if (this.canGoToNextEntry()) {
277
- return;
278
- }
279
- return this.direction === 'next' ? cellDiffInfo[0] : cellDiffInfo[cellDiffInfo.length - 1];
280
- }
281
- canGoToNextEntry() {
282
- return this.entry !== this.next;
283
- }
284
- async goToNextEntry() {
285
- if (!this.canGoToNextEntry()) {
286
- return;
287
- }
288
- this.focusedDiff.set(undefined, undefined);
289
- await this.editorService.openEditor({
290
- resource: this.next.modifiedURI,
291
- options: {
292
- revealIfOpened: false,
293
- revealIfVisible: false,
294
- }
295
- }, ACTIVE_GROUP);
296
- }
297
- }
298
-
299
- export { NotebookChatActionsOverlay, NotebookChatActionsOverlayController };
@@ -1,9 +0,0 @@
1
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { INotebookEditor, INotebookEditorContribution } 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 { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
5
- export declare class NotebookChatEditorControllerContrib extends Disposable implements INotebookEditorContribution {
6
- static readonly ID: string;
7
- readonly _serviceBrand: undefined;
8
- constructor(notebookEditor: INotebookEditor, instantiationService: IInstantiationService, configurationService: IConfigurationService);
9
- }
@@ -1,179 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { Disposable, dispose, 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 { WorkingSetEntryState } 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 { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
8
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
9
- import { NotebookCellDiffDecorator } from './notebookCellDecorators.js';
10
- import { INotebookModelSynchronizerFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.service';
11
- import { INotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.service';
12
- import { observableFromEvent, debouncedObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
13
- import { NotebookChatActionsOverlayController } from './notebookChatActionsOverlay.js';
14
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
15
- import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
16
- import { ctxNotebookHasEditorModification } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditContext';
17
- import { NotebookDeletedCellDecorator } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator';
18
- import { NotebookInsertedCellDecorator } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator';
19
- import { ChatEditingModifiedDocumentEntry } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry';
20
- import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
21
- import { derived, derivedWithStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
22
- import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
23
-
24
- let NotebookChatEditorControllerContrib = class NotebookChatEditorControllerContrib extends Disposable {
25
- static { this.ID = 'workbench.notebook.chatEditorController'; }
26
- constructor(notebookEditor, instantiationService, configurationService) {
27
- super();
28
- this._register(instantiationService.createInstance(NotebookChatEditorController, notebookEditor));
29
- }
30
- };
31
- NotebookChatEditorControllerContrib = ( __decorate([
32
- ( __param(1, IInstantiationService)),
33
- ( __param(2, IConfigurationService))
34
- ], NotebookChatEditorControllerContrib));
35
- let NotebookChatEditorController = class NotebookChatEditorController extends Disposable {
36
- constructor(notebookEditor, _chatEditingService, originalModelRefFactory, synchronizerFactory, instantiationService, contextKeyService) {
37
- super();
38
- this.notebookEditor = notebookEditor;
39
- this._chatEditingService = _chatEditingService;
40
- this.originalModelRefFactory = originalModelRefFactory;
41
- this.synchronizerFactory = synchronizerFactory;
42
- this.instantiationService = instantiationService;
43
- this._ctxHasEditorModification = ctxNotebookHasEditorModification.bindTo(contextKeyService);
44
- this.deletedCellDecorator = this._register(instantiationService.createInstance(NotebookDeletedCellDecorator, notebookEditor, undefined));
45
- this.insertedCellDecorator = this._register(instantiationService.createInstance(NotebookInsertedCellDecorator, notebookEditor));
46
- const notebookModel = observableFromEvent(this.notebookEditor.onDidChangeModel, e => e);
47
- const originalModel = observableValue('originalModel', undefined);
48
- const readyToRenderViewzones = observableValue('viewModelAttached', false);
49
- this._register(Event.once(this.notebookEditor.onDidAttachViewModel)(() => readyToRenderViewzones.set(true, undefined)));
50
- const onDidChangeVisibleRanges = debouncedObservable(observableFromEvent(this.notebookEditor.onDidChangeVisibleRanges, () => this.notebookEditor.visibleRanges), 50);
51
- const decorators = ( new Map());
52
- let updatedCellDecoratorsOnceBefore = false;
53
- let updatedDeletedInsertedDecoratorsOnceBefore = false;
54
- const clearDecorators = () => {
55
- dispose(Array.from(( decorators.values())));
56
- decorators.clear();
57
- this.deletedCellDecorator.clear();
58
- this.insertedCellDecorator.clear();
59
- };
60
- this._register(toDisposable(() => clearDecorators()));
61
- let notebookSynchronizer;
62
- const entryObs = derived((r) => {
63
- const model = notebookModel.read(r);
64
- if (!model) {
65
- return;
66
- }
67
- const sessions = this._chatEditingService.editingSessionsObs.read(r);
68
- const entry = ( sessions.map(s => s.readEntry(model.uri, r))).find(r => !!r);
69
- return entry instanceof ChatEditingModifiedDocumentEntry ? entry : undefined;
70
- }).recomputeInitiallyAndOnChange(this._store);
71
- this._register(autorun(r => {
72
- const entry = entryObs.read(r);
73
- const model = notebookModel.read(r);
74
- if (!entry || !model || entry.state.read(r) !== WorkingSetEntryState.Modified) {
75
- clearDecorators();
76
- }
77
- }));
78
- const notebookDiffInfo = derivedWithStore(this, (r, store) => {
79
- const entry = entryObs.read(r);
80
- const model = notebookModel.read(r);
81
- if (!entry || !model) {
82
- if (notebookSynchronizer && model) {
83
- notebookSynchronizer.object.revert();
84
- }
85
- return observableValue('DefaultDiffIno', undefined);
86
- }
87
- notebookSynchronizer = notebookSynchronizer || this._register(this.synchronizerFactory.getOrCreate(model));
88
- this.originalModelRefFactory.getOrCreate(entry, model.viewType).then(ref => originalModel.set(this._register(ref).object, undefined));
89
- return notebookSynchronizer.object.diffInfo;
90
- }).recomputeInitiallyAndOnChange(this._store).flatten();
91
- const notebookCellDiffInfo = ( notebookDiffInfo.map(d => d?.cellDiff));
92
- this._register(instantiationService.createInstance(NotebookChatActionsOverlayController, notebookEditor, notebookCellDiffInfo, this.deletedCellDecorator));
93
- this._register(autorun(r => {
94
- entryObs.read(r);
95
- clearDecorators();
96
- }));
97
- this._register(autorun(r => {
98
- const diffs = notebookDiffInfo.read(r);
99
- if (!diffs || !diffs.cellDiff.length) {
100
- clearDecorators();
101
- this._ctxHasEditorModification.reset();
102
- }
103
- else {
104
- this._ctxHasEditorModification.set(true);
105
- }
106
- }));
107
- this._register(autorun(r => {
108
- const entry = entryObs.read(r);
109
- const diffInfo = notebookDiffInfo.read(r);
110
- const modified = notebookModel.read(r);
111
- const original = originalModel.read(r);
112
- onDidChangeVisibleRanges.read(r);
113
- if (!entry || !modified || !original || !diffInfo) {
114
- return;
115
- }
116
- if (diffInfo && updatedCellDecoratorsOnceBefore && (diffInfo.modelVersion !== modified.versionId)) {
117
- return;
118
- }
119
- updatedCellDecoratorsOnceBefore = true;
120
- const validDiffDecorators = ( new Set());
121
- diffInfo.cellDiff.forEach((diff) => {
122
- if (diff.type === 'modified') {
123
- const modifiedCell = modified.cells[diff.modifiedCellIndex];
124
- const originalCell = original.cells[diff.originalCellIndex];
125
- const editor = this.notebookEditor.codeEditors.find(([vm,]) => vm.handle === modifiedCell.handle)?.[1];
126
- if (editor) {
127
- const currentDecorator = decorators.get(modifiedCell);
128
- if ((currentDecorator?.modifiedCell !== modifiedCell || currentDecorator?.originalCell !== originalCell)) {
129
- currentDecorator?.dispose();
130
- const decorator = this.instantiationService.createInstance(NotebookCellDiffDecorator, notebookEditor, modifiedCell, originalCell);
131
- decorators.set(modifiedCell, decorator);
132
- validDiffDecorators.add(decorator);
133
- this._register(editor.onDidDispose(() => {
134
- decorator.dispose();
135
- if (decorators.get(modifiedCell) === decorator) {
136
- decorators.delete(modifiedCell);
137
- }
138
- }));
139
- }
140
- else if (currentDecorator) {
141
- validDiffDecorators.add(currentDecorator);
142
- }
143
- }
144
- }
145
- });
146
- decorators.forEach((v, cell) => {
147
- if (!( validDiffDecorators.has(v))) {
148
- v.dispose();
149
- decorators.delete(cell);
150
- }
151
- });
152
- }));
153
- this._register(autorun(r => {
154
- const entry = entryObs.read(r);
155
- const diffInfo = notebookDiffInfo.read(r);
156
- const modified = notebookModel.read(r);
157
- const original = originalModel.read(r);
158
- const ready = readyToRenderViewzones.read(r);
159
- if (!ready || !entry || !modified || !original || !diffInfo) {
160
- return;
161
- }
162
- if (diffInfo && updatedDeletedInsertedDecoratorsOnceBefore && (diffInfo.modelVersion !== modified.versionId)) {
163
- return;
164
- }
165
- updatedDeletedInsertedDecoratorsOnceBefore = true;
166
- this.insertedCellDecorator.apply(diffInfo.cellDiff);
167
- this.deletedCellDecorator.apply(diffInfo.cellDiff, original);
168
- }));
169
- }
170
- };
171
- NotebookChatEditorController = ( __decorate([
172
- ( __param(1, IChatEditingService)),
173
- ( __param(2, INotebookOriginalModelReferenceFactory)),
174
- ( __param(3, INotebookModelSynchronizerFactory)),
175
- ( __param(4, IInstantiationService)),
176
- ( __param(5, IContextKeyService))
177
- ], NotebookChatEditorController));
178
-
179
- export { NotebookChatEditorControllerContrib };
@@ -1,21 +0,0 @@
1
- import { IReference, ReferenceCollection } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
3
- import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
4
- import { CellKind } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
5
- import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
6
- import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
7
- import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
8
- import { INotebookOriginalCellModelFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.service";
9
- export declare class OriginalNotebookCellModelReferenceCollection extends ReferenceCollection<ITextModel> {
10
- private readonly modelService;
11
- private readonly _languageService;
12
- constructor(modelService: IModelService, _languageService: ILanguageService);
13
- protected createReferencedObject(_key: string, uri: URI, cellValue: string, language: string, cellKind: CellKind): ITextModel;
14
- protected destroyReferencedObject(_key: string, model: ITextModel): void;
15
- }
16
- export declare class OriginalNotebookCellModelFactory implements INotebookOriginalCellModelFactory {
17
- readonly _serviceBrand: undefined;
18
- private readonly _data;
19
- constructor(instantiationService: IInstantiationService);
20
- getOrCreate(uri: URI, cellValue: string, language: string, cellKind: CellKind): IReference<ITextModel>;
21
- }
@@ -1,42 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { ReferenceCollection } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
5
- import { CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
6
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
7
- import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
8
- import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
9
-
10
- let OriginalNotebookCellModelReferenceCollection = class OriginalNotebookCellModelReferenceCollection extends ReferenceCollection {
11
- constructor(modelService, _languageService) {
12
- super();
13
- this.modelService = modelService;
14
- this._languageService = _languageService;
15
- }
16
- createReferencedObject(_key, uri, cellValue, language, cellKind) {
17
- const scheme = `${uri.scheme}-chat-edit`;
18
- const originalCellUri = ( URI.from({ scheme, fragment: uri.fragment, path: uri.path }));
19
- const languageSelection = this._languageService.getLanguageIdByLanguageName(language) ? this._languageService.createById(language) : cellKind === CellKind.Markup ? this._languageService.createById('markdown') : null;
20
- return this.modelService.createModel(cellValue, languageSelection, originalCellUri);
21
- }
22
- destroyReferencedObject(_key, model) {
23
- model.dispose();
24
- }
25
- };
26
- OriginalNotebookCellModelReferenceCollection = ( __decorate([
27
- ( __param(0, IModelService)),
28
- ( __param(1, ILanguageService))
29
- ], OriginalNotebookCellModelReferenceCollection));
30
- let OriginalNotebookCellModelFactory = class OriginalNotebookCellModelFactory {
31
- constructor(instantiationService) {
32
- this._data = instantiationService.createInstance(OriginalNotebookCellModelReferenceCollection);
33
- }
34
- getOrCreate(uri, cellValue, language, cellKind) {
35
- return this._data.acquire(( uri.toString()), uri, cellValue, language, cellKind);
36
- }
37
- };
38
- OriginalNotebookCellModelFactory = ( __decorate([
39
- ( __param(0, IInstantiationService))
40
- ], OriginalNotebookCellModelFactory));
41
-
42
- export { OriginalNotebookCellModelFactory, OriginalNotebookCellModelReferenceCollection };
@@ -1,25 +0,0 @@
1
- import { IReference, ReferenceCollection } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { IModifiedFileEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService";
3
- import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
4
- import { NotebookTextModel } from "../../../common/model/notebookTextModel.js";
5
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
6
- import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
7
- import { INotebookOriginalModelReferenceFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.service";
8
- export declare class OriginalNotebookModelReferenceCollection extends ReferenceCollection<Promise<NotebookTextModel>> {
9
- private readonly notebookService;
10
- private readonly modelService;
11
- private readonly modelsToDispose;
12
- constructor(notebookService: INotebookService, modelService: ITextModelService);
13
- protected createReferencedObject(key: string, fileEntry: IModifiedFileEntry, viewType: string): Promise<NotebookTextModel>;
14
- protected destroyReferencedObject(key: string, modelPromise: Promise<NotebookTextModel>): void;
15
- }
16
- export declare class NotebookOriginalModelReferenceFactory implements INotebookOriginalModelReferenceFactory {
17
- private readonly instantiationService;
18
- readonly _serviceBrand: undefined;
19
- private _resourceModelCollection;
20
- private get resourceModelCollection();
21
- private _asyncModelCollection;
22
- private get asyncModelCollection();
23
- constructor(instantiationService: IInstantiationService);
24
- getOrCreate(fileEntry: IModifiedFileEntry, viewType: string): Promise<IReference<NotebookTextModel>>;
25
- }
@@ -1,77 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { ReferenceCollection, AsyncReferenceCollection } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
- import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
5
- import { VSBuffer, bufferToStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
6
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
7
- import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
8
-
9
- let OriginalNotebookModelReferenceCollection = class OriginalNotebookModelReferenceCollection extends ReferenceCollection {
10
- constructor(notebookService, modelService) {
11
- super();
12
- this.notebookService = notebookService;
13
- this.modelService = modelService;
14
- this.modelsToDispose = ( new Set());
15
- }
16
- async createReferencedObject(key, fileEntry, viewType) {
17
- this.modelsToDispose.delete(key);
18
- const uri = fileEntry.originalURI;
19
- const model = this.notebookService.getNotebookTextModel(uri);
20
- if (model) {
21
- return model;
22
- }
23
- const modelRef = await this.modelService.createModelReference(uri);
24
- const bytes = VSBuffer.fromString(modelRef.object.textEditorModel.getValue());
25
- const stream = bufferToStream(bytes);
26
- modelRef.dispose();
27
- return this.notebookService.createNotebookTextModel(viewType, uri, stream);
28
- }
29
- destroyReferencedObject(key, modelPromise) {
30
- this.modelsToDispose.add(key);
31
- (async () => {
32
- try {
33
- const model = await modelPromise;
34
- if (!( this.modelsToDispose.has(key))) {
35
- return;
36
- }
37
- model.dispose();
38
- }
39
- catch (error) {
40
- }
41
- finally {
42
- this.modelsToDispose.delete(key);
43
- }
44
- })();
45
- }
46
- };
47
- OriginalNotebookModelReferenceCollection = ( __decorate([
48
- ( __param(0, INotebookService)),
49
- ( __param(1, ITextModelService))
50
- ], OriginalNotebookModelReferenceCollection));
51
- let NotebookOriginalModelReferenceFactory = class NotebookOriginalModelReferenceFactory {
52
- get resourceModelCollection() {
53
- if (!this._resourceModelCollection) {
54
- this._resourceModelCollection = this.instantiationService.createInstance(OriginalNotebookModelReferenceCollection);
55
- }
56
- return this._resourceModelCollection;
57
- }
58
- get asyncModelCollection() {
59
- if (!this._asyncModelCollection) {
60
- this._asyncModelCollection = ( new AsyncReferenceCollection(this.resourceModelCollection));
61
- }
62
- return this._asyncModelCollection;
63
- }
64
- constructor(instantiationService) {
65
- this.instantiationService = instantiationService;
66
- this._resourceModelCollection = undefined;
67
- this._asyncModelCollection = undefined;
68
- }
69
- getOrCreate(fileEntry, viewType) {
70
- return this.asyncModelCollection.acquire(( fileEntry.originalURI.toString()), fileEntry, viewType);
71
- }
72
- };
73
- NotebookOriginalModelReferenceFactory = ( __decorate([
74
- ( __param(0, IInstantiationService))
75
- ], NotebookOriginalModelReferenceFactory));
76
-
77
- export { NotebookOriginalModelReferenceFactory, OriginalNotebookModelReferenceCollection };