@codingame/monaco-vscode-notebook-service-override 14.0.6 → 15.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.
- package/package.json +26 -29
- package/vscode/src/vs/editor/contrib/gotoError/browser/markerNavigationService.d.ts +34 -0
- package/vscode/src/vs/editor/contrib/gotoError/browser/markerNavigationService.js +216 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +29 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +5 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/contribution.js +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.d.ts +4 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.js +13 -217
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.js +22 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.js +17 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.js +8 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.js +47 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.js +28 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +12 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +14 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +18 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.d.ts +11 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +328 -116
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +8 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +16 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +19 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +3 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +39 -37
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +99 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +40 -35
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +31 -31
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +37 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +22 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +11 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +17 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +58 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +99 -87
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +7 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.d.ts +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +3 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +20 -16
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.d.ts +1 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.d.ts +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +14 -14
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.d.ts +1 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +3 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { Disposable, toDisposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { getNotebookEditorFromEditorPane, CellEditState } from '@codingame/monaco-vscode-
|
|
4
|
+
import { getNotebookEditorFromEditorPane, CellEditState } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
5
5
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
6
|
import { MenuWorkbenchToolBar, HiddenItemStrategy } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/toolbar';
|
|
7
7
|
import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
@@ -11,16 +11,13 @@ import { $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
|
11
11
|
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
12
12
|
import { ACTIVE_GROUP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService';
|
|
13
13
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
14
|
-
import
|
|
15
|
-
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
|
|
16
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
17
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
18
|
-
import { autorunWithStore, autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
19
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
20
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
21
|
-
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
|
|
14
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
22
15
|
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
23
|
-
import { navigationBearingFakeActionId, AcceptAction, RejectAction } from '@codingame/monaco-vscode-
|
|
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';
|
|
24
21
|
|
|
25
22
|
let NotebookChatActionsOverlayController = class NotebookChatActionsOverlayController extends Disposable {
|
|
26
23
|
constructor(notebookEditor, cellDiffInfo, deletedCellDecorator, _chatEditingService, instantiationService) {
|
|
@@ -29,9 +26,14 @@ let NotebookChatActionsOverlayController = class NotebookChatActionsOverlayContr
|
|
|
29
26
|
this._chatEditingService = _chatEditingService;
|
|
30
27
|
const notebookModel = observableFromEvent(this.notebookEditor.onDidChangeModel, e => e);
|
|
31
28
|
this._register(autorunWithStore((r, store) => {
|
|
32
|
-
const session = this._chatEditingService.currentEditingSessionObs.read(r);
|
|
33
29
|
const model = notebookModel.read(r);
|
|
34
|
-
if (!model
|
|
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)) {
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
39
|
const entries = session.entries.read(r);
|
|
@@ -53,7 +55,6 @@ let NotebookChatActionsOverlay = class NotebookChatActionsOverlay extends Dispos
|
|
|
53
55
|
constructor(notebookEditor, entry, cellDiffInfo, nextEntry, previousEntry, deletedCellDecorator, _editorService, instaService) {
|
|
54
56
|
super();
|
|
55
57
|
this.notebookEditor = notebookEditor;
|
|
56
|
-
this._editorService = _editorService;
|
|
57
58
|
this.focusedDiff = observableValue('focusedDiff', undefined);
|
|
58
59
|
this.added = false;
|
|
59
60
|
this._register(notebookEditor.onDidBlurWidget(() => {
|
|
@@ -88,16 +89,15 @@ let NotebookChatActionsOverlay = class NotebookChatActionsOverlay extends Dispos
|
|
|
88
89
|
},
|
|
89
90
|
menuOptions: { renderShortTitle: true },
|
|
90
91
|
actionViewItemProvider: (action, options) => {
|
|
91
|
-
const that = this;
|
|
92
92
|
if (action.id === navigationBearingFakeActionId) {
|
|
93
|
-
return new (class extends ActionViewItem {
|
|
93
|
+
return this._register(new (class extends ActionViewItem {
|
|
94
94
|
constructor() {
|
|
95
95
|
super(undefined, action, { ...options, icon: false, label: false, keybindingNotRenderedWithLabel: true });
|
|
96
96
|
}
|
|
97
|
-
});
|
|
97
|
+
}));
|
|
98
98
|
}
|
|
99
99
|
if (action.id === AcceptAction.ID || action.id === RejectAction.ID) {
|
|
100
|
-
return new (class extends ActionViewItem {
|
|
100
|
+
return this._register(new (class extends ActionViewItem {
|
|
101
101
|
constructor() {
|
|
102
102
|
super(undefined, action, { ...options, icon: false, label: true, keybindingNotRenderedWithLabel: true });
|
|
103
103
|
this._reveal = this._store.add(( new MutableDisposable()));
|
|
@@ -115,32 +115,23 @@ let NotebookChatActionsOverlay = class NotebookChatActionsOverlay extends Dispos
|
|
|
115
115
|
if (entry === nextEntry) {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
const change = nextEntry.diffInfo.get().changes.at(0);
|
|
119
|
-
return that._editorService.openEditor({
|
|
120
|
-
resource: nextEntry.modifiedURI,
|
|
121
|
-
options: {
|
|
122
|
-
selection: change && Range.fromPositions({ lineNumber: change.original.startLineNumber, column: 1 }),
|
|
123
|
-
revealIfOpened: false,
|
|
124
|
-
revealIfVisible: false,
|
|
125
|
-
}
|
|
126
|
-
}, ACTIVE_GROUP);
|
|
127
118
|
}));
|
|
128
119
|
this._reveal.value = store;
|
|
129
120
|
}
|
|
130
121
|
get actionRunner() {
|
|
131
122
|
return super.actionRunner;
|
|
132
123
|
}
|
|
133
|
-
});
|
|
124
|
+
}));
|
|
134
125
|
}
|
|
135
126
|
if (action.id === 'chatEditor.action.navigateNext' || action.id === 'chatEditor.action.navigatePrevious') {
|
|
136
|
-
return new (class extends ActionViewItem {
|
|
127
|
+
return this._register(new (class extends ActionViewItem {
|
|
137
128
|
constructor() {
|
|
138
129
|
super(undefined, action, { ...options, icon: true, label: false, keybindingNotRenderedWithLabel: true });
|
|
139
130
|
}
|
|
140
131
|
set actionRunner(_) {
|
|
141
132
|
const next = action.id === 'chatEditor.action.navigateNext' ? nextEntry : previousEntry;
|
|
142
133
|
const direction = action.id === 'chatEditor.action.navigateNext' ? 'next' : 'previous';
|
|
143
|
-
super.actionRunner = ( new NextPreviousChangeActionRunner(
|
|
134
|
+
super.actionRunner = this._register(( new NextPreviousChangeActionRunner(
|
|
144
135
|
notebookEditor,
|
|
145
136
|
cellDiffInfo,
|
|
146
137
|
entry,
|
|
@@ -149,12 +140,12 @@ let NotebookChatActionsOverlay = class NotebookChatActionsOverlay extends Dispos
|
|
|
149
140
|
_editorService,
|
|
150
141
|
deletedCellDecorator,
|
|
151
142
|
focusedDiff
|
|
152
|
-
));
|
|
143
|
+
)));
|
|
153
144
|
}
|
|
154
145
|
get actionRunner() {
|
|
155
146
|
return super.actionRunner;
|
|
156
147
|
}
|
|
157
|
-
});
|
|
148
|
+
}));
|
|
158
149
|
}
|
|
159
150
|
return undefined;
|
|
160
151
|
}
|
|
@@ -294,12 +285,10 @@ class NextPreviousChangeActionRunner extends ActionRunner {
|
|
|
294
285
|
if (!this.canGoToNextEntry()) {
|
|
295
286
|
return;
|
|
296
287
|
}
|
|
297
|
-
const change = this.next.diffInfo.get().changes.at(0);
|
|
298
288
|
this.focusedDiff.set(undefined, undefined);
|
|
299
289
|
await this.editorService.openEditor({
|
|
300
290
|
resource: this.next.modifiedURI,
|
|
301
291
|
options: {
|
|
302
|
-
selection: change && Range.fromPositions({ lineNumber: change.original.startLineNumber, column: 1 }),
|
|
303
292
|
revealIfOpened: false,
|
|
304
293
|
revealIfVisible: false,
|
|
305
294
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { INotebookEditor, INotebookEditorContribution } from "@codingame/monaco-vscode-
|
|
2
|
+
import { INotebookEditor, INotebookEditorContribution } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
3
3
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
4
4
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
5
|
export declare class NotebookChatEditorControllerContrib extends Disposable implements INotebookEditorContribution {
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { Disposable, dispose, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import
|
|
5
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
6
|
-
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
7
|
-
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
8
|
-
import { derived, derivedWithStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
9
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
10
|
-
import { observableFromEvent, debouncedObservable2 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
|
|
4
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
11
5
|
import { WorkingSetEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
12
6
|
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
13
7
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
14
8
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
15
|
-
import {
|
|
16
|
-
import './notebookSynchronizer.js';
|
|
9
|
+
import { NotebookCellDiffDecorator } from './notebookCellDecorators.js';
|
|
17
10
|
import { INotebookModelSynchronizerFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.service';
|
|
18
|
-
import './notebookOriginalModelRefFactory.js';
|
|
19
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';
|
|
20
13
|
import { NotebookChatActionsOverlayController } from './notebookChatActionsOverlay.js';
|
|
21
14
|
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
22
|
-
import {
|
|
23
|
-
import '@codingame/monaco-vscode-
|
|
24
|
-
import '
|
|
25
|
-
import {
|
|
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';
|
|
26
23
|
|
|
27
24
|
let NotebookChatEditorControllerContrib = class NotebookChatEditorControllerContrib extends Disposable {
|
|
28
25
|
static { this.ID = 'workbench.notebook.chatEditorController'; }
|
|
@@ -44,13 +41,13 @@ let NotebookChatEditorController = class NotebookChatEditorController extends Di
|
|
|
44
41
|
this.synchronizerFactory = synchronizerFactory;
|
|
45
42
|
this.instantiationService = instantiationService;
|
|
46
43
|
this._ctxHasEditorModification = ctxNotebookHasEditorModification.bindTo(contextKeyService);
|
|
47
|
-
this.deletedCellDecorator = this._register(instantiationService.createInstance(NotebookDeletedCellDecorator, notebookEditor));
|
|
44
|
+
this.deletedCellDecorator = this._register(instantiationService.createInstance(NotebookDeletedCellDecorator, notebookEditor, undefined));
|
|
48
45
|
this.insertedCellDecorator = this._register(instantiationService.createInstance(NotebookInsertedCellDecorator, notebookEditor));
|
|
49
46
|
const notebookModel = observableFromEvent(this.notebookEditor.onDidChangeModel, e => e);
|
|
50
47
|
const originalModel = observableValue('originalModel', undefined);
|
|
51
48
|
const readyToRenderViewzones = observableValue('viewModelAttached', false);
|
|
52
49
|
this._register(Event.once(this.notebookEditor.onDidAttachViewModel)(() => readyToRenderViewzones.set(true, undefined)));
|
|
53
|
-
const onDidChangeVisibleRanges =
|
|
50
|
+
const onDidChangeVisibleRanges = debouncedObservable(observableFromEvent(this.notebookEditor.onDidChangeVisibleRanges, () => this.notebookEditor.visibleRanges), 50);
|
|
54
51
|
const decorators = ( new Map());
|
|
55
52
|
let updatedCellDecoratorsOnceBefore = false;
|
|
56
53
|
let updatedDeletedInsertedDecoratorsOnceBefore = false;
|
|
@@ -63,12 +60,13 @@ let NotebookChatEditorController = class NotebookChatEditorController extends Di
|
|
|
63
60
|
this._register(toDisposable(() => clearDecorators()));
|
|
64
61
|
let notebookSynchronizer;
|
|
65
62
|
const entryObs = derived((r) => {
|
|
66
|
-
const session = this._chatEditingService.currentEditingSessionObs.read(r);
|
|
67
63
|
const model = notebookModel.read(r);
|
|
68
|
-
if (!model
|
|
64
|
+
if (!model) {
|
|
69
65
|
return;
|
|
70
66
|
}
|
|
71
|
-
|
|
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;
|
|
72
70
|
}).recomputeInitiallyAndOnChange(this._store);
|
|
73
71
|
this._register(autorun(r => {
|
|
74
72
|
const entry = entryObs.read(r);
|
|
@@ -177,6 +175,5 @@ NotebookChatEditorController = ( __decorate([
|
|
|
177
175
|
( __param(4, IInstantiationService)),
|
|
178
176
|
( __param(5, IContextKeyService))
|
|
179
177
|
], NotebookChatEditorController));
|
|
180
|
-
registerNotebookContribution(NotebookChatEditorControllerContrib.ID, NotebookChatEditorControllerContrib);
|
|
181
178
|
|
|
182
179
|
export { NotebookChatEditorControllerContrib };
|
|
@@ -3,8 +3,8 @@ import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
3
3
|
import { ITextModel } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
4
4
|
import { CellKind } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
5
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";
|
|
7
|
-
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model";
|
|
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
8
|
import { INotebookOriginalCellModelFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.service";
|
|
9
9
|
export declare class OriginalNotebookCellModelReferenceCollection extends ReferenceCollection<ITextModel> {
|
|
10
10
|
private readonly modelService;
|
|
@@ -4,8 +4,8 @@ import { ReferenceCollection } from '@codingame/monaco-vscode-api/vscode/vs/base
|
|
|
4
4
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
5
|
import { CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
6
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';
|
|
8
|
-
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model';
|
|
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
9
|
|
|
10
10
|
let OriginalNotebookCellModelReferenceCollection = class OriginalNotebookCellModelReferenceCollection extends ReferenceCollection {
|
|
11
11
|
constructor(modelService, _languageService) {
|
|
@@ -3,11 +3,13 @@ import { IModifiedFileEntry } from "@codingame/monaco-vscode-api/vscode/vs/workb
|
|
|
3
3
|
import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
|
|
4
4
|
import { NotebookTextModel } from "../../../common/model/notebookTextModel.js";
|
|
5
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";
|
|
6
7
|
import { INotebookOriginalModelReferenceFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.service";
|
|
7
8
|
export declare class OriginalNotebookModelReferenceCollection extends ReferenceCollection<Promise<NotebookTextModel>> {
|
|
8
9
|
private readonly notebookService;
|
|
10
|
+
private readonly modelService;
|
|
9
11
|
private readonly modelsToDispose;
|
|
10
|
-
constructor(notebookService: INotebookService);
|
|
12
|
+
constructor(notebookService: INotebookService, modelService: ITextModelService);
|
|
11
13
|
protected createReferencedObject(key: string, fileEntry: IModifiedFileEntry, viewType: string): Promise<NotebookTextModel>;
|
|
12
14
|
protected destroyReferencedObject(key: string, modelPromise: Promise<NotebookTextModel>): void;
|
|
13
15
|
}
|
|
@@ -4,11 +4,13 @@ import { ReferenceCollection, AsyncReferenceCollection } from '@codingame/monaco
|
|
|
4
4
|
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
5
5
|
import { VSBuffer, bufferToStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
6
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';
|
|
7
8
|
|
|
8
9
|
let OriginalNotebookModelReferenceCollection = class OriginalNotebookModelReferenceCollection extends ReferenceCollection {
|
|
9
|
-
constructor(notebookService) {
|
|
10
|
+
constructor(notebookService, modelService) {
|
|
10
11
|
super();
|
|
11
12
|
this.notebookService = notebookService;
|
|
13
|
+
this.modelService = modelService;
|
|
12
14
|
this.modelsToDispose = ( new Set());
|
|
13
15
|
}
|
|
14
16
|
async createReferencedObject(key, fileEntry, viewType) {
|
|
@@ -18,8 +20,10 @@ let OriginalNotebookModelReferenceCollection = class OriginalNotebookModelRefere
|
|
|
18
20
|
if (model) {
|
|
19
21
|
return model;
|
|
20
22
|
}
|
|
21
|
-
const
|
|
23
|
+
const modelRef = await this.modelService.createModelReference(uri);
|
|
24
|
+
const bytes = VSBuffer.fromString(modelRef.object.textEditorModel.getValue());
|
|
22
25
|
const stream = bufferToStream(bytes);
|
|
26
|
+
modelRef.dispose();
|
|
23
27
|
return this.notebookService.createNotebookTextModel(viewType, uri, stream);
|
|
24
28
|
}
|
|
25
29
|
destroyReferencedObject(key, modelPromise) {
|
|
@@ -41,7 +45,8 @@ let OriginalNotebookModelReferenceCollection = class OriginalNotebookModelRefere
|
|
|
41
45
|
}
|
|
42
46
|
};
|
|
43
47
|
OriginalNotebookModelReferenceCollection = ( __decorate([
|
|
44
|
-
( __param(0, INotebookService))
|
|
48
|
+
( __param(0, INotebookService)),
|
|
49
|
+
( __param(1, ITextModelService))
|
|
45
50
|
], OriginalNotebookModelReferenceCollection));
|
|
46
51
|
let NotebookOriginalModelReferenceFactory = class NotebookOriginalModelReferenceFactory {
|
|
47
52
|
get resourceModelCollection() {
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Disposable, IReference } from "@codingame/monaco-vscode-api/vscode/vs/b
|
|
|
2
2
|
import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service";
|
|
3
3
|
import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
|
|
4
4
|
import { NotebookTextModel } from "../../../common/model/notebookTextModel.js";
|
|
5
|
-
import { CellDiffInfo } from "@codingame/monaco-vscode-
|
|
5
|
+
import { CellDiffInfo } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel";
|
|
6
6
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
7
7
|
import { INotebookEditorWorkerService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/services/notebookWorkerService.service";
|
|
8
8
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
@@ -12,8 +12,9 @@ import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/c
|
|
|
12
12
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
13
13
|
import { INotebookOriginalModelReferenceFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.service";
|
|
14
14
|
import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
|
|
15
|
-
import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService";
|
|
15
|
+
import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
|
|
16
16
|
import { INotebookEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service";
|
|
17
|
+
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
|
|
17
18
|
import { INotebookModelSynchronizerFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.service";
|
|
18
19
|
export declare class NotebookModelSynchronizerFactory implements INotebookModelSynchronizerFactory {
|
|
19
20
|
readonly _serviceBrand: undefined;
|
|
@@ -25,6 +26,7 @@ export declare class NotebookModelSynchronizer extends Disposable {
|
|
|
25
26
|
private readonly model;
|
|
26
27
|
private readonly notebookService;
|
|
27
28
|
private readonly notebookEditorService;
|
|
29
|
+
private readonly modelService;
|
|
28
30
|
private readonly textModelService;
|
|
29
31
|
private readonly logService;
|
|
30
32
|
private readonly configurationService;
|
|
@@ -42,14 +44,14 @@ export declare class NotebookModelSynchronizer extends Disposable {
|
|
|
42
44
|
private isTextEditFromUs;
|
|
43
45
|
private isReverting;
|
|
44
46
|
private throttledTextModelUpdate;
|
|
45
|
-
constructor(model: NotebookTextModel, _chatEditingService: IChatEditingService, notebookService: INotebookService, notebookEditorService: INotebookEditorService, chatService: IChatService, textModelService: ITextModelService, logService: INotebookLoggingService, configurationService: IConfigurationService, notebookEditorWorkerService: INotebookEditorWorkerService, notebookModelResolverService: INotebookEditorModelResolverService, originalModelRefFactory: INotebookOriginalModelReferenceFactory);
|
|
47
|
+
constructor(model: NotebookTextModel, _chatEditingService: IChatEditingService, notebookService: INotebookService, notebookEditorService: INotebookEditorService, chatService: IChatService, modelService: IModelService, textModelService: ITextModelService, logService: INotebookLoggingService, configurationService: IConfigurationService, notebookEditorWorkerService: INotebookEditorWorkerService, notebookModelResolverService: INotebookEditorModelResolverService, originalModelRefFactory: INotebookOriginalModelReferenceFactory);
|
|
46
48
|
private createSnapshot;
|
|
47
49
|
revert(): Promise<void>;
|
|
48
50
|
private revertImpl;
|
|
49
51
|
private updateNotebook;
|
|
50
52
|
private accept;
|
|
51
53
|
private updateTextDocumentModel;
|
|
52
|
-
getNotebookSerializer(): Promise<import("@codingame/monaco-vscode-
|
|
54
|
+
getNotebookSerializer(): Promise<import("@codingame/monaco-vscode-9b5a5e82-d649-5455-b4bf-ef90d6afd294-common/vscode/vs/workbench/contrib/notebook/common/notebookService").INotebookSerializer>;
|
|
53
55
|
private _originalModel?;
|
|
54
56
|
private getOriginalModel;
|
|
55
57
|
private updateNotebookModel;
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.js
CHANGED
|
@@ -6,7 +6,7 @@ import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/work
|
|
|
6
6
|
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
7
7
|
import { VSBuffer, streamToBuffer, bufferToStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
8
8
|
import { ThrottledDelayer, raceCancellation } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
9
|
-
import { prettyChanges, computeDiff } from '@codingame/monaco-vscode-
|
|
9
|
+
import { prettyChanges, computeDiff } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel';
|
|
10
10
|
import { CancellationTokenSource, CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
11
11
|
import { INotebookEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/services/notebookWorkerService.service';
|
|
12
12
|
import { NotebookSetting, CellEditType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
@@ -18,17 +18,17 @@ import { INotebookEditorModelResolverService } from '@codingame/monaco-vscode-ap
|
|
|
18
18
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
19
19
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
20
20
|
import { INotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.service';
|
|
21
|
-
import
|
|
22
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
23
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
24
|
-
import { autorunWithStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
25
|
-
import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
26
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
|
|
21
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
27
22
|
import { SaveReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
28
|
-
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService';
|
|
29
|
-
import { SnapshotContext } from '@codingame/monaco-vscode-
|
|
23
|
+
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
24
|
+
import { SnapshotContext } from '@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy';
|
|
30
25
|
import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
|
|
31
|
-
import { CellEditState } from '@codingame/monaco-vscode-
|
|
26
|
+
import { CellEditState } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
27
|
+
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
28
|
+
import { ChatEditingModifiedDocumentEntry } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry';
|
|
29
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
|
|
30
|
+
import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
31
|
+
import { autorunWithStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
32
32
|
|
|
33
33
|
let NotebookModelSynchronizerReferenceCollection = class NotebookModelSynchronizerReferenceCollection extends ReferenceCollection {
|
|
34
34
|
constructor(instantiationService) {
|
|
@@ -60,11 +60,12 @@ let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposab
|
|
|
60
60
|
get diffInfo() {
|
|
61
61
|
return this._diffInfo;
|
|
62
62
|
}
|
|
63
|
-
constructor(model, _chatEditingService, notebookService, notebookEditorService, chatService, textModelService, logService, configurationService, notebookEditorWorkerService, notebookModelResolverService, originalModelRefFactory) {
|
|
63
|
+
constructor(model, _chatEditingService, notebookService, notebookEditorService, chatService, modelService, textModelService, logService, configurationService, notebookEditorWorkerService, notebookModelResolverService, originalModelRefFactory) {
|
|
64
64
|
super();
|
|
65
65
|
this.model = model;
|
|
66
66
|
this.notebookService = notebookService;
|
|
67
67
|
this.notebookEditorService = notebookEditorService;
|
|
68
|
+
this.modelService = modelService;
|
|
68
69
|
this.textModelService = textModelService;
|
|
69
70
|
this.logService = logService;
|
|
70
71
|
this.configurationService = configurationService;
|
|
@@ -78,11 +79,9 @@ let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposab
|
|
|
78
79
|
this.isReverting = false;
|
|
79
80
|
this.throttledTextModelUpdate = ( new ThrottledDelayer(100));
|
|
80
81
|
const entryObs = derived((r) => {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
return session.readEntry(model.uri, r);
|
|
82
|
+
const sessions = _chatEditingService.editingSessionsObs.read(r);
|
|
83
|
+
const entry = ( sessions.map(s => s.readEntry(model.uri, r))).find(r => !!r);
|
|
84
|
+
return entry instanceof ChatEditingModifiedDocumentEntry ? entry : undefined;
|
|
86
85
|
}).recomputeInitiallyAndOnChange(this._store);
|
|
87
86
|
this._register(chatService.onDidPerformUserAction(async (e) => {
|
|
88
87
|
const entry = entryObs.read(undefined);
|
|
@@ -113,10 +112,14 @@ let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposab
|
|
|
113
112
|
this.createSnapshot();
|
|
114
113
|
snapshotCreated = true;
|
|
115
114
|
}
|
|
116
|
-
const modifiedModel = entry.
|
|
115
|
+
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
116
|
+
if (!modifiedModel) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
117
119
|
let cancellationToken = store.add(( new CancellationTokenSource()));
|
|
118
120
|
store.add(modifiedModel.onDidChangeContent(async () => {
|
|
119
|
-
|
|
121
|
+
const originalModel = this.modelService.getModel(entry.originalURI);
|
|
122
|
+
if (originalModel && !this.isTextEditFromUs && !modifiedModel.isDisposed() && !originalModel.isDisposed() && modifiedModel.getValue() !== originalModel.getValue()) {
|
|
120
123
|
cancellationToken = store.add(( new CancellationTokenSource()));
|
|
121
124
|
updateNotebookModel(entry, cancellationToken.token);
|
|
122
125
|
}
|
|
@@ -213,7 +216,10 @@ let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposab
|
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
218
|
async accept(entry) {
|
|
216
|
-
const modifiedModel = entry.
|
|
219
|
+
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
220
|
+
if (!modifiedModel) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
217
223
|
const content = modifiedModel.getValue();
|
|
218
224
|
await this.updateNotebook(VSBuffer.fromString(content), false);
|
|
219
225
|
this._diffInfo.set(undefined, undefined);
|
|
@@ -222,7 +228,10 @@ let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposab
|
|
|
222
228
|
await this.notebookService.restoreNotebookTextModelFromSnapshot(originalModel.uri, originalModel.viewType, stream);
|
|
223
229
|
}
|
|
224
230
|
async updateTextDocumentModel(entry) {
|
|
225
|
-
const modifiedModel = entry.
|
|
231
|
+
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
232
|
+
if (!modifiedModel) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
226
235
|
const stream = await this.notebookService.createNotebookTextDocumentSnapshot(this.model.uri, SnapshotContext.Save, CancellationToken.None);
|
|
227
236
|
const buffer = await streamToBuffer(stream);
|
|
228
237
|
const text = ( new TextDecoder()).decode(buffer.buffer);
|
|
@@ -249,7 +258,11 @@ let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposab
|
|
|
249
258
|
return this._originalModel;
|
|
250
259
|
}
|
|
251
260
|
async updateNotebookModel(entry, token) {
|
|
252
|
-
const
|
|
261
|
+
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
262
|
+
if (!modifiedModel) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const modifiedModelVersion = modifiedModel.getVersionId();
|
|
253
266
|
const currentModel = this.model;
|
|
254
267
|
const modelVersion = currentModel?.versionId ?? 0;
|
|
255
268
|
const modelWithChatEdits = await this.getModifiedModelForDiff(entry, token);
|
|
@@ -259,7 +272,7 @@ let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposab
|
|
|
259
272
|
const originalModel = await this.getOriginalModel(entry);
|
|
260
273
|
const cellDiffInfo = (await this.computeDiff(originalModel, modelWithChatEdits, token))?.cellDiffInfo;
|
|
261
274
|
const cellDiffInfoToApplyEdits = (await this.computeDiff(currentModel, modelWithChatEdits, token))?.cellDiffInfo;
|
|
262
|
-
const currentVersion =
|
|
275
|
+
const currentVersion = modifiedModel.getVersionId();
|
|
263
276
|
if (!cellDiffInfo || !cellDiffInfoToApplyEdits || token.isCancellationRequested || currentVersion !== modifiedModelVersion || modelVersion !== currentModel.versionId) {
|
|
264
277
|
return;
|
|
265
278
|
}
|
|
@@ -377,7 +390,11 @@ let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposab
|
|
|
377
390
|
}
|
|
378
391
|
}
|
|
379
392
|
async getModifiedModelForDiff(entry, token) {
|
|
380
|
-
const
|
|
393
|
+
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
394
|
+
if (!modifiedModel) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const text = modifiedModel.getValue();
|
|
381
398
|
const bytes = VSBuffer.fromString(text);
|
|
382
399
|
const uri = entry.modifiedURI.with({ scheme: `NotebookChatEditorController.modifiedScheme${( Date.now().toString())}` });
|
|
383
400
|
const stream = bufferToStream(bytes);
|
|
@@ -414,12 +431,13 @@ NotebookModelSynchronizer = ( __decorate([
|
|
|
414
431
|
( __param(2, INotebookService)),
|
|
415
432
|
( __param(3, INotebookEditorService)),
|
|
416
433
|
( __param(4, IChatService)),
|
|
417
|
-
( __param(5,
|
|
418
|
-
( __param(6,
|
|
419
|
-
( __param(7,
|
|
420
|
-
( __param(8,
|
|
421
|
-
( __param(9,
|
|
422
|
-
( __param(10,
|
|
434
|
+
( __param(5, IModelService)),
|
|
435
|
+
( __param(6, ITextModelService)),
|
|
436
|
+
( __param(7, INotebookLoggingService)),
|
|
437
|
+
( __param(8, IConfigurationService)),
|
|
438
|
+
( __param(9, INotebookEditorWorkerService)),
|
|
439
|
+
( __param(10, INotebookEditorModelResolverService)),
|
|
440
|
+
( __param(11, INotebookOriginalModelReferenceFactory))
|
|
423
441
|
], NotebookModelSynchronizer));
|
|
424
442
|
|
|
425
443
|
export { NotebookModelSynchronizer, NotebookModelSynchronizerFactory };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
2
|
-
import { IStoredFileWorkingCopy } from "@codingame/monaco-vscode-
|
|
2
|
+
import { IStoredFileWorkingCopy } from "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy";
|
|
3
3
|
import { IUntitledFileWorkingCopy } from "../../../../../services/workingCopy/common/untitledFileWorkingCopy.js";
|
|
4
4
|
import { IWorkingCopyFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service";
|
|
5
5
|
import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service";
|
|
6
|
-
import { NotebookFileWorkingCopyModel } from "@codingame/monaco-vscode-
|
|
6
|
+
import { NotebookFileWorkingCopyModel } from "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/contrib/notebook/common/notebookEditorModel";
|
|
7
7
|
import { INotebookSynchronizerService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookSynchronizerService.service";
|
|
8
8
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
9
9
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
10
|
+
import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
|
|
10
11
|
export declare class NotebookSynchronizerService extends Disposable implements INotebookSynchronizerService {
|
|
11
12
|
private readonly _chatEditingService;
|
|
12
13
|
protected readonly _fileService: IFileService;
|
|
14
|
+
private readonly _notebookService;
|
|
13
15
|
private readonly _instantiationService;
|
|
14
16
|
private readonly _workingCopyFileService;
|
|
15
17
|
_serviceBrand: undefined;
|
|
16
|
-
constructor(_chatEditingService: IChatEditingService, _fileService: IFileService, _instantiationService: IInstantiationService, _workingCopyFileService: IWorkingCopyFileService);
|
|
18
|
+
constructor(_chatEditingService: IChatEditingService, _fileService: IFileService, _notebookService: INotebookService, _instantiationService: IInstantiationService, _workingCopyFileService: IWorkingCopyFileService);
|
|
17
19
|
revert(workingCopy: IStoredFileWorkingCopy<NotebookFileWorkingCopyModel> | IUntitledFileWorkingCopy<NotebookFileWorkingCopyModel>): Promise<void>;
|
|
18
20
|
}
|