@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.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 +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
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js
CHANGED
|
@@ -39,22 +39,31 @@ function getFocusedEditor(accessor) {
|
|
|
39
39
|
const editorService = accessor.get(IEditorService);
|
|
40
40
|
const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
|
|
41
41
|
if (!editor) {
|
|
42
|
-
_log(
|
|
42
|
+
_log(
|
|
43
|
+
loggerService,
|
|
44
|
+
"[Revive Webview] No notebook editor found for active editor pane, bypass"
|
|
45
|
+
);
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
48
|
if (!editor.hasEditorFocus()) {
|
|
46
|
-
_log(loggerService,
|
|
49
|
+
_log(loggerService, "[Revive Webview] Notebook editor is not focused, bypass");
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
49
52
|
if (!editor.hasWebviewFocus()) {
|
|
50
|
-
_log(
|
|
53
|
+
_log(
|
|
54
|
+
loggerService,
|
|
55
|
+
"[Revive Webview] Notebook editor backlayer webview is not focused, bypass"
|
|
56
|
+
);
|
|
51
57
|
return;
|
|
52
58
|
}
|
|
53
59
|
const view = editor.getViewModel();
|
|
54
60
|
if (view && view.viewCells.every(cell => !cell.outputIsFocused && !cell.outputIsHovered)) {
|
|
55
61
|
return;
|
|
56
62
|
}
|
|
57
|
-
return {
|
|
63
|
+
return {
|
|
64
|
+
editor,
|
|
65
|
+
loggerService
|
|
66
|
+
};
|
|
58
67
|
}
|
|
59
68
|
function getFocusedWebviewDelegate(accessor) {
|
|
60
69
|
const result = getFocusedEditor(accessor);
|
|
@@ -62,7 +71,10 @@ function getFocusedWebviewDelegate(accessor) {
|
|
|
62
71
|
return;
|
|
63
72
|
}
|
|
64
73
|
const webview = result.editor.getInnerWebview();
|
|
65
|
-
_log(
|
|
74
|
+
_log(
|
|
75
|
+
result.loggerService,
|
|
76
|
+
"[Revive Webview] Notebook editor backlayer webview is focused"
|
|
77
|
+
);
|
|
66
78
|
return webview;
|
|
67
79
|
}
|
|
68
80
|
function withWebview(accessor, f) {
|
|
@@ -78,19 +90,19 @@ function withEditor(accessor, f) {
|
|
|
78
90
|
return result ? f(result.editor) : false;
|
|
79
91
|
}
|
|
80
92
|
const PRIORITY = 105;
|
|
81
|
-
UndoCommand.addImplementation(PRIORITY,
|
|
93
|
+
UndoCommand.addImplementation(PRIORITY, "notebook-webview", accessor => {
|
|
82
94
|
return withWebview(accessor, webview => webview.undo());
|
|
83
95
|
});
|
|
84
|
-
RedoCommand.addImplementation(PRIORITY,
|
|
96
|
+
RedoCommand.addImplementation(PRIORITY, "notebook-webview", accessor => {
|
|
85
97
|
return withWebview(accessor, webview => webview.redo());
|
|
86
98
|
});
|
|
87
|
-
CopyAction?.addImplementation(PRIORITY,
|
|
99
|
+
CopyAction?.addImplementation(PRIORITY, "notebook-webview", accessor => {
|
|
88
100
|
return withWebview(accessor, webview => webview.copy());
|
|
89
101
|
});
|
|
90
|
-
PasteAction?.addImplementation(PRIORITY,
|
|
102
|
+
PasteAction?.addImplementation(PRIORITY, "notebook-webview", accessor => {
|
|
91
103
|
return withWebview(accessor, webview => webview.paste());
|
|
92
104
|
});
|
|
93
|
-
CutAction?.addImplementation(PRIORITY,
|
|
105
|
+
CutAction?.addImplementation(PRIORITY, "notebook-webview", accessor => {
|
|
94
106
|
return withWebview(accessor, webview => webview.cut());
|
|
95
107
|
});
|
|
96
108
|
function runPasteCells(editor, activeCell, pasteCells) {
|
|
@@ -108,35 +120,42 @@ function runPasteCells(editor, activeCell, pasteCells) {
|
|
|
108
120
|
};
|
|
109
121
|
if (activeCell) {
|
|
110
122
|
const currCellIndex = editor.getCellIndex(activeCell);
|
|
111
|
-
const newFocusIndex = typeof currCellIndex ===
|
|
112
|
-
textModel.applyEdits([
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
], true, originalState, () => ({
|
|
123
|
+
const newFocusIndex = typeof currCellIndex === "number" ? currCellIndex + 1 : 0;
|
|
124
|
+
textModel.applyEdits([{
|
|
125
|
+
editType: CellEditType.Replace,
|
|
126
|
+
index: newFocusIndex,
|
|
127
|
+
count: 0,
|
|
128
|
+
cells: ( pasteCells.items.map(cell => cloneNotebookCellTextModel(cell)))
|
|
129
|
+
}], true, originalState, () => ({
|
|
120
130
|
kind: SelectionStateType.Index,
|
|
121
|
-
focus: {
|
|
122
|
-
|
|
131
|
+
focus: {
|
|
132
|
+
start: newFocusIndex,
|
|
133
|
+
end: newFocusIndex + 1
|
|
134
|
+
},
|
|
135
|
+
selections: [{
|
|
136
|
+
start: newFocusIndex,
|
|
137
|
+
end: newFocusIndex + pasteCells.items.length
|
|
138
|
+
}]
|
|
123
139
|
}), undefined, true);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
140
|
+
} else {
|
|
126
141
|
if (editor.getLength() !== 0) {
|
|
127
142
|
return false;
|
|
128
143
|
}
|
|
129
|
-
textModel.applyEdits([
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
], true, originalState, () => ({
|
|
144
|
+
textModel.applyEdits([{
|
|
145
|
+
editType: CellEditType.Replace,
|
|
146
|
+
index: 0,
|
|
147
|
+
count: 0,
|
|
148
|
+
cells: ( pasteCells.items.map(cell => cloneNotebookCellTextModel(cell)))
|
|
149
|
+
}], true, originalState, () => ({
|
|
137
150
|
kind: SelectionStateType.Index,
|
|
138
|
-
focus: {
|
|
139
|
-
|
|
151
|
+
focus: {
|
|
152
|
+
start: 0,
|
|
153
|
+
end: 1
|
|
154
|
+
},
|
|
155
|
+
selections: [{
|
|
156
|
+
start: 1,
|
|
157
|
+
end: pasteCells.items.length + 1
|
|
158
|
+
}]
|
|
140
159
|
}), undefined, true);
|
|
141
160
|
}
|
|
142
161
|
return true;
|
|
@@ -146,7 +165,7 @@ function runCopyCells(accessor, editor, targetCell) {
|
|
|
146
165
|
return false;
|
|
147
166
|
}
|
|
148
167
|
if (editor.hasOutputTextSelection()) {
|
|
149
|
-
getWindow(editor.getDomNode()).document.execCommand(
|
|
168
|
+
getWindow(editor.getDomNode()).document.execCommand("copy");
|
|
150
169
|
return true;
|
|
151
170
|
}
|
|
152
171
|
const clipboardService = accessor.get(IClipboardService);
|
|
@@ -154,7 +173,9 @@ function runCopyCells(accessor, editor, targetCell) {
|
|
|
154
173
|
const selections = editor.getSelections();
|
|
155
174
|
if (targetCell) {
|
|
156
175
|
const targetCellIndex = editor.getCellIndex(targetCell);
|
|
157
|
-
const containingSelection = selections.find(
|
|
176
|
+
const containingSelection = selections.find(
|
|
177
|
+
selection => selection.start <= targetCellIndex && targetCellIndex < selection.end
|
|
178
|
+
);
|
|
158
179
|
if (!containingSelection) {
|
|
159
180
|
clipboardService.writeText(targetCell.getText());
|
|
160
181
|
notebookService.setToCopy([targetCell.model], true);
|
|
@@ -166,7 +187,7 @@ function runCopyCells(accessor, editor, targetCell) {
|
|
|
166
187
|
if (!selectedCells.length) {
|
|
167
188
|
return false;
|
|
168
189
|
}
|
|
169
|
-
clipboardService.writeText(( selectedCells.map(cell => cell.getText())).join(
|
|
190
|
+
clipboardService.writeText(( selectedCells.map(cell => cell.getText())).join("\n"));
|
|
170
191
|
notebookService.setToCopy(( selectedCells.map(cell => cell.model)), true);
|
|
171
192
|
return true;
|
|
172
193
|
}
|
|
@@ -180,17 +201,34 @@ function runCutCells(accessor, editor, targetCell) {
|
|
|
180
201
|
const selections = editor.getSelections();
|
|
181
202
|
if (targetCell) {
|
|
182
203
|
const targetCellIndex = editor.getCellIndex(targetCell);
|
|
183
|
-
const containingSelection = selections.find(
|
|
204
|
+
const containingSelection = selections.find(
|
|
205
|
+
selection => selection.start <= targetCellIndex && targetCellIndex < selection.end
|
|
206
|
+
);
|
|
184
207
|
if (!containingSelection) {
|
|
185
208
|
clipboardService.writeText(targetCell.getText());
|
|
186
209
|
const focus = editor.getFocus();
|
|
187
|
-
const newFocus = focus.end <= targetCellIndex ? focus : {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
210
|
+
const newFocus = focus.end <= targetCellIndex ? focus : {
|
|
211
|
+
start: focus.start - 1,
|
|
212
|
+
end: focus.end - 1
|
|
213
|
+
};
|
|
214
|
+
const newSelections = ( selections.map(selection => (selection.end <= targetCellIndex ? selection : {
|
|
215
|
+
start: selection.start - 1,
|
|
216
|
+
end: selection.end - 1
|
|
217
|
+
})));
|
|
218
|
+
textModel.applyEdits([{
|
|
219
|
+
editType: CellEditType.Replace,
|
|
220
|
+
index: targetCellIndex,
|
|
221
|
+
count: 1,
|
|
222
|
+
cells: []
|
|
223
|
+
}], true, {
|
|
224
|
+
kind: SelectionStateType.Index,
|
|
225
|
+
focus: editor.getFocus(),
|
|
226
|
+
selections: selections
|
|
227
|
+
}, () => ({
|
|
228
|
+
kind: SelectionStateType.Index,
|
|
229
|
+
focus: newFocus,
|
|
230
|
+
selections: newSelections
|
|
231
|
+
}), undefined, true);
|
|
194
232
|
notebookService.setToCopy([targetCell.model], false);
|
|
195
233
|
return true;
|
|
196
234
|
}
|
|
@@ -200,13 +238,28 @@ function runCutCells(accessor, editor, targetCell) {
|
|
|
200
238
|
if (!containingSelection) {
|
|
201
239
|
const targetCell = editor.cellAt(focus.start);
|
|
202
240
|
clipboardService.writeText(targetCell.getText());
|
|
203
|
-
const newFocus = focus.end === editor.getLength() ? {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
241
|
+
const newFocus = focus.end === editor.getLength() ? {
|
|
242
|
+
start: focus.start - 1,
|
|
243
|
+
end: focus.end - 1
|
|
244
|
+
} : focus;
|
|
245
|
+
const newSelections = ( selections.map(selection => (selection.end <= focus.start ? selection : {
|
|
246
|
+
start: selection.start - 1,
|
|
247
|
+
end: selection.end - 1
|
|
248
|
+
})));
|
|
249
|
+
textModel.applyEdits([{
|
|
250
|
+
editType: CellEditType.Replace,
|
|
251
|
+
index: focus.start,
|
|
252
|
+
count: 1,
|
|
253
|
+
cells: []
|
|
254
|
+
}], true, {
|
|
255
|
+
kind: SelectionStateType.Index,
|
|
256
|
+
focus: editor.getFocus(),
|
|
257
|
+
selections: selections
|
|
258
|
+
}, () => ({
|
|
259
|
+
kind: SelectionStateType.Index,
|
|
260
|
+
focus: newFocus,
|
|
261
|
+
selections: newSelections
|
|
262
|
+
}), undefined, true);
|
|
210
263
|
notebookService.setToCopy([targetCell.model], false);
|
|
211
264
|
return true;
|
|
212
265
|
}
|
|
@@ -215,42 +268,57 @@ function runCutCells(accessor, editor, targetCell) {
|
|
|
215
268
|
if (!selectedCells.length) {
|
|
216
269
|
return false;
|
|
217
270
|
}
|
|
218
|
-
clipboardService.writeText(( selectedCells.map(cell => cell.getText())).join(
|
|
219
|
-
const edits = ( selectionRanges.map(
|
|
220
|
-
|
|
221
|
-
|
|
271
|
+
clipboardService.writeText(( selectedCells.map(cell => cell.getText())).join("\n"));
|
|
272
|
+
const edits = ( selectionRanges.map(range => ({
|
|
273
|
+
editType: CellEditType.Replace,
|
|
274
|
+
index: range.start,
|
|
275
|
+
count: range.end - range.start,
|
|
276
|
+
cells: []
|
|
277
|
+
})));
|
|
222
278
|
const firstSelectIndex = selectionRanges[0].start;
|
|
223
|
-
const newFocusedCellIndex = firstSelectIndex < textModel.cells.length - 1
|
|
224
|
-
|
|
225
|
-
:
|
|
226
|
-
|
|
279
|
+
const newFocusedCellIndex = firstSelectIndex < textModel.cells.length - 1 ? firstSelectIndex : Math.max(textModel.cells.length - 2, 0);
|
|
280
|
+
textModel.applyEdits(edits, true, {
|
|
281
|
+
kind: SelectionStateType.Index,
|
|
282
|
+
focus: editor.getFocus(),
|
|
283
|
+
selections: selectionRanges
|
|
284
|
+
}, () => {
|
|
227
285
|
return {
|
|
228
286
|
kind: SelectionStateType.Index,
|
|
229
|
-
focus: {
|
|
230
|
-
|
|
287
|
+
focus: {
|
|
288
|
+
start: newFocusedCellIndex,
|
|
289
|
+
end: newFocusedCellIndex + 1
|
|
290
|
+
},
|
|
291
|
+
selections: [{
|
|
292
|
+
start: newFocusedCellIndex,
|
|
293
|
+
end: newFocusedCellIndex + 1
|
|
294
|
+
}]
|
|
231
295
|
};
|
|
232
296
|
}, undefined, true);
|
|
233
297
|
notebookService.setToCopy(( selectedCells.map(cell => cell.model)), false);
|
|
234
298
|
return true;
|
|
235
299
|
}
|
|
236
300
|
let NotebookClipboardContribution = class NotebookClipboardContribution extends Disposable {
|
|
237
|
-
static {
|
|
301
|
+
static {
|
|
302
|
+
this.ID = "workbench.contrib.notebookClipboard";
|
|
303
|
+
}
|
|
238
304
|
constructor(_editorService) {
|
|
239
305
|
super();
|
|
240
306
|
this._editorService = _editorService;
|
|
241
307
|
const PRIORITY = 105;
|
|
242
308
|
if (CopyAction) {
|
|
243
|
-
this._register(CopyAction.addImplementation(PRIORITY,
|
|
309
|
+
this._register(CopyAction.addImplementation(PRIORITY, "notebook-clipboard", accessor => {
|
|
244
310
|
return this.runCopyAction(accessor);
|
|
245
311
|
}));
|
|
246
312
|
}
|
|
247
313
|
if (PasteAction) {
|
|
248
|
-
this._register(
|
|
249
|
-
|
|
250
|
-
|
|
314
|
+
this._register(
|
|
315
|
+
PasteAction.addImplementation(PRIORITY, "notebook-clipboard", accessor => {
|
|
316
|
+
return this.runPasteAction(accessor);
|
|
317
|
+
})
|
|
318
|
+
);
|
|
251
319
|
}
|
|
252
320
|
if (CutAction) {
|
|
253
|
-
this._register(CutAction.addImplementation(PRIORITY,
|
|
321
|
+
this._register(CutAction.addImplementation(PRIORITY, "notebook-clipboard", accessor => {
|
|
254
322
|
return this.runCutAction(accessor);
|
|
255
323
|
}));
|
|
256
324
|
}
|
|
@@ -277,10 +345,8 @@ let NotebookClipboardContribution = class NotebookClipboardContribution extends
|
|
|
277
345
|
if (!body.contains(container)) {
|
|
278
346
|
return false;
|
|
279
347
|
}
|
|
280
|
-
while (container
|
|
281
|
-
&&
|
|
282
|
-
container !== body) {
|
|
283
|
-
if (container.classList && container.classList.contains('monaco-editor')) {
|
|
348
|
+
while (container && container !== body) {
|
|
349
|
+
if (container.classList && container.classList.contains("monaco-editor")) {
|
|
284
350
|
return true;
|
|
285
351
|
}
|
|
286
352
|
container = container.parentNode;
|
|
@@ -291,23 +357,31 @@ let NotebookClipboardContribution = class NotebookClipboardContribution extends
|
|
|
291
357
|
const loggerService = accessor.get(ILogService);
|
|
292
358
|
const activeElement = getActiveElement();
|
|
293
359
|
if (isHTMLElement(activeElement) && isEditableElement(activeElement)) {
|
|
294
|
-
_log(
|
|
360
|
+
_log(
|
|
361
|
+
loggerService,
|
|
362
|
+
"[NotebookEditor] focus is on input or textarea element, bypass"
|
|
363
|
+
);
|
|
295
364
|
return false;
|
|
296
365
|
}
|
|
297
|
-
const {
|
|
366
|
+
const {
|
|
367
|
+
editor
|
|
368
|
+
} = this._getContext();
|
|
298
369
|
if (!editor) {
|
|
299
|
-
_log(loggerService,
|
|
370
|
+
_log(loggerService, "[NotebookEditor] no active notebook editor, bypass");
|
|
300
371
|
return false;
|
|
301
372
|
}
|
|
302
373
|
if (!editor.hasEditorFocus()) {
|
|
303
|
-
_log(
|
|
374
|
+
_log(
|
|
375
|
+
loggerService,
|
|
376
|
+
"[NotebookEditor] focus is outside of the notebook editor, bypass"
|
|
377
|
+
);
|
|
304
378
|
return false;
|
|
305
379
|
}
|
|
306
380
|
if (this._focusInsideEmebedMonaco(editor)) {
|
|
307
|
-
_log(loggerService,
|
|
381
|
+
_log(loggerService, "[NotebookEditor] focus is on embed monaco editor, bypass");
|
|
308
382
|
return false;
|
|
309
383
|
}
|
|
310
|
-
_log(loggerService,
|
|
384
|
+
_log(loggerService, "[NotebookEditor] run copy actions on notebook model");
|
|
311
385
|
return runCopyCells(accessor, editor, undefined);
|
|
312
386
|
}
|
|
313
387
|
runPasteAction(accessor) {
|
|
@@ -315,7 +389,10 @@ let NotebookClipboardContribution = class NotebookClipboardContribution extends
|
|
|
315
389
|
if (activeElement && isEditableElement(activeElement)) {
|
|
316
390
|
return false;
|
|
317
391
|
}
|
|
318
|
-
const {
|
|
392
|
+
const {
|
|
393
|
+
editor,
|
|
394
|
+
activeCell
|
|
395
|
+
} = this._getContext();
|
|
319
396
|
if (!editor || !editor.hasEditorFocus() || this._focusInsideEmebedMonaco(editor)) {
|
|
320
397
|
return false;
|
|
321
398
|
}
|
|
@@ -331,35 +408,42 @@ let NotebookClipboardContribution = class NotebookClipboardContribution extends
|
|
|
331
408
|
if (activeElement && isEditableElement(activeElement)) {
|
|
332
409
|
return false;
|
|
333
410
|
}
|
|
334
|
-
const {
|
|
411
|
+
const {
|
|
412
|
+
editor
|
|
413
|
+
} = this._getContext();
|
|
335
414
|
if (!editor || !editor.hasEditorFocus() || this._focusInsideEmebedMonaco(editor)) {
|
|
336
415
|
return false;
|
|
337
416
|
}
|
|
338
417
|
return runCutCells(accessor, editor, undefined);
|
|
339
418
|
}
|
|
340
419
|
};
|
|
341
|
-
NotebookClipboardContribution = ( __decorate([
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
const
|
|
348
|
-
const
|
|
420
|
+
NotebookClipboardContribution = ( __decorate([( __param(0, IEditorService))], NotebookClipboardContribution));
|
|
421
|
+
registerWorkbenchContribution2(
|
|
422
|
+
NotebookClipboardContribution.ID,
|
|
423
|
+
NotebookClipboardContribution,
|
|
424
|
+
WorkbenchPhase.BlockRestore
|
|
425
|
+
);
|
|
426
|
+
const COPY_CELL_COMMAND_ID = "notebook.cell.copy";
|
|
427
|
+
const CUT_CELL_COMMAND_ID = "notebook.cell.cut";
|
|
428
|
+
const PASTE_CELL_COMMAND_ID = "notebook.cell.paste";
|
|
429
|
+
const PASTE_CELL_ABOVE_COMMAND_ID = "notebook.cell.pasteAbove";
|
|
349
430
|
registerAction2(class extends NotebookCellAction {
|
|
350
431
|
constructor() {
|
|
351
432
|
super({
|
|
352
433
|
id: COPY_CELL_COMMAND_ID,
|
|
353
|
-
title: ( localize(
|
|
434
|
+
title: ( localize(9574, "Copy Cell")),
|
|
354
435
|
menu: {
|
|
355
436
|
id: MenuId.NotebookCellTitle,
|
|
356
437
|
when: NOTEBOOK_EDITOR_FOCUSED,
|
|
357
438
|
group: CellOverflowToolbarGroups.Copy,
|
|
358
|
-
order: 2
|
|
439
|
+
order: 2
|
|
359
440
|
},
|
|
360
441
|
keybinding: isNative ? undefined : {
|
|
361
442
|
primary: KeyMod.CtrlCmd | KeyCode.KeyC,
|
|
362
|
-
win: {
|
|
443
|
+
win: {
|
|
444
|
+
primary: KeyMod.CtrlCmd | KeyCode.KeyC,
|
|
445
|
+
secondary: [KeyMod.CtrlCmd | KeyCode.Insert]
|
|
446
|
+
},
|
|
363
447
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey))),
|
|
364
448
|
weight: KeybindingWeight.WorkbenchContrib
|
|
365
449
|
}
|
|
@@ -373,17 +457,20 @@ registerAction2(class extends NotebookCellAction {
|
|
|
373
457
|
constructor() {
|
|
374
458
|
super({
|
|
375
459
|
id: CUT_CELL_COMMAND_ID,
|
|
376
|
-
title: ( localize(
|
|
460
|
+
title: ( localize(9575, "Cut Cell")),
|
|
377
461
|
menu: {
|
|
378
462
|
id: MenuId.NotebookCellTitle,
|
|
379
463
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE)),
|
|
380
464
|
group: CellOverflowToolbarGroups.Copy,
|
|
381
|
-
order: 1
|
|
465
|
+
order: 1
|
|
382
466
|
},
|
|
383
467
|
keybinding: isNative ? undefined : {
|
|
384
468
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey))),
|
|
385
469
|
primary: KeyMod.CtrlCmd | KeyCode.KeyX,
|
|
386
|
-
win: {
|
|
470
|
+
win: {
|
|
471
|
+
primary: KeyMod.CtrlCmd | KeyCode.KeyX,
|
|
472
|
+
secondary: [KeyMod.Shift | KeyCode.Delete]
|
|
473
|
+
},
|
|
387
474
|
weight: KeybindingWeight.WorkbenchContrib
|
|
388
475
|
}
|
|
389
476
|
});
|
|
@@ -396,18 +483,24 @@ registerAction2(class extends NotebookAction {
|
|
|
396
483
|
constructor() {
|
|
397
484
|
super({
|
|
398
485
|
id: PASTE_CELL_COMMAND_ID,
|
|
399
|
-
title: ( localize(
|
|
486
|
+
title: ( localize(9576, "Paste Cell")),
|
|
400
487
|
menu: {
|
|
401
488
|
id: MenuId.NotebookCellTitle,
|
|
402
489
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE)),
|
|
403
490
|
group: CellOverflowToolbarGroups.Copy,
|
|
404
|
-
order: 3
|
|
491
|
+
order: 3
|
|
405
492
|
},
|
|
406
493
|
keybinding: isNative ? undefined : {
|
|
407
494
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey))),
|
|
408
495
|
primary: KeyMod.CtrlCmd | KeyCode.KeyV,
|
|
409
|
-
win: {
|
|
410
|
-
|
|
496
|
+
win: {
|
|
497
|
+
primary: KeyMod.CtrlCmd | KeyCode.KeyV,
|
|
498
|
+
secondary: [KeyMod.Shift | KeyCode.Insert]
|
|
499
|
+
},
|
|
500
|
+
linux: {
|
|
501
|
+
primary: KeyMod.CtrlCmd | KeyCode.KeyV,
|
|
502
|
+
secondary: [KeyMod.Shift | KeyCode.Insert]
|
|
503
|
+
},
|
|
411
504
|
weight: KeybindingWeight.EditorContrib
|
|
412
505
|
}
|
|
413
506
|
});
|
|
@@ -428,12 +521,12 @@ registerAction2(class extends NotebookCellAction {
|
|
|
428
521
|
constructor() {
|
|
429
522
|
super({
|
|
430
523
|
id: PASTE_CELL_ABOVE_COMMAND_ID,
|
|
431
|
-
title: ( localize(
|
|
524
|
+
title: ( localize(9577, "Paste Cell Above")),
|
|
432
525
|
keybinding: {
|
|
433
526
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey))),
|
|
434
527
|
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyV,
|
|
435
528
|
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
|
|
436
|
-
}
|
|
529
|
+
}
|
|
437
530
|
});
|
|
438
531
|
}
|
|
439
532
|
async runWithContext(accessor, context) {
|
|
@@ -454,25 +547,29 @@ registerAction2(class extends NotebookCellAction {
|
|
|
454
547
|
};
|
|
455
548
|
const currCellIndex = context.notebookEditor.getCellIndex(context.cell);
|
|
456
549
|
const newFocusIndex = currCellIndex;
|
|
457
|
-
textModel.applyEdits([
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
], true, originalState, () => ({
|
|
550
|
+
textModel.applyEdits([{
|
|
551
|
+
editType: CellEditType.Replace,
|
|
552
|
+
index: currCellIndex,
|
|
553
|
+
count: 0,
|
|
554
|
+
cells: ( pasteCells.items.map(cell => cloneNotebookCellTextModel(cell)))
|
|
555
|
+
}], true, originalState, () => ({
|
|
465
556
|
kind: SelectionStateType.Index,
|
|
466
|
-
focus: {
|
|
467
|
-
|
|
557
|
+
focus: {
|
|
558
|
+
start: newFocusIndex,
|
|
559
|
+
end: newFocusIndex + 1
|
|
560
|
+
},
|
|
561
|
+
selections: [{
|
|
562
|
+
start: newFocusIndex,
|
|
563
|
+
end: newFocusIndex + pasteCells.items.length
|
|
564
|
+
}]
|
|
468
565
|
}), undefined, true);
|
|
469
566
|
}
|
|
470
567
|
});
|
|
471
568
|
registerAction2(class extends Action2 {
|
|
472
569
|
constructor() {
|
|
473
570
|
super({
|
|
474
|
-
id:
|
|
475
|
-
title: ( localize2(
|
|
571
|
+
id: "workbench.action.toggleNotebookClipboardLog",
|
|
572
|
+
title: ( localize2(9578, "Toggle Notebook Clipboard Troubleshooting")),
|
|
476
573
|
category: Categories.Developer,
|
|
477
574
|
f1: true
|
|
478
575
|
});
|
|
@@ -488,8 +585,8 @@ registerAction2(class extends Action2 {
|
|
|
488
585
|
registerAction2(class extends NotebookCellAction {
|
|
489
586
|
constructor() {
|
|
490
587
|
super({
|
|
491
|
-
id:
|
|
492
|
-
title: ( localize(
|
|
588
|
+
id: "notebook.cell.output.selectAll",
|
|
589
|
+
title: ( localize(9579, "Select All")),
|
|
493
590
|
keybinding: {
|
|
494
591
|
primary: KeyMod.CtrlCmd | KeyCode.KeyA,
|
|
495
592
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_OUTPUT_FOCUSED)),
|
|
@@ -511,8 +608,7 @@ registerAction2(class extends NotebookCellAction {
|
|
|
511
608
|
}
|
|
512
609
|
if (cell.inputInOutputIsFocused) {
|
|
513
610
|
editor.selectInputContents(cell);
|
|
514
|
-
}
|
|
515
|
-
else {
|
|
611
|
+
} else {
|
|
516
612
|
editor.selectOutputContent(cell);
|
|
517
613
|
}
|
|
518
614
|
return true;
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js
CHANGED
|
@@ -34,7 +34,9 @@ let NotebookBreakpoints = class NotebookBreakpoints extends Disposable {
|
|
|
34
34
|
if (deleteCount > 0) {
|
|
35
35
|
const deleted = model.cells.slice(start, start + deleteCount);
|
|
36
36
|
for (const deletedCell of deleted) {
|
|
37
|
-
const cellBps = debugModel.getBreakpoints({
|
|
37
|
+
const cellBps = debugModel.getBreakpoints({
|
|
38
|
+
uri: deletedCell.uri
|
|
39
|
+
});
|
|
38
40
|
cellBps.forEach(cellBp => this._debugService.removeBreakpoints(cellBp.getId()));
|
|
39
41
|
}
|
|
40
42
|
}
|
|
@@ -47,7 +49,9 @@ let NotebookBreakpoints = class NotebookBreakpoints extends Disposable {
|
|
|
47
49
|
listeners.delete(model.uri);
|
|
48
50
|
}));
|
|
49
51
|
this._register(this._debugService.getModel().onDidChangeBreakpoints(e => {
|
|
50
|
-
const newCellBp = e?.added?.find(bp => hasKey(bp, {
|
|
52
|
+
const newCellBp = e?.added?.find(bp => hasKey(bp, {
|
|
53
|
+
uri: true
|
|
54
|
+
}) && bp.uri.scheme === Schemas.vscodeNotebookCell);
|
|
51
55
|
if (newCellBp) {
|
|
52
56
|
const parsed = CellUri.parse(newCellBp.uri);
|
|
53
57
|
if (!parsed) {
|
|
@@ -76,7 +80,7 @@ let NotebookBreakpoints = class NotebookBreakpoints extends Disposable {
|
|
|
76
80
|
});
|
|
77
81
|
bps.forEach(bp => {
|
|
78
82
|
const idx = idxMap.get(bp.uri);
|
|
79
|
-
if (typeof idx !==
|
|
83
|
+
if (typeof idx !== "number") {
|
|
80
84
|
return;
|
|
81
85
|
}
|
|
82
86
|
const notebook = CellUri.parse(bp.uri)?.notebook;
|
|
@@ -88,22 +92,16 @@ let NotebookBreakpoints = class NotebookBreakpoints extends Disposable {
|
|
|
88
92
|
return;
|
|
89
93
|
}
|
|
90
94
|
this._debugService.removeBreakpoints(bp.getId());
|
|
91
|
-
this._debugService.addBreakpoints(newUri, [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
]);
|
|
95
|
+
this._debugService.addBreakpoints(newUri, [{
|
|
96
|
+
column: bp.column,
|
|
97
|
+
condition: bp.condition,
|
|
98
|
+
enabled: bp.enabled,
|
|
99
|
+
hitCondition: bp.hitCondition,
|
|
100
|
+
logMessage: bp.logMessage,
|
|
101
|
+
lineNumber: bp.lineNumber
|
|
102
|
+
}]);
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
|
-
NotebookBreakpoints = ( __decorate([
|
|
105
|
-
( __param(0, IDebugService)),
|
|
106
|
-
( __param(1, INotebookService)),
|
|
107
|
-
( __param(2, IEditorService))
|
|
108
|
-
], NotebookBreakpoints));
|
|
106
|
+
NotebookBreakpoints = ( __decorate([( __param(0, IDebugService)), ( __param(1, INotebookService)), ( __param(2, IEditorService))], NotebookBreakpoints));
|
|
109
107
|
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookBreakpoints, LifecyclePhase.Restored);
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js
CHANGED
|
@@ -54,16 +54,13 @@ let NotebookCellPausing = class NotebookCellPausing extends Disposable {
|
|
|
54
54
|
const exeState = this._notebookExecutionStateService.getCellExecution(cellUri);
|
|
55
55
|
if (exeState && (exeState.isPaused !== isPaused || !exeState.didPause)) {
|
|
56
56
|
exeState.update([{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
editType: CellExecutionUpdateType.ExecutionState,
|
|
58
|
+
didPause: true,
|
|
59
|
+
isPaused
|
|
60
|
+
}]);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
NotebookCellPausing = ( __decorate([
|
|
66
|
-
( __param(0, IDebugService)),
|
|
67
|
-
( __param(1, INotebookExecutionStateService))
|
|
68
|
-
], NotebookCellPausing));
|
|
65
|
+
NotebookCellPausing = ( __decorate([( __param(0, IDebugService)), ( __param(1, INotebookExecutionStateService))], NotebookCellPausing));
|
|
69
66
|
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookCellPausing, LifecyclePhase.Restored);
|