@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.1
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 +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
|
@@ -12,8 +12,22 @@ import { IWorkingCopyBackupService } from '@codingame/monaco-vscode-api/vscode/v
|
|
|
12
12
|
import { emptyStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stream';
|
|
13
13
|
|
|
14
14
|
let UntitledFileWorkingCopy = class UntitledFileWorkingCopy extends Disposable {
|
|
15
|
-
get model() {
|
|
16
|
-
|
|
15
|
+
get model() {
|
|
16
|
+
return this._model;
|
|
17
|
+
}
|
|
18
|
+
constructor(
|
|
19
|
+
typeId,
|
|
20
|
+
resource,
|
|
21
|
+
name,
|
|
22
|
+
hasAssociatedFilePath,
|
|
23
|
+
isScratchpad,
|
|
24
|
+
initialContents,
|
|
25
|
+
modelFactory,
|
|
26
|
+
saveDelegate,
|
|
27
|
+
workingCopyService,
|
|
28
|
+
workingCopyBackupService,
|
|
29
|
+
logService
|
|
30
|
+
) {
|
|
17
31
|
super();
|
|
18
32
|
this.typeId = typeId;
|
|
19
33
|
this.resource = resource;
|
|
@@ -56,34 +70,36 @@ let UntitledFileWorkingCopy = class UntitledFileWorkingCopy extends Disposable {
|
|
|
56
70
|
}
|
|
57
71
|
}
|
|
58
72
|
async resolve() {
|
|
59
|
-
this.trace(
|
|
73
|
+
this.trace("resolve()");
|
|
60
74
|
if (this.isResolved()) {
|
|
61
|
-
this.trace(
|
|
75
|
+
this.trace("resolve() - exit (already resolved)");
|
|
62
76
|
return;
|
|
63
77
|
}
|
|
64
78
|
let untitledContents;
|
|
65
79
|
const backup = await this.workingCopyBackupService.resolve(this);
|
|
66
80
|
if (backup) {
|
|
67
|
-
this.trace(
|
|
81
|
+
this.trace("resolve() - with backup");
|
|
68
82
|
untitledContents = backup.value;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
this.trace('resolve() - with initial contents');
|
|
83
|
+
} else if (this.initialContents?.value) {
|
|
84
|
+
this.trace("resolve() - with initial contents");
|
|
72
85
|
untitledContents = this.initialContents.value;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
this.trace('resolve() - empty');
|
|
86
|
+
} else {
|
|
87
|
+
this.trace("resolve() - empty");
|
|
76
88
|
untitledContents = emptyStream();
|
|
77
89
|
}
|
|
78
90
|
await this.doCreateModel(untitledContents);
|
|
79
|
-
this.setModified(
|
|
91
|
+
this.setModified(
|
|
92
|
+
this.hasAssociatedFilePath || !!backup || Boolean(this.initialContents && this.initialContents.markModified !== false)
|
|
93
|
+
);
|
|
80
94
|
if (!!backup || this.initialContents) {
|
|
81
95
|
this._onDidChangeContent.fire();
|
|
82
96
|
}
|
|
83
97
|
}
|
|
84
98
|
async doCreateModel(contents) {
|
|
85
|
-
this.trace(
|
|
86
|
-
this._model = this._register(
|
|
99
|
+
this.trace("doCreateModel()");
|
|
100
|
+
this._model = this._register(
|
|
101
|
+
await this.modelFactory.createModel(this.resource, contents, CancellationToken.None)
|
|
102
|
+
);
|
|
87
103
|
this.installModelListeners(this._model);
|
|
88
104
|
}
|
|
89
105
|
installModelListeners(model) {
|
|
@@ -109,28 +125,32 @@ let UntitledFileWorkingCopy = class UntitledFileWorkingCopy extends Disposable {
|
|
|
109
125
|
let content = undefined;
|
|
110
126
|
if (this.isResolved()) {
|
|
111
127
|
content = await raceCancellation(this.model.snapshot(SnapshotContext.Backup, token), token);
|
|
112
|
-
}
|
|
113
|
-
else if (this.initialContents) {
|
|
128
|
+
} else if (this.initialContents) {
|
|
114
129
|
content = this.initialContents.value;
|
|
115
130
|
}
|
|
116
|
-
return {
|
|
131
|
+
return {
|
|
132
|
+
content
|
|
133
|
+
};
|
|
117
134
|
}
|
|
118
135
|
async save(options) {
|
|
119
|
-
this.trace(
|
|
136
|
+
this.trace("save()");
|
|
120
137
|
const result = await this.saveDelegate(this, options);
|
|
121
138
|
if (result) {
|
|
122
|
-
this._onDidSave.fire({
|
|
139
|
+
this._onDidSave.fire({
|
|
140
|
+
reason: options?.reason,
|
|
141
|
+
source: options?.source
|
|
142
|
+
});
|
|
123
143
|
}
|
|
124
144
|
return result;
|
|
125
145
|
}
|
|
126
146
|
async revert() {
|
|
127
|
-
this.trace(
|
|
147
|
+
this.trace("revert()");
|
|
128
148
|
this.setModified(false);
|
|
129
149
|
this._onDidRevert.fire();
|
|
130
150
|
this.dispose();
|
|
131
151
|
}
|
|
132
152
|
dispose() {
|
|
133
|
-
this.trace(
|
|
153
|
+
this.trace("dispose()");
|
|
134
154
|
this._onWillDispose.fire();
|
|
135
155
|
super.dispose();
|
|
136
156
|
}
|
|
@@ -138,10 +158,6 @@ let UntitledFileWorkingCopy = class UntitledFileWorkingCopy extends Disposable {
|
|
|
138
158
|
this.logService.trace(`[untitled file working copy] ${msg}`, ( this.resource.toString()), this.typeId);
|
|
139
159
|
}
|
|
140
160
|
};
|
|
141
|
-
UntitledFileWorkingCopy = ( __decorate([
|
|
142
|
-
( __param(8, IWorkingCopyService)),
|
|
143
|
-
( __param(9, IWorkingCopyBackupService)),
|
|
144
|
-
( __param(10, ILogService))
|
|
145
|
-
], UntitledFileWorkingCopy));
|
|
161
|
+
UntitledFileWorkingCopy = ( __decorate([( __param(8, IWorkingCopyService)), ( __param(9, IWorkingCopyBackupService)), ( __param(10, ILogService))], UntitledFileWorkingCopy));
|
|
146
162
|
|
|
147
163
|
export { UntitledFileWorkingCopy };
|
package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js
CHANGED
|
@@ -14,7 +14,16 @@ import { BaseFileWorkingCopyManager } from './abstractFileWorkingCopyManager.js'
|
|
|
14
14
|
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
15
15
|
|
|
16
16
|
let UntitledFileWorkingCopyManager = class UntitledFileWorkingCopyManager extends BaseFileWorkingCopyManager {
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(
|
|
18
|
+
workingCopyTypeId,
|
|
19
|
+
modelFactory,
|
|
20
|
+
saveDelegate,
|
|
21
|
+
fileService,
|
|
22
|
+
labelService,
|
|
23
|
+
logService,
|
|
24
|
+
workingCopyBackupService,
|
|
25
|
+
workingCopyService
|
|
26
|
+
) {
|
|
18
27
|
super(fileService, logService, workingCopyBackupService);
|
|
19
28
|
this.workingCopyTypeId = workingCopyTypeId;
|
|
20
29
|
this.modelFactory = modelFactory;
|
|
@@ -74,8 +83,7 @@ let UntitledFileWorkingCopyManager = class UntitledFileWorkingCopyManager extend
|
|
|
74
83
|
scheme: Schemas.untitled,
|
|
75
84
|
path: options.isScratchpad ? `Scratchpad-${counter}` : `Untitled-${counter}`,
|
|
76
85
|
query: this.workingCopyTypeId ?
|
|
77
|
-
|
|
78
|
-
undefined
|
|
86
|
+
`typeId=${this.workingCopyTypeId}` : undefined
|
|
79
87
|
}));
|
|
80
88
|
counter++;
|
|
81
89
|
} while (( this.has(untitledResource)));
|
|
@@ -98,7 +106,9 @@ let UntitledFileWorkingCopyManager = class UntitledFileWorkingCopyManager extend
|
|
|
98
106
|
}
|
|
99
107
|
registerWorkingCopy(workingCopy) {
|
|
100
108
|
const workingCopyListeners = ( new DisposableStore());
|
|
101
|
-
workingCopyListeners.add(
|
|
109
|
+
workingCopyListeners.add(
|
|
110
|
+
workingCopy.onDidChangeDirty(() => this._onDidChangeDirty.fire(workingCopy))
|
|
111
|
+
);
|
|
102
112
|
workingCopyListeners.add(workingCopy.onWillDispose(() => this._onWillDispose.fire(workingCopy)));
|
|
103
113
|
this.mapResourceToWorkingCopyListeners.set(workingCopy.resource, workingCopyListeners);
|
|
104
114
|
this.add(workingCopy.resource, workingCopy);
|
|
@@ -121,15 +131,12 @@ let UntitledFileWorkingCopyManager = class UntitledFileWorkingCopyManager extend
|
|
|
121
131
|
this.mapResourceToWorkingCopyListeners.clear();
|
|
122
132
|
}
|
|
123
133
|
notifyDidSave(source, target) {
|
|
124
|
-
this._onDidSave.fire({
|
|
134
|
+
this._onDidSave.fire({
|
|
135
|
+
source,
|
|
136
|
+
target
|
|
137
|
+
});
|
|
125
138
|
}
|
|
126
139
|
};
|
|
127
|
-
UntitledFileWorkingCopyManager = ( __decorate([
|
|
128
|
-
( __param(3, IFileService)),
|
|
129
|
-
( __param(4, ILabelService)),
|
|
130
|
-
( __param(5, ILogService)),
|
|
131
|
-
( __param(6, IWorkingCopyBackupService)),
|
|
132
|
-
( __param(7, IWorkingCopyService))
|
|
133
|
-
], UntitledFileWorkingCopyManager));
|
|
140
|
+
UntitledFileWorkingCopyManager = ( __decorate([( __param(3, IFileService)), ( __param(4, ILabelService)), ( __param(5, ILogService)), ( __param(6, IWorkingCopyBackupService)), ( __param(7, IWorkingCopyService))], UntitledFileWorkingCopyManager));
|
|
134
141
|
|
|
135
142
|
export { UntitledFileWorkingCopyManager };
|
package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
2
|
-
import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
|
|
3
|
-
import { EditorAction2 } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions";
|
|
4
|
-
export declare class AcceptChangesAndRun extends EditorAction2 {
|
|
5
|
-
constructor();
|
|
6
|
-
runEditorCommand(accessor: ServicesAccessor, codeEditor: ICodeEditor): Promise<void> | undefined;
|
|
7
|
-
}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
3
|
-
import { KeyChord, KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
4
|
-
import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
5
|
-
import { registerAction2, MenuId, MenuRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
6
|
-
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
7
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
|
-
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
9
|
-
import { InputFocusedContextKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkeys';
|
|
10
|
-
import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
11
|
-
import { MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_RESPONSE_TYPE, InlineChatResponseType, CTX_INLINE_CHAT_VISIBLE } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
12
|
-
import { CTX_NOTEBOOK_CHAT_HAS_AGENT } from './notebookChatContext.js';
|
|
13
|
-
import { NotebookAction, getEditorFromArgsOrActivePane, getContextFromActiveEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
14
|
-
import { insertNewCell } from '../insertCellActions.js';
|
|
15
|
-
import { NotebookSetting, CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
16
|
-
import { NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_EDITOR_FOCUSED } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
17
|
-
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
18
|
-
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
19
|
-
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
20
|
-
import { InlineChatController } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
21
|
-
import { EditorAction2 } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions';
|
|
22
|
-
|
|
23
|
-
async function startChat(accessor, context, index, input, autoSend, source) {
|
|
24
|
-
const configurationService = accessor.get(IConfigurationService);
|
|
25
|
-
const commandService = accessor.get(ICommandService);
|
|
26
|
-
if (configurationService.getValue(NotebookSetting.cellGenerate) || configurationService.getValue(NotebookSetting.cellChat)) {
|
|
27
|
-
const activeCell = context.notebookEditor.getActiveCell();
|
|
28
|
-
const targetCell = activeCell?.getTextLength() === 0 && source !== 'insertToolbar' ? activeCell : (await insertNewCell(accessor, context, CellKind.Code, 'below'));
|
|
29
|
-
if (targetCell) {
|
|
30
|
-
targetCell.enableAutoLanguageDetection();
|
|
31
|
-
await context.notebookEditor.revealFirstLineIfOutsideViewport(targetCell);
|
|
32
|
-
const codeEditor = context.notebookEditor.codeEditors.find(ce => ce[0] === targetCell)?.[1];
|
|
33
|
-
if (codeEditor) {
|
|
34
|
-
codeEditor.focus();
|
|
35
|
-
commandService.executeCommand('inlineChat.start');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
registerAction2(class extends NotebookAction {
|
|
41
|
-
constructor() {
|
|
42
|
-
super({
|
|
43
|
-
id: 'notebook.cell.chat.start',
|
|
44
|
-
title: {
|
|
45
|
-
value: '$(sparkle) ' + ( localize(9356, "Generate")),
|
|
46
|
-
original: '$(sparkle) Generate',
|
|
47
|
-
},
|
|
48
|
-
tooltip: ( localize(9357, "Start Chat to Generate Code")),
|
|
49
|
-
metadata: {
|
|
50
|
-
description: ( localize(9357, "Start Chat to Generate Code")),
|
|
51
|
-
args: [
|
|
52
|
-
{
|
|
53
|
-
name: 'args',
|
|
54
|
-
schema: {
|
|
55
|
-
type: 'object',
|
|
56
|
-
required: ['index'],
|
|
57
|
-
properties: {
|
|
58
|
-
'index': {
|
|
59
|
-
type: 'number'
|
|
60
|
-
},
|
|
61
|
-
'input': {
|
|
62
|
-
type: 'string'
|
|
63
|
-
},
|
|
64
|
-
'autoSend': {
|
|
65
|
-
type: 'boolean'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
f1: false,
|
|
73
|
-
keybinding: {
|
|
74
|
-
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ContextKeyExpr.not(InputFocusedContextKey), CTX_NOTEBOOK_CHAT_HAS_AGENT, ( ContextKeyExpr.or(( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true)), ( ContextKeyExpr.equals(`config.${NotebookSetting.cellGenerate}`, true)))))),
|
|
75
|
-
weight: KeybindingWeight.WorkbenchContrib,
|
|
76
|
-
primary: KeyMod.CtrlCmd | KeyCode.KeyI,
|
|
77
|
-
secondary: [KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.KeyI)],
|
|
78
|
-
},
|
|
79
|
-
menu: [
|
|
80
|
-
{
|
|
81
|
-
id: MenuId.NotebookCellBetween,
|
|
82
|
-
group: 'inline',
|
|
83
|
-
order: -1,
|
|
84
|
-
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_NOTEBOOK_CHAT_HAS_AGENT, ( ContextKeyExpr.or(( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true)), ( ContextKeyExpr.equals(`config.${NotebookSetting.cellGenerate}`, true))))))
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
getEditorContextFromArgsOrActive(accessor, ...args) {
|
|
90
|
-
const [firstArg] = args;
|
|
91
|
-
if (!firstArg) {
|
|
92
|
-
const notebookEditor = getEditorFromArgsOrActivePane(accessor);
|
|
93
|
-
if (!notebookEditor) {
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
const activeCell = notebookEditor.getActiveCell();
|
|
97
|
-
if (!activeCell) {
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
cell: activeCell,
|
|
102
|
-
notebookEditor,
|
|
103
|
-
input: undefined,
|
|
104
|
-
autoSend: undefined
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
if (typeof firstArg !== 'object' || typeof firstArg.index !== 'number') {
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
const notebookEditor = getEditorFromArgsOrActivePane(accessor);
|
|
111
|
-
if (!notebookEditor) {
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
114
|
-
const cell = firstArg.index <= 0 ? undefined : notebookEditor.cellAt(firstArg.index - 1);
|
|
115
|
-
return {
|
|
116
|
-
cell,
|
|
117
|
-
notebookEditor,
|
|
118
|
-
input: firstArg.input,
|
|
119
|
-
autoSend: firstArg.autoSend
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
async runWithContext(accessor, context) {
|
|
123
|
-
const index = Math.max(0, context.cell ? context.notebookEditor.getCellIndex(context.cell) + 1 : 0);
|
|
124
|
-
await startChat(accessor, context, index, context.input, context.autoSend, context.source);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
registerAction2(class extends NotebookAction {
|
|
128
|
-
constructor() {
|
|
129
|
-
super({
|
|
130
|
-
id: 'notebook.cell.chat.startAtTop',
|
|
131
|
-
title: {
|
|
132
|
-
value: '$(sparkle) ' + ( localize(9356, "Generate")),
|
|
133
|
-
original: '$(sparkle) Generate',
|
|
134
|
-
},
|
|
135
|
-
tooltip: ( localize(9357, "Start Chat to Generate Code")),
|
|
136
|
-
f1: false,
|
|
137
|
-
menu: [
|
|
138
|
-
{
|
|
139
|
-
id: MenuId.NotebookCellListTop,
|
|
140
|
-
group: 'inline',
|
|
141
|
-
order: -1,
|
|
142
|
-
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_NOTEBOOK_CHAT_HAS_AGENT, ( ContextKeyExpr.or(( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true)), ( ContextKeyExpr.equals(`config.${NotebookSetting.cellGenerate}`, true))))))
|
|
143
|
-
},
|
|
144
|
-
]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
async runWithContext(accessor, context) {
|
|
148
|
-
await startChat(accessor, context);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
|
|
152
|
-
command: {
|
|
153
|
-
id: 'notebook.cell.chat.start',
|
|
154
|
-
icon: Codicon.sparkle,
|
|
155
|
-
title: ( localize(9358, "Generate")),
|
|
156
|
-
tooltip: ( localize(9359, "Start Chat to Generate Code"))
|
|
157
|
-
},
|
|
158
|
-
order: -10,
|
|
159
|
-
group: 'navigation/add',
|
|
160
|
-
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'betweenCells')), ( ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'hidden')), CTX_NOTEBOOK_CHAT_HAS_AGENT, ( ContextKeyExpr.or(( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true)), ( ContextKeyExpr.equals(`config.${NotebookSetting.cellGenerate}`, true))))))
|
|
161
|
-
});
|
|
162
|
-
class AcceptChangesAndRun extends EditorAction2 {
|
|
163
|
-
constructor() {
|
|
164
|
-
super({
|
|
165
|
-
id: 'notebook.inlineChat.acceptChangesAndRun',
|
|
166
|
-
title: ( localize2(9360, "Accept and Run")),
|
|
167
|
-
shortTitle: ( localize(9361, 'Accept & Run')),
|
|
168
|
-
tooltip: ( localize(9362, 'Accept the changes and run the cell')),
|
|
169
|
-
icon: Codicon.check,
|
|
170
|
-
f1: true,
|
|
171
|
-
precondition: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_INLINE_CHAT_VISIBLE)),
|
|
172
|
-
keybinding: undefined,
|
|
173
|
-
menu: [{
|
|
174
|
-
id: MENU_INLINE_CHAT_WIDGET_STATUS,
|
|
175
|
-
group: '0_main',
|
|
176
|
-
order: 2,
|
|
177
|
-
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ChatContextKeys.inputHasText.toNegated()), ( CTX_INLINE_CHAT_REQUEST_IN_PROGRESS.toNegated()), ( CTX_INLINE_CHAT_RESPONSE_TYPE.isEqualTo(InlineChatResponseType.MessagesAndEdits))))
|
|
178
|
-
}]
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
runEditorCommand(accessor, codeEditor) {
|
|
182
|
-
const editor = getContextFromActiveEditor(accessor.get(IEditorService));
|
|
183
|
-
const ctrl = InlineChatController.get(codeEditor);
|
|
184
|
-
if (!editor || !ctrl) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const matchedCell = editor.notebookEditor.codeEditors.find(e => e[1] === codeEditor);
|
|
188
|
-
const cell = matchedCell?.[0];
|
|
189
|
-
if (!cell) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
ctrl.acceptSession();
|
|
193
|
-
return editor.notebookEditor.executeNotebookCells(Iterable.single(cell));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
registerAction2(AcceptChangesAndRun);
|
|
197
|
-
|
|
198
|
-
export { AcceptChangesAndRun };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Action2 } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions";
|
|
2
|
-
import { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
3
|
-
export declare class SelectAndInsertKernelVariableAction extends Action2 {
|
|
4
|
-
constructor();
|
|
5
|
-
static readonly ID = "notebook.chat.selectAndInsertKernelVariable";
|
|
6
|
-
run(accessor: ServicesAccessor, ...args: unknown[]): Promise<void>;
|
|
7
|
-
private addVariableReference;
|
|
8
|
-
}
|