@codingame/monaco-vscode-notebook-service-override 15.0.3 → 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.
- package/index.js +5 -11
- package/package.json +27 -26
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css +6 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +22 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +7 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +7 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +12 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +1 -1
- 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.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +10 -10
- 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.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +28 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +54 -31
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +26 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +18 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +22 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +72 -74
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.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 +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +54 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +42 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +10 -2
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/{notebookSimpleWorker.d.ts → notebookWebWorker.d.ts} +24 -6
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +366 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain.js +5 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +1 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +1 -1
- package/worker.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/contribution.js +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.js +0 -332
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.js +0 -299
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.js +0 -179
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.js +0 -42
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.js +0 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.d.ts +0 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.js +0 -443
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.js +0 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +0 -279
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.js +0 -5
- /package/vscode/src/vs/workbench/contrib/notebook/{browser/contrib/chatEdit/contribution.d.ts → common/services/notebookWebWorkerMain.d.ts} +0 -0
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Disposable, IReference } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service";
|
|
3
|
-
import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
|
|
4
|
-
import { NotebookTextModel } from "../../../common/model/notebookTextModel.js";
|
|
5
|
-
import { CellDiffInfo } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel";
|
|
6
|
-
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
7
|
-
import { INotebookEditorWorkerService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/services/notebookWorkerService.service";
|
|
8
|
-
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
9
|
-
import { INotebookLoggingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookLoggingService.service";
|
|
10
|
-
import { INotebookEditorModelResolverService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.service";
|
|
11
|
-
import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service";
|
|
12
|
-
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
13
|
-
import { INotebookOriginalModelReferenceFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.service";
|
|
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.service";
|
|
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";
|
|
18
|
-
import { INotebookModelSynchronizerFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.service";
|
|
19
|
-
export declare class NotebookModelSynchronizerFactory implements INotebookModelSynchronizerFactory {
|
|
20
|
-
readonly _serviceBrand: undefined;
|
|
21
|
-
private readonly _data;
|
|
22
|
-
constructor(instantiationService: IInstantiationService);
|
|
23
|
-
getOrCreate(model: NotebookTextModel): IReference<NotebookModelSynchronizer>;
|
|
24
|
-
}
|
|
25
|
-
export declare class NotebookModelSynchronizer extends Disposable {
|
|
26
|
-
private readonly model;
|
|
27
|
-
private readonly notebookService;
|
|
28
|
-
private readonly notebookEditorService;
|
|
29
|
-
private readonly modelService;
|
|
30
|
-
private readonly textModelService;
|
|
31
|
-
private readonly logService;
|
|
32
|
-
private readonly configurationService;
|
|
33
|
-
private readonly notebookEditorWorkerService;
|
|
34
|
-
private readonly notebookModelResolverService;
|
|
35
|
-
private readonly originalModelRefFactory;
|
|
36
|
-
private readonly throttledUpdateNotebookModel;
|
|
37
|
-
private _diffInfo;
|
|
38
|
-
get diffInfo(): IObservable<{
|
|
39
|
-
cellDiff: CellDiffInfo[];
|
|
40
|
-
modelVersion: number;
|
|
41
|
-
} | undefined>;
|
|
42
|
-
private snapshot?;
|
|
43
|
-
private isEditFromUs;
|
|
44
|
-
private isTextEditFromUs;
|
|
45
|
-
private isReverting;
|
|
46
|
-
private throttledTextModelUpdate;
|
|
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);
|
|
48
|
-
private createSnapshot;
|
|
49
|
-
revert(): Promise<void>;
|
|
50
|
-
private revertImpl;
|
|
51
|
-
private updateNotebook;
|
|
52
|
-
private accept;
|
|
53
|
-
private updateTextDocumentModel;
|
|
54
|
-
getNotebookSerializer(): Promise<import("@codingame/monaco-vscode-9b5a5e82-d649-5455-b4bf-ef90d6afd294-common/vscode/vs/workbench/contrib/notebook/common/notebookService").INotebookSerializer>;
|
|
55
|
-
private _originalModel?;
|
|
56
|
-
private getOriginalModel;
|
|
57
|
-
private updateNotebookModel;
|
|
58
|
-
private previousUriOfModelForDiff?;
|
|
59
|
-
private getModifiedModelForDiff;
|
|
60
|
-
computeDiff(original: NotebookTextModel, modified: NotebookTextModel, token: CancellationToken): Promise<{
|
|
61
|
-
cellDiffInfo: CellDiffInfo[];
|
|
62
|
-
firstChangeIndex: number;
|
|
63
|
-
} | undefined>;
|
|
64
|
-
}
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.js
DELETED
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
4
|
-
import { ReferenceCollection, Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
6
|
-
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
7
|
-
import { VSBuffer, streamToBuffer, bufferToStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
8
|
-
import { ThrottledDelayer, raceCancellation } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
9
|
-
import { prettyChanges, computeDiff } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel';
|
|
10
|
-
import { CancellationTokenSource, CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
11
|
-
import { INotebookEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/services/notebookWorkerService.service';
|
|
12
|
-
import { NotebookSetting, CellEditType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
13
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
14
|
-
import { EditOperation } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/editOperation';
|
|
15
|
-
import { INotebookLoggingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookLoggingService.service';
|
|
16
|
-
import { filter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
17
|
-
import { INotebookEditorModelResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.service';
|
|
18
|
-
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
19
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
20
|
-
import { INotebookOriginalModelReferenceFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.service';
|
|
21
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
22
|
-
import { SaveReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
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';
|
|
25
|
-
import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
|
|
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
|
-
|
|
33
|
-
let NotebookModelSynchronizerReferenceCollection = class NotebookModelSynchronizerReferenceCollection extends ReferenceCollection {
|
|
34
|
-
constructor(instantiationService) {
|
|
35
|
-
super();
|
|
36
|
-
this.instantiationService = instantiationService;
|
|
37
|
-
}
|
|
38
|
-
createReferencedObject(_key, model) {
|
|
39
|
-
return this.instantiationService.createInstance(NotebookModelSynchronizer, model);
|
|
40
|
-
}
|
|
41
|
-
destroyReferencedObject(_key, object) {
|
|
42
|
-
object.dispose();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
NotebookModelSynchronizerReferenceCollection = ( __decorate([
|
|
46
|
-
( __param(0, IInstantiationService))
|
|
47
|
-
], NotebookModelSynchronizerReferenceCollection));
|
|
48
|
-
let NotebookModelSynchronizerFactory = class NotebookModelSynchronizerFactory {
|
|
49
|
-
constructor(instantiationService) {
|
|
50
|
-
this._data = instantiationService.createInstance(NotebookModelSynchronizerReferenceCollection);
|
|
51
|
-
}
|
|
52
|
-
getOrCreate(model) {
|
|
53
|
-
return this._data.acquire(( model.uri.toString()), model);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
NotebookModelSynchronizerFactory = ( __decorate([
|
|
57
|
-
( __param(0, IInstantiationService))
|
|
58
|
-
], NotebookModelSynchronizerFactory));
|
|
59
|
-
let NotebookModelSynchronizer = class NotebookModelSynchronizer extends Disposable {
|
|
60
|
-
get diffInfo() {
|
|
61
|
-
return this._diffInfo;
|
|
62
|
-
}
|
|
63
|
-
constructor(model, _chatEditingService, notebookService, notebookEditorService, chatService, modelService, textModelService, logService, configurationService, notebookEditorWorkerService, notebookModelResolverService, originalModelRefFactory) {
|
|
64
|
-
super();
|
|
65
|
-
this.model = model;
|
|
66
|
-
this.notebookService = notebookService;
|
|
67
|
-
this.notebookEditorService = notebookEditorService;
|
|
68
|
-
this.modelService = modelService;
|
|
69
|
-
this.textModelService = textModelService;
|
|
70
|
-
this.logService = logService;
|
|
71
|
-
this.configurationService = configurationService;
|
|
72
|
-
this.notebookEditorWorkerService = notebookEditorWorkerService;
|
|
73
|
-
this.notebookModelResolverService = notebookModelResolverService;
|
|
74
|
-
this.originalModelRefFactory = originalModelRefFactory;
|
|
75
|
-
this.throttledUpdateNotebookModel = ( new ThrottledDelayer(200));
|
|
76
|
-
this._diffInfo = observableValue('diffInfo', undefined);
|
|
77
|
-
this.isEditFromUs = false;
|
|
78
|
-
this.isTextEditFromUs = false;
|
|
79
|
-
this.isReverting = false;
|
|
80
|
-
this.throttledTextModelUpdate = ( new ThrottledDelayer(100));
|
|
81
|
-
const entryObs = derived((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;
|
|
85
|
-
}).recomputeInitiallyAndOnChange(this._store);
|
|
86
|
-
this._register(chatService.onDidPerformUserAction(async (e) => {
|
|
87
|
-
const entry = entryObs.read(undefined);
|
|
88
|
-
if (!entry) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (e.action.kind === 'chatEditingSessionAction' && !e.action.hasRemainingEdits && isEqual(e.action.uri, entry.modifiedURI)) {
|
|
92
|
-
if (e.action.outcome === 'accepted') {
|
|
93
|
-
await this.accept(entry);
|
|
94
|
-
await this.createSnapshot();
|
|
95
|
-
this._diffInfo.set(undefined, undefined);
|
|
96
|
-
}
|
|
97
|
-
else if (e.action.outcome === 'rejected') {
|
|
98
|
-
await this.revertImpl();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}));
|
|
102
|
-
const updateNotebookModel = (entry, token) => {
|
|
103
|
-
this.throttledUpdateNotebookModel.trigger(() => this.updateNotebookModel(entry, token));
|
|
104
|
-
};
|
|
105
|
-
let snapshotCreated = false;
|
|
106
|
-
this._register(autorunWithStore((r, store) => {
|
|
107
|
-
const entry = entryObs.read(r);
|
|
108
|
-
if (!entry) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (!snapshotCreated) {
|
|
112
|
-
this.createSnapshot();
|
|
113
|
-
snapshotCreated = true;
|
|
114
|
-
}
|
|
115
|
-
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
116
|
-
if (!modifiedModel) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
let cancellationToken = store.add(( new CancellationTokenSource()));
|
|
120
|
-
store.add(modifiedModel.onDidChangeContent(async () => {
|
|
121
|
-
const originalModel = this.modelService.getModel(entry.originalURI);
|
|
122
|
-
if (originalModel && !this.isTextEditFromUs && !modifiedModel.isDisposed() && !originalModel.isDisposed() && modifiedModel.getValue() !== originalModel.getValue()) {
|
|
123
|
-
cancellationToken = store.add(( new CancellationTokenSource()));
|
|
124
|
-
updateNotebookModel(entry, cancellationToken.token);
|
|
125
|
-
}
|
|
126
|
-
}));
|
|
127
|
-
updateNotebookModel(entry, cancellationToken.token);
|
|
128
|
-
}));
|
|
129
|
-
this._register(model.onDidChangeContent(() => {
|
|
130
|
-
if (!this.isEditFromUs && this.snapshot) {
|
|
131
|
-
this.snapshot.dirty = true;
|
|
132
|
-
const entry = entryObs.get();
|
|
133
|
-
if (entry) {
|
|
134
|
-
this.throttledTextModelUpdate.trigger(() => this.updateTextDocumentModel(entry));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
async createSnapshot() {
|
|
140
|
-
const [serializer, ref] = await Promise.all([
|
|
141
|
-
this.getNotebookSerializer(),
|
|
142
|
-
this.notebookModelResolverService.resolve(this.model.uri)
|
|
143
|
-
]);
|
|
144
|
-
try {
|
|
145
|
-
const data = {
|
|
146
|
-
metadata: filter(this.model.metadata, key => !serializer.options.transientDocumentMetadata[key]),
|
|
147
|
-
cells: [],
|
|
148
|
-
};
|
|
149
|
-
const indentAmount = this.model.metadata.indentAmount || ref.object.notebook.metadata.indentAmount || undefined;
|
|
150
|
-
if (typeof indentAmount === 'string' && indentAmount) {
|
|
151
|
-
data.metadata.indentAmount = indentAmount;
|
|
152
|
-
}
|
|
153
|
-
let outputSize = 0;
|
|
154
|
-
for (const cell of this.model.cells) {
|
|
155
|
-
const cellData = {
|
|
156
|
-
cellKind: cell.cellKind,
|
|
157
|
-
language: cell.language,
|
|
158
|
-
mime: cell.mime,
|
|
159
|
-
source: cell.getValue(),
|
|
160
|
-
outputs: [],
|
|
161
|
-
internalMetadata: cell.internalMetadata
|
|
162
|
-
};
|
|
163
|
-
const outputSizeLimit = this.configurationService.getValue(NotebookSetting.outputBackupSizeLimit) * 1024;
|
|
164
|
-
if (outputSizeLimit > 0) {
|
|
165
|
-
cell.outputs.forEach(output => {
|
|
166
|
-
output.outputs.forEach(item => {
|
|
167
|
-
outputSize += item.data.byteLength;
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
if (outputSize > outputSizeLimit) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
cellData.outputs = !serializer.options.transientOutputs ? cell.outputs : [];
|
|
175
|
-
cellData.metadata = filter(cell.metadata, key => !serializer.options.transientCellMetadata[key]);
|
|
176
|
-
data.cells.push(cellData);
|
|
177
|
-
}
|
|
178
|
-
const bytes = await serializer.notebookToData(data);
|
|
179
|
-
this.snapshot = { bytes, dirty: ref.object.isDirty() };
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
ref.dispose();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
async revert() {
|
|
186
|
-
await this.revertImpl();
|
|
187
|
-
}
|
|
188
|
-
async revertImpl() {
|
|
189
|
-
if (!this.snapshot || this.isReverting) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
this.isReverting = true;
|
|
193
|
-
try {
|
|
194
|
-
await this.updateNotebook(this.snapshot.bytes, !this.snapshot.dirty);
|
|
195
|
-
}
|
|
196
|
-
finally {
|
|
197
|
-
this.isReverting = false;
|
|
198
|
-
this._diffInfo.set(undefined, undefined);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
async updateNotebook(bytes, saveForRevert) {
|
|
202
|
-
const oldEditIsFromus = this.isEditFromUs;
|
|
203
|
-
this.isEditFromUs = true;
|
|
204
|
-
const ref = await this.notebookModelResolverService.resolve(this.model.uri);
|
|
205
|
-
try {
|
|
206
|
-
const serializer = await this.getNotebookSerializer();
|
|
207
|
-
const data = await serializer.dataToNotebook(bytes);
|
|
208
|
-
this.model.reset(data.cells, data.metadata, serializer.options);
|
|
209
|
-
if (saveForRevert) {
|
|
210
|
-
await ref.object.save({ reason: SaveReason.EXPLICIT, force: true, ignoreModifiedSince: true });
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
finally {
|
|
214
|
-
ref.dispose();
|
|
215
|
-
this.isEditFromUs = oldEditIsFromus;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
async accept(entry) {
|
|
219
|
-
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
220
|
-
if (!modifiedModel) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
const content = modifiedModel.getValue();
|
|
224
|
-
await this.updateNotebook(VSBuffer.fromString(content), false);
|
|
225
|
-
this._diffInfo.set(undefined, undefined);
|
|
226
|
-
const stream = await this.notebookService.createNotebookTextDocumentSnapshot(this.model.uri, SnapshotContext.Save, CancellationToken.None);
|
|
227
|
-
const originalModel = await this.getOriginalModel(entry);
|
|
228
|
-
await this.notebookService.restoreNotebookTextModelFromSnapshot(originalModel.uri, originalModel.viewType, stream);
|
|
229
|
-
}
|
|
230
|
-
async updateTextDocumentModel(entry) {
|
|
231
|
-
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
232
|
-
if (!modifiedModel) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
const stream = await this.notebookService.createNotebookTextDocumentSnapshot(this.model.uri, SnapshotContext.Save, CancellationToken.None);
|
|
236
|
-
const buffer = await streamToBuffer(stream);
|
|
237
|
-
const text = ( new TextDecoder()).decode(buffer.buffer);
|
|
238
|
-
this.isTextEditFromUs = true;
|
|
239
|
-
modifiedModel.pushEditOperations(null, [{ range: modifiedModel.getFullModelRange(), text }], () => null);
|
|
240
|
-
this.isTextEditFromUs = false;
|
|
241
|
-
}
|
|
242
|
-
async getNotebookSerializer() {
|
|
243
|
-
const info = await this.notebookService.withNotebookDataProvider(this.model.viewType);
|
|
244
|
-
return info.serializer;
|
|
245
|
-
}
|
|
246
|
-
async getOriginalModel(entry) {
|
|
247
|
-
if (!this._originalModel) {
|
|
248
|
-
this._originalModel = this.originalModelRefFactory.getOrCreate(entry, this.model.viewType).then(ref => {
|
|
249
|
-
if (this._store.isDisposed) {
|
|
250
|
-
ref.dispose();
|
|
251
|
-
return ref.object;
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
return this._register(ref).object;
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
return this._originalModel;
|
|
259
|
-
}
|
|
260
|
-
async updateNotebookModel(entry, token) {
|
|
261
|
-
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
262
|
-
if (!modifiedModel) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
const modifiedModelVersion = modifiedModel.getVersionId();
|
|
266
|
-
const currentModel = this.model;
|
|
267
|
-
const modelVersion = currentModel?.versionId ?? 0;
|
|
268
|
-
const modelWithChatEdits = await this.getModifiedModelForDiff(entry, token);
|
|
269
|
-
if (!modelWithChatEdits || token.isCancellationRequested || !currentModel) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const originalModel = await this.getOriginalModel(entry);
|
|
273
|
-
const cellDiffInfo = (await this.computeDiff(originalModel, modelWithChatEdits, token))?.cellDiffInfo;
|
|
274
|
-
const cellDiffInfoToApplyEdits = (await this.computeDiff(currentModel, modelWithChatEdits, token))?.cellDiffInfo;
|
|
275
|
-
const currentVersion = modifiedModel.getVersionId();
|
|
276
|
-
if (!cellDiffInfo || !cellDiffInfoToApplyEdits || token.isCancellationRequested || currentVersion !== modifiedModelVersion || modelVersion !== currentModel.versionId) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (cellDiffInfoToApplyEdits.every(d => d.type === 'unchanged')) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
this.isEditFromUs = true;
|
|
283
|
-
try {
|
|
284
|
-
const edits = [];
|
|
285
|
-
const mappings = ( new Map());
|
|
286
|
-
const deletedIndexes = [];
|
|
287
|
-
await Promise.all(( cellDiffInfoToApplyEdits.reverse().map(async (diff) => {
|
|
288
|
-
if (diff.type === 'delete') {
|
|
289
|
-
deletedIndexes.push(diff.originalCellIndex);
|
|
290
|
-
edits.push({
|
|
291
|
-
editType: CellEditType.Replace,
|
|
292
|
-
index: diff.originalCellIndex,
|
|
293
|
-
cells: [],
|
|
294
|
-
count: 1
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
})));
|
|
298
|
-
if (edits.length) {
|
|
299
|
-
currentModel.applyEdits(edits, true, undefined, () => undefined, undefined, false);
|
|
300
|
-
edits.length = 0;
|
|
301
|
-
}
|
|
302
|
-
const notebookEditor = this.notebookEditorService.retrieveExistingWidgetFromURI(this.model.uri)?.value;
|
|
303
|
-
cellDiffInfoToApplyEdits.reverse().forEach(diff => {
|
|
304
|
-
if (diff.type === 'modified' || diff.type === 'unchanged') {
|
|
305
|
-
mappings.set(diff.modifiedCellIndex, diff.originalCellIndex);
|
|
306
|
-
}
|
|
307
|
-
if (diff.type === 'insert') {
|
|
308
|
-
const originalIndex = mappings.get(diff.modifiedCellIndex - 1) ?? 0;
|
|
309
|
-
mappings.set(diff.modifiedCellIndex, originalIndex);
|
|
310
|
-
const index = currentModel.cells.length ? originalIndex + 1 : originalIndex;
|
|
311
|
-
const cell = modelWithChatEdits.cells[diff.modifiedCellIndex];
|
|
312
|
-
const newCell = {
|
|
313
|
-
source: cell.getValue(),
|
|
314
|
-
cellKind: cell.cellKind,
|
|
315
|
-
language: cell.language,
|
|
316
|
-
outputs: ( cell.outputs.map(output => output.asDto())),
|
|
317
|
-
mime: cell.mime,
|
|
318
|
-
metadata: cell.metadata,
|
|
319
|
-
collapseState: cell.collapseState,
|
|
320
|
-
internalMetadata: cell.internalMetadata
|
|
321
|
-
};
|
|
322
|
-
edits.push({
|
|
323
|
-
editType: CellEditType.Replace,
|
|
324
|
-
index,
|
|
325
|
-
cells: [newCell],
|
|
326
|
-
count: 0
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
if (edits.length) {
|
|
331
|
-
currentModel.applyEdits(edits, true, undefined, () => undefined, undefined, false);
|
|
332
|
-
for (const edit of edits.filter(e => e.editType === CellEditType.Replace)) {
|
|
333
|
-
const cell = currentModel.cells[edit.index];
|
|
334
|
-
if (cell) {
|
|
335
|
-
const cellViewModel = notebookEditor?.getCellByHandle(cell.handle);
|
|
336
|
-
cellViewModel?.updateEditState(CellEditState.Editing, 'chatEdit');
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
edits.length = 0;
|
|
340
|
-
}
|
|
341
|
-
await Promise.all(( cellDiffInfoToApplyEdits.map(async (diff) => {
|
|
342
|
-
if (diff.type === 'modified') {
|
|
343
|
-
const cell = currentModel.cells[diff.originalCellIndex];
|
|
344
|
-
const cellModelRef = await this.textModelService.createModelReference(cell.uri);
|
|
345
|
-
try {
|
|
346
|
-
const modifiedCell = modelWithChatEdits.cells[diff.modifiedCellIndex];
|
|
347
|
-
if (modifiedCell.cellKind === cell.cellKind) {
|
|
348
|
-
const cellViewModel = notebookEditor?.getCellByHandle(cell.handle);
|
|
349
|
-
cellViewModel?.updateEditState(CellEditState.Editing, 'chatEdit');
|
|
350
|
-
const textModel = cellModelRef.object.textEditorModel;
|
|
351
|
-
textModel.pushEditOperations(null, [
|
|
352
|
-
EditOperation.replace(textModel.getFullModelRange(), modifiedCell.getValue())
|
|
353
|
-
], () => null);
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
const newCellDto = {
|
|
357
|
-
source: modifiedCell.getValue(),
|
|
358
|
-
cellKind: modifiedCell.cellKind,
|
|
359
|
-
language: modifiedCell.language,
|
|
360
|
-
outputs: ( modifiedCell.outputs.map(output => output.asDto())),
|
|
361
|
-
mime: modifiedCell.mime,
|
|
362
|
-
metadata: modifiedCell.metadata,
|
|
363
|
-
collapseState: modifiedCell.collapseState,
|
|
364
|
-
internalMetadata: modifiedCell.internalMetadata
|
|
365
|
-
};
|
|
366
|
-
const edit = {
|
|
367
|
-
editType: CellEditType.Replace,
|
|
368
|
-
index: diff.originalCellIndex,
|
|
369
|
-
cells: [newCellDto],
|
|
370
|
-
count: 1
|
|
371
|
-
};
|
|
372
|
-
currentModel.applyEdits([edit], true, undefined, () => undefined, undefined, false);
|
|
373
|
-
const newCell = currentModel.cells[diff.originalCellIndex];
|
|
374
|
-
const cellViewModel = notebookEditor?.getCellByHandle(newCell.handle);
|
|
375
|
-
cellViewModel?.updateEditState(CellEditState.Editing, 'chatEdit');
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
finally {
|
|
379
|
-
cellModelRef.dispose();
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
})));
|
|
383
|
-
if (edits.length) {
|
|
384
|
-
currentModel.applyEdits(edits, true, undefined, () => undefined, undefined, false);
|
|
385
|
-
}
|
|
386
|
-
this._diffInfo.set({ cellDiff: cellDiffInfo, modelVersion: currentModel.versionId }, undefined);
|
|
387
|
-
}
|
|
388
|
-
finally {
|
|
389
|
-
this.isEditFromUs = false;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
async getModifiedModelForDiff(entry, token) {
|
|
393
|
-
const modifiedModel = this.modelService.getModel(entry.modifiedURI);
|
|
394
|
-
if (!modifiedModel) {
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
const text = modifiedModel.getValue();
|
|
398
|
-
const bytes = VSBuffer.fromString(text);
|
|
399
|
-
const uri = entry.modifiedURI.with({ scheme: `NotebookChatEditorController.modifiedScheme${( Date.now().toString())}` });
|
|
400
|
-
const stream = bufferToStream(bytes);
|
|
401
|
-
if (this.previousUriOfModelForDiff) {
|
|
402
|
-
this.notebookService.getNotebookTextModel(this.previousUriOfModelForDiff)?.dispose();
|
|
403
|
-
}
|
|
404
|
-
this.previousUriOfModelForDiff = uri;
|
|
405
|
-
try {
|
|
406
|
-
const model = await this.notebookService.createNotebookTextModel(this.model.viewType, uri, stream);
|
|
407
|
-
if (token.isCancellationRequested) {
|
|
408
|
-
model.dispose();
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
this._register(model);
|
|
412
|
-
return model;
|
|
413
|
-
}
|
|
414
|
-
catch (ex) {
|
|
415
|
-
this.logService.warn('NotebookChatEdit', `Failed to deserialize Notebook for ${uri.toString}, ${ex.message}`);
|
|
416
|
-
this.logService.debug('NotebookChatEdit', ( ex.toString()));
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
async computeDiff(original, modified, token) {
|
|
421
|
-
const diffResult = await raceCancellation(this.notebookEditorWorkerService.computeDiff(original.uri, modified.uri), token);
|
|
422
|
-
if (!diffResult || token.isCancellationRequested) {
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
prettyChanges(original, modified, diffResult.cellsDiff);
|
|
426
|
-
return computeDiff(original, modified, diffResult);
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
NotebookModelSynchronizer = ( __decorate([
|
|
430
|
-
( __param(1, IChatEditingService)),
|
|
431
|
-
( __param(2, INotebookService)),
|
|
432
|
-
( __param(3, INotebookEditorService)),
|
|
433
|
-
( __param(4, IChatService)),
|
|
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))
|
|
441
|
-
], NotebookModelSynchronizer));
|
|
442
|
-
|
|
443
|
-
export { NotebookModelSynchronizer, NotebookModelSynchronizerFactory };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
2
|
-
import { IStoredFileWorkingCopy } from "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy";
|
|
3
|
-
import { IUntitledFileWorkingCopy } from "../../../../../services/workingCopy/common/untitledFileWorkingCopy.js";
|
|
4
|
-
import { IWorkingCopyFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service";
|
|
5
|
-
import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service";
|
|
6
|
-
import { NotebookFileWorkingCopyModel } from "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/contrib/notebook/common/notebookEditorModel";
|
|
7
|
-
import { INotebookSynchronizerService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookSynchronizerService.service";
|
|
8
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
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";
|
|
11
|
-
export declare class NotebookSynchronizerService extends Disposable implements INotebookSynchronizerService {
|
|
12
|
-
private readonly _chatEditingService;
|
|
13
|
-
protected readonly _fileService: IFileService;
|
|
14
|
-
private readonly _notebookService;
|
|
15
|
-
private readonly _instantiationService;
|
|
16
|
-
private readonly _workingCopyFileService;
|
|
17
|
-
_serviceBrand: undefined;
|
|
18
|
-
constructor(_chatEditingService: IChatEditingService, _fileService: IFileService, _notebookService: INotebookService, _instantiationService: IInstantiationService, _workingCopyFileService: IWorkingCopyFileService);
|
|
19
|
-
revert(workingCopy: IStoredFileWorkingCopy<NotebookFileWorkingCopyModel> | IUntitledFileWorkingCopy<NotebookFileWorkingCopyModel>): Promise<void>;
|
|
20
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
4
|
-
import { StoredFileWorkingCopy } from '@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy';
|
|
5
|
-
import { IWorkingCopyFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
6
|
-
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
7
|
-
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
9
|
-
import { NotebookSaveParticipant } from '../saveParticipants/saveParticipants.js';
|
|
10
|
-
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
11
|
-
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
12
|
-
import { ChatEditingModifiedDocumentEntry } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry';
|
|
13
|
-
import { SaveReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
14
|
-
|
|
15
|
-
let NotebookSynchronizerSaveParticipant = class NotebookSynchronizerSaveParticipant extends NotebookSaveParticipant {
|
|
16
|
-
constructor(editorService, _chatEditingService, _fileService, _notebookService) {
|
|
17
|
-
super(editorService);
|
|
18
|
-
this._chatEditingService = _chatEditingService;
|
|
19
|
-
this._fileService = _fileService;
|
|
20
|
-
this._notebookService = _notebookService;
|
|
21
|
-
}
|
|
22
|
-
async participate(workingCopy, context, progress, token) {
|
|
23
|
-
const sessions = this._chatEditingService.editingSessionsObs.get();
|
|
24
|
-
const session = sessions.find(s => s.getEntry(workingCopy.resource));
|
|
25
|
-
if (!session) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (!this._notebookService.hasSupportedNotebooks(workingCopy.resource)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const entry = session.getEntry(workingCopy.resource);
|
|
32
|
-
if (entry && entry instanceof ChatEditingModifiedDocumentEntry) {
|
|
33
|
-
await entry.docFileEditorModel.save({ reason: SaveReason.EXPLICIT, ignoreModifiedSince: true });
|
|
34
|
-
}
|
|
35
|
-
const inWorkingSet = ( session.workingSet.has(workingCopy.resource));
|
|
36
|
-
if (!(entry && entry instanceof ChatEditingModifiedDocumentEntry) && !inWorkingSet) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (workingCopy instanceof StoredFileWorkingCopy) {
|
|
40
|
-
const metadata = await this._fileService.stat(workingCopy.resource);
|
|
41
|
-
if (workingCopy.lastResolvedFileStat) {
|
|
42
|
-
workingCopy.lastResolvedFileStat = {
|
|
43
|
-
...workingCopy.lastResolvedFileStat,
|
|
44
|
-
...metadata
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
NotebookSynchronizerSaveParticipant = ( __decorate([
|
|
51
|
-
( __param(0, IEditorService)),
|
|
52
|
-
( __param(1, IChatEditingService)),
|
|
53
|
-
( __param(2, IFileService)),
|
|
54
|
-
( __param(3, INotebookService))
|
|
55
|
-
], NotebookSynchronizerSaveParticipant));
|
|
56
|
-
let NotebookSynchronizerService = class NotebookSynchronizerService extends Disposable {
|
|
57
|
-
constructor(_chatEditingService, _fileService, _notebookService, _instantiationService, _workingCopyFileService) {
|
|
58
|
-
super();
|
|
59
|
-
this._chatEditingService = _chatEditingService;
|
|
60
|
-
this._fileService = _fileService;
|
|
61
|
-
this._notebookService = _notebookService;
|
|
62
|
-
this._instantiationService = _instantiationService;
|
|
63
|
-
this._workingCopyFileService = _workingCopyFileService;
|
|
64
|
-
this._register(this._workingCopyFileService.addSaveParticipant(this._instantiationService.createInstance(NotebookSynchronizerSaveParticipant)));
|
|
65
|
-
}
|
|
66
|
-
async revert(workingCopy) {
|
|
67
|
-
const resource = workingCopy.resource;
|
|
68
|
-
if (!this._notebookService.hasSupportedNotebooks(workingCopy.resource)) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const sessions = this._chatEditingService.editingSessionsObs.get();
|
|
72
|
-
const entry = ( sessions.map(s => s.getEntry(resource))).find(r => !!r);
|
|
73
|
-
if (entry instanceof ChatEditingModifiedDocumentEntry) {
|
|
74
|
-
await entry.docFileEditorModel.revert({ soft: true });
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
NotebookSynchronizerService = ( __decorate([
|
|
79
|
-
( __param(0, IChatEditingService)),
|
|
80
|
-
( __param(1, IFileService)),
|
|
81
|
-
( __param(2, INotebookService)),
|
|
82
|
-
( __param(3, IInstantiationService)),
|
|
83
|
-
( __param(4, IWorkingCopyFileService))
|
|
84
|
-
], NotebookSynchronizerService));
|
|
85
|
-
|
|
86
|
-
export { NotebookSynchronizerService };
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from '@codingame/monaco-vscode-api/external/rollup-plugin-styles/dist/runtime/inject-css';
|
|
2
|
-
|
|
3
|
-
var css = ".monaco-workbench .notebookOverlay.notebook-editor.find-hide-transition,.monaco-workbench .notebookOverlay.notebook-editor.find-show-transition{overflow-y:hidden}.monaco-workbench .notebookOverlay.notebook-editor .simple-fr-find-part-wrapper .matchesCount{box-sizing:border-box;overflow:hidden;padding:0 2px;text-align:center;text-overflow:ellipsis;white-space:nowrap}.monaco-workbench .nb-findScope{background-color:var(--vscode-editor-findRangeHighlightBackground)}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|