@codingame/monaco-vscode-notebook-service-override 4.5.1 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +30 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +24 -32
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +30 -53
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +40 -84
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +9 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +35 -48
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +13 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +2 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +94 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +13 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +8 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +3 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +25 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +71 -89
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +4 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +97 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +7 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +128 -177
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +132 -145
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +70 -130
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +32 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +39 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +28 -43
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +23 -66
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +58 -57
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +162 -264
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +33 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +58 -153
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +15 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +13 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +22 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +100 -92
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +6 -2
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +6 -4
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +1 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +41 -76
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +42 -45
|
@@ -26,6 +26,7 @@ import { NotebookFileWorkingCopyModel } from 'vscode/vscode/vs/workbench/contrib
|
|
|
26
26
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
27
27
|
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
28
28
|
|
|
29
|
+
const _moduleId = "vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants";
|
|
29
30
|
let FormatOnSaveParticipant = class FormatOnSaveParticipant {
|
|
30
31
|
constructor(editorWorkerService, languageFeaturesService, textModelService, bulkEditService, configurationService) {
|
|
31
32
|
this.editorWorkerService = editorWorkerService;
|
|
@@ -46,30 +47,24 @@ let FormatOnSaveParticipant = class FormatOnSaveParticipant {
|
|
|
46
47
|
return undefined;
|
|
47
48
|
}
|
|
48
49
|
const notebook = workingCopy.model.notebookModel;
|
|
49
|
-
progress.report({ message: ( localizeWithPath(
|
|
50
|
-
|
|
51
|
-
'notebookFormatSave.formatting',
|
|
52
|
-
"Formatting"
|
|
53
|
-
)) });
|
|
54
|
-
const disposable = ( new DisposableStore());
|
|
50
|
+
progress.report({ message: ( localizeWithPath(_moduleId, 0, "Formatting")) });
|
|
51
|
+
const disposable = ( (new DisposableStore()));
|
|
55
52
|
try {
|
|
56
|
-
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
53
|
+
const allCellEdits = await Promise.all(( (notebook.cells.map(async (cell) => {
|
|
57
54
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
58
55
|
disposable.add(ref);
|
|
59
56
|
const model = ref.object.textEditorModel;
|
|
60
57
|
const formatEdits = await getDocumentFormattingEditsUntilResult(this.editorWorkerService, this.languageFeaturesService, model, model.getOptions(), token);
|
|
61
58
|
const edits = [];
|
|
62
59
|
if (formatEdits) {
|
|
63
|
-
edits.push(...( formatEdits.map(
|
|
60
|
+
edits.push(...( (formatEdits.map(
|
|
61
|
+
edit => ( (new ResourceTextEdit(model.uri, edit, model.getVersionId())))
|
|
62
|
+
))));
|
|
64
63
|
return edits;
|
|
65
64
|
}
|
|
66
65
|
return [];
|
|
67
|
-
})));
|
|
68
|
-
await this.bulkEditService.apply( allCellEdits.flat(), { label: ( localizeWithPath(
|
|
69
|
-
'vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants',
|
|
70
|
-
'formatNotebook',
|
|
71
|
-
"Format Notebook"
|
|
72
|
-
)), code: 'undoredo.formatNotebook', });
|
|
66
|
+
}))));
|
|
67
|
+
await this.bulkEditService.apply( allCellEdits.flat(), { label: ( localizeWithPath(_moduleId, 1, "Format Notebook")), code: 'undoredo.formatNotebook', });
|
|
73
68
|
}
|
|
74
69
|
finally {
|
|
75
70
|
progress.report({ increment: 100 });
|
|
@@ -77,13 +72,13 @@ let FormatOnSaveParticipant = class FormatOnSaveParticipant {
|
|
|
77
72
|
}
|
|
78
73
|
}
|
|
79
74
|
};
|
|
80
|
-
FormatOnSaveParticipant = ( __decorate([
|
|
81
|
-
( __param(0, IEditorWorkerService)),
|
|
82
|
-
( __param(1, ILanguageFeaturesService)),
|
|
83
|
-
( __param(2, ITextModelService)),
|
|
84
|
-
( __param(3, IBulkEditService)),
|
|
85
|
-
( __param(4, IConfigurationService))
|
|
86
|
-
], FormatOnSaveParticipant));
|
|
75
|
+
FormatOnSaveParticipant = ( (__decorate([
|
|
76
|
+
( (__param(0, IEditorWorkerService))),
|
|
77
|
+
( (__param(1, ILanguageFeaturesService))),
|
|
78
|
+
( (__param(2, ITextModelService))),
|
|
79
|
+
( (__param(3, IBulkEditService))),
|
|
80
|
+
( (__param(4, IConfigurationService)))
|
|
81
|
+
], FormatOnSaveParticipant)));
|
|
87
82
|
let TrimWhitespaceParticipant = class TrimWhitespaceParticipant {
|
|
88
83
|
constructor(configurationService, editorService, textModelService, bulkEditService) {
|
|
89
84
|
this.configurationService = configurationService;
|
|
@@ -102,28 +97,28 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant {
|
|
|
102
97
|
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
103
98
|
return;
|
|
104
99
|
}
|
|
105
|
-
const disposable = ( new DisposableStore());
|
|
100
|
+
const disposable = ( (new DisposableStore()));
|
|
106
101
|
const notebook = workingCopy.model.notebookModel;
|
|
107
102
|
const activeCellEditor = getActiveCellCodeEditor(this.editorService);
|
|
108
103
|
let cursors = [];
|
|
109
104
|
let prevSelection = [];
|
|
110
105
|
try {
|
|
111
|
-
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
106
|
+
const allCellEdits = await Promise.all(( (notebook.cells.map(async (cell) => {
|
|
112
107
|
if (cell.cellKind !== CellKind.Code) {
|
|
113
108
|
return [];
|
|
114
109
|
}
|
|
115
110
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
116
111
|
disposable.add(ref);
|
|
117
112
|
const model = ref.object.textEditorModel;
|
|
118
|
-
const isActiveCell = (activeCellEditor && ( cell.uri.toString()) === activeCellEditor.getModel()?.uri.toString());
|
|
113
|
+
const isActiveCell = (activeCellEditor && ( (cell.uri.toString())) === activeCellEditor.getModel()?.uri.toString());
|
|
119
114
|
if (isActiveCell) {
|
|
120
115
|
prevSelection = activeCellEditor.getSelections() ?? [];
|
|
121
116
|
if (isAutoSaved) {
|
|
122
|
-
cursors = ( prevSelection.map(s => s.getPosition()));
|
|
117
|
+
cursors = ( (prevSelection.map(s => s.getPosition())));
|
|
123
118
|
const snippetsRange = SnippetController2.get(activeCellEditor)?.getSessionEnclosingRange();
|
|
124
119
|
if (snippetsRange) {
|
|
125
120
|
for (let lineNumber = snippetsRange.startLineNumber; lineNumber <= snippetsRange.endLineNumber; lineNumber++) {
|
|
126
|
-
cursors.push(( new Position(lineNumber, model.getLineMaxColumn(lineNumber))));
|
|
121
|
+
cursors.push(( (new Position(lineNumber, model.getLineMaxColumn(lineNumber)))));
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
124
|
}
|
|
@@ -132,14 +127,14 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant {
|
|
|
132
127
|
if (!ops.length) {
|
|
133
128
|
return [];
|
|
134
129
|
}
|
|
135
|
-
return (
|
|
136
|
-
|
|
130
|
+
return (
|
|
131
|
+
(ops.map(
|
|
132
|
+
op => ( (new ResourceTextEdit(model.uri, { ...op, text: op.text || '' }, model.getVersionId())))
|
|
133
|
+
))
|
|
134
|
+
);
|
|
135
|
+
}))));
|
|
137
136
|
const filteredEdits = allCellEdits.flat().filter(edit => edit !== undefined);
|
|
138
|
-
await this.bulkEditService.apply(filteredEdits, { label: ( localizeWithPath(
|
|
139
|
-
'vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants',
|
|
140
|
-
'trimNotebookWhitespace',
|
|
141
|
-
"Notebook Trim Trailing Whitespace"
|
|
142
|
-
)), code: 'undoredo.notebookTrimTrailingWhitespace' });
|
|
137
|
+
await this.bulkEditService.apply(filteredEdits, { label: ( localizeWithPath(_moduleId, 2, "Notebook Trim Trailing Whitespace")), code: 'undoredo.notebookTrimTrailingWhitespace' });
|
|
143
138
|
}
|
|
144
139
|
finally {
|
|
145
140
|
progress.report({ increment: 100 });
|
|
@@ -147,12 +142,12 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant {
|
|
|
147
142
|
}
|
|
148
143
|
}
|
|
149
144
|
};
|
|
150
|
-
TrimWhitespaceParticipant = ( __decorate([
|
|
151
|
-
( __param(0, IConfigurationService)),
|
|
152
|
-
( __param(1, IEditorService)),
|
|
153
|
-
( __param(2, ITextModelService)),
|
|
154
|
-
( __param(3, IBulkEditService))
|
|
155
|
-
], TrimWhitespaceParticipant));
|
|
145
|
+
TrimWhitespaceParticipant = ( (__decorate([
|
|
146
|
+
( (__param(0, IConfigurationService))),
|
|
147
|
+
( (__param(1, IEditorService))),
|
|
148
|
+
( (__param(2, ITextModelService))),
|
|
149
|
+
( (__param(3, IBulkEditService)))
|
|
150
|
+
], TrimWhitespaceParticipant)));
|
|
156
151
|
let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant {
|
|
157
152
|
constructor(configurationService, editorService, bulkEditService) {
|
|
158
153
|
this.configurationService = configurationService;
|
|
@@ -177,16 +172,16 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant {
|
|
|
177
172
|
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
178
173
|
return;
|
|
179
174
|
}
|
|
180
|
-
const disposable = ( new DisposableStore());
|
|
175
|
+
const disposable = ( (new DisposableStore()));
|
|
181
176
|
const notebook = workingCopy.model.notebookModel;
|
|
182
177
|
const activeCellEditor = getActiveCellCodeEditor(this.editorService);
|
|
183
178
|
try {
|
|
184
|
-
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
179
|
+
const allCellEdits = await Promise.all(( (notebook.cells.map(async (cell) => {
|
|
185
180
|
if (cell.cellKind !== CellKind.Code) {
|
|
186
181
|
return;
|
|
187
182
|
}
|
|
188
183
|
let cannotTouchLineNumber = 0;
|
|
189
|
-
const isActiveCell = (activeCellEditor && ( cell.uri.toString()) === activeCellEditor.getModel()?.uri.toString());
|
|
184
|
+
const isActiveCell = (activeCellEditor && ( (cell.uri.toString())) === activeCellEditor.getModel()?.uri.toString());
|
|
190
185
|
if (isAutoSaved && isActiveCell) {
|
|
191
186
|
const selections = activeCellEditor.getSelections() ?? [];
|
|
192
187
|
for (const sel of selections) {
|
|
@@ -199,27 +194,25 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant {
|
|
|
199
194
|
if (deleteFromLineNumber > textBuffer.getLineCount()) {
|
|
200
195
|
return;
|
|
201
196
|
}
|
|
202
|
-
const deletionRange = ( new Range(
|
|
197
|
+
const deletionRange = ( (new Range(
|
|
203
198
|
deleteFromLineNumber,
|
|
204
199
|
1,
|
|
205
200
|
textBuffer.getLineCount(),
|
|
206
201
|
textBuffer.getLineLastNonWhitespaceColumn(textBuffer.getLineCount())
|
|
207
|
-
));
|
|
202
|
+
)));
|
|
208
203
|
if (deletionRange.isEmpty()) {
|
|
209
204
|
return;
|
|
210
205
|
}
|
|
211
|
-
return (
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
206
|
+
return (
|
|
207
|
+
(new ResourceTextEdit(
|
|
208
|
+
cell.uri,
|
|
209
|
+
{ range: deletionRange, text: '' },
|
|
210
|
+
cell.textModel?.getVersionId()
|
|
211
|
+
))
|
|
212
|
+
);
|
|
213
|
+
}))));
|
|
217
214
|
const filteredEdits = allCellEdits.flat().filter(edit => edit !== undefined);
|
|
218
|
-
await this.bulkEditService.apply(filteredEdits, { label: ( localizeWithPath(
|
|
219
|
-
'vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants',
|
|
220
|
-
'trimNotebookNewlines',
|
|
221
|
-
"Trim Final New Lines"
|
|
222
|
-
)), code: 'undoredo.trimFinalNewLines' });
|
|
215
|
+
await this.bulkEditService.apply(filteredEdits, { label: ( localizeWithPath(_moduleId, 3, "Trim Final New Lines")), code: 'undoredo.trimFinalNewLines' });
|
|
223
216
|
}
|
|
224
217
|
finally {
|
|
225
218
|
progress.report({ increment: 100 });
|
|
@@ -227,11 +220,11 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant {
|
|
|
227
220
|
}
|
|
228
221
|
}
|
|
229
222
|
};
|
|
230
|
-
TrimFinalNewLinesParticipant = ( __decorate([
|
|
231
|
-
( __param(0, IConfigurationService)),
|
|
232
|
-
( __param(1, IEditorService)),
|
|
233
|
-
( __param(2, IBulkEditService))
|
|
234
|
-
], TrimFinalNewLinesParticipant));
|
|
223
|
+
TrimFinalNewLinesParticipant = ( (__decorate([
|
|
224
|
+
( (__param(0, IConfigurationService))),
|
|
225
|
+
( (__param(1, IEditorService))),
|
|
226
|
+
( (__param(2, IBulkEditService)))
|
|
227
|
+
], TrimFinalNewLinesParticipant)));
|
|
235
228
|
let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant {
|
|
236
229
|
constructor(configurationService, bulkEditService, editorService) {
|
|
237
230
|
this.configurationService = configurationService;
|
|
@@ -247,7 +240,7 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant {
|
|
|
247
240
|
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
248
241
|
return;
|
|
249
242
|
}
|
|
250
|
-
const disposable = ( new DisposableStore());
|
|
243
|
+
const disposable = ( (new DisposableStore()));
|
|
251
244
|
const notebook = workingCopy.model.notebookModel;
|
|
252
245
|
const activeCellEditor = getActiveCellCodeEditor(this.editorService);
|
|
253
246
|
let selections;
|
|
@@ -255,7 +248,7 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant {
|
|
|
255
248
|
selections = activeCellEditor.getSelections() ?? [];
|
|
256
249
|
}
|
|
257
250
|
try {
|
|
258
|
-
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
251
|
+
const allCellEdits = await Promise.all(( (notebook.cells.map(async (cell) => {
|
|
259
252
|
if (cell.cellKind !== CellKind.Code) {
|
|
260
253
|
return;
|
|
261
254
|
}
|
|
@@ -264,19 +257,17 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant {
|
|
|
264
257
|
if (!lineCount || lastLineIsEmptyOrWhitespace) {
|
|
265
258
|
return;
|
|
266
259
|
}
|
|
267
|
-
return (
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
260
|
+
return (
|
|
261
|
+
(new ResourceTextEdit(cell.uri, { range: ( (new Range(
|
|
262
|
+
lineCount + 1,
|
|
263
|
+
cell.textBuffer.getLineLength(lineCount),
|
|
264
|
+
lineCount + 1,
|
|
265
|
+
cell.textBuffer.getLineLength(lineCount)
|
|
266
|
+
))), text: cell.textBuffer.getEOL() }, cell.textModel?.getVersionId()))
|
|
267
|
+
);
|
|
268
|
+
}))));
|
|
274
269
|
const filteredEdits = allCellEdits.filter(edit => edit !== undefined);
|
|
275
|
-
await this.bulkEditService.apply(filteredEdits, { label: ( localizeWithPath(
|
|
276
|
-
'vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants',
|
|
277
|
-
'insertFinalNewLine',
|
|
278
|
-
"Insert Final New Line"
|
|
279
|
-
)), code: 'undoredo.insertFinalNewLine' });
|
|
270
|
+
await this.bulkEditService.apply(filteredEdits, { label: ( localizeWithPath(_moduleId, 4, "Insert Final New Line")), code: 'undoredo.insertFinalNewLine' });
|
|
280
271
|
if (activeCellEditor && selections) {
|
|
281
272
|
activeCellEditor.setSelections(selections);
|
|
282
273
|
}
|
|
@@ -287,11 +278,11 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant {
|
|
|
287
278
|
}
|
|
288
279
|
}
|
|
289
280
|
};
|
|
290
|
-
InsertFinalNewLineParticipant = ( __decorate([
|
|
291
|
-
( __param(0, IConfigurationService)),
|
|
292
|
-
( __param(1, IBulkEditService)),
|
|
293
|
-
( __param(2, IEditorService))
|
|
294
|
-
], InsertFinalNewLineParticipant));
|
|
281
|
+
InsertFinalNewLineParticipant = ( (__decorate([
|
|
282
|
+
( (__param(0, IConfigurationService))),
|
|
283
|
+
( (__param(1, IBulkEditService))),
|
|
284
|
+
( (__param(2, IEditorService)))
|
|
285
|
+
], InsertFinalNewLineParticipant)));
|
|
295
286
|
let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
296
287
|
constructor(configurationService, logService, workspaceTrustManagementService, languageFeaturesService, textModelService, instantiationService) {
|
|
297
288
|
this.configurationService = configurationService;
|
|
@@ -302,7 +293,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
302
293
|
this.instantiationService = instantiationService;
|
|
303
294
|
}
|
|
304
295
|
async participate(workingCopy, context, progress, token) {
|
|
305
|
-
const nbDisposable = ( new DisposableStore());
|
|
296
|
+
const nbDisposable = ( (new DisposableStore()));
|
|
306
297
|
const isTrusted = this.workspaceTrustManagementService.isWorkspaceTrusted();
|
|
307
298
|
if (!isTrusted) {
|
|
308
299
|
return;
|
|
@@ -327,7 +318,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
327
318
|
}
|
|
328
319
|
const settingItems = Array.isArray(setting)
|
|
329
320
|
? setting
|
|
330
|
-
: ( Object.keys(setting)).filter(x => setting[x]);
|
|
321
|
+
: ( (Object.keys(setting))).filter(x => setting[x]);
|
|
331
322
|
if (!settingItems.length) {
|
|
332
323
|
return undefined;
|
|
333
324
|
}
|
|
@@ -355,11 +346,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
355
346
|
return 0;
|
|
356
347
|
});
|
|
357
348
|
}
|
|
358
|
-
progress.report({ message: ( localizeWithPath(
|
|
359
|
-
'vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants',
|
|
360
|
-
'notebookSaveParticipants.notebookCodeActions',
|
|
361
|
-
"Running 'Notebook' code actions"
|
|
362
|
-
)) });
|
|
349
|
+
progress.report({ message: ( localizeWithPath(_moduleId, 5, "Running 'Notebook' code actions")) });
|
|
363
350
|
try {
|
|
364
351
|
const cell = notebookModel.cells[0];
|
|
365
352
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
@@ -374,19 +361,15 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
374
361
|
progress.report({ increment: 100 });
|
|
375
362
|
nbDisposable.dispose();
|
|
376
363
|
}
|
|
377
|
-
const disposable = ( new DisposableStore());
|
|
378
|
-
progress.report({ message: ( localizeWithPath(
|
|
379
|
-
'vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants',
|
|
380
|
-
'notebookSaveParticipants.cellCodeActions',
|
|
381
|
-
"Running 'Cell' code actions"
|
|
382
|
-
)) });
|
|
364
|
+
const disposable = ( (new DisposableStore()));
|
|
365
|
+
progress.report({ message: ( localizeWithPath(_moduleId, 6, "Running 'Cell' code actions")) });
|
|
383
366
|
try {
|
|
384
|
-
await Promise.all(( notebookModel.cells.map(async (cell) => {
|
|
367
|
+
await Promise.all(( (notebookModel.cells.map(async (cell) => {
|
|
385
368
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
386
369
|
disposable.add(ref);
|
|
387
370
|
const textEditorModel = ref.object.textEditorModel;
|
|
388
371
|
await this.applyOnSaveActions(textEditorModel, editorCodeActionsOnSave, excludedActions, progress, token);
|
|
389
|
-
})));
|
|
372
|
+
}))));
|
|
390
373
|
}
|
|
391
374
|
catch {
|
|
392
375
|
this.logService.error('Failed to apply code action on save');
|
|
@@ -397,7 +380,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
397
380
|
}
|
|
398
381
|
}
|
|
399
382
|
createCodeActionsOnSave(settingItems) {
|
|
400
|
-
const kinds = ( settingItems.map(x => ( new HierarchicalKind(x))));
|
|
383
|
+
const kinds = ( (settingItems.map(x => ( (new HierarchicalKind(x))))));
|
|
401
384
|
return kinds.filter(kind => {
|
|
402
385
|
return kinds.every(otherKind => otherKind.equals(kind) || !otherKind.contains(kind));
|
|
403
386
|
});
|
|
@@ -405,21 +388,21 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
405
388
|
async applyOnSaveActions(model, codeActionsOnSave, excludes, progress, token) {
|
|
406
389
|
const getActionProgress = new (class {
|
|
407
390
|
constructor() {
|
|
408
|
-
this._names = ( new Set());
|
|
391
|
+
this._names = ( (new Set()));
|
|
409
392
|
}
|
|
410
393
|
_report() {
|
|
411
394
|
progress.report({
|
|
412
395
|
message: ( localizeWithPath(
|
|
413
|
-
|
|
414
|
-
|
|
396
|
+
_moduleId,
|
|
397
|
+
7,
|
|
415
398
|
"Getting code actions from '{0}' ([configure]({1})).",
|
|
416
|
-
( [...this._names].map(name => `'${name}'`)).join(', '),
|
|
399
|
+
( ([...this._names].map(name => `'${name}'`))).join(', '),
|
|
417
400
|
'command:workbench.action.openSettings?%5B%22editor.codeActionsOnSave%22%5D'
|
|
418
401
|
))
|
|
419
402
|
});
|
|
420
403
|
}
|
|
421
404
|
report(provider) {
|
|
422
|
-
if (provider.displayName && !( this._names.has(provider.displayName))) {
|
|
405
|
+
if (provider.displayName && !( (this._names.has(provider.displayName)))) {
|
|
423
406
|
this._names.add(provider.displayName);
|
|
424
407
|
this._report();
|
|
425
408
|
}
|
|
@@ -451,12 +434,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
451
434
|
this.logService.warn('Failed to apply code action on save, applied to multiple resources.');
|
|
452
435
|
continue;
|
|
453
436
|
}
|
|
454
|
-
progress.report({ message: ( localizeWithPath(
|
|
455
|
-
'vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants',
|
|
456
|
-
'codeAction.apply',
|
|
457
|
-
"Applying code action '{0}'.",
|
|
458
|
-
action.action.title
|
|
459
|
-
)) });
|
|
437
|
+
progress.report({ message: ( localizeWithPath(_moduleId, 8, "Applying code action '{0}'.", action.action.title)) });
|
|
460
438
|
await this.instantiationService.invokeFunction(applyCodeAction, action, ApplyCodeActionReason.OnSave, {}, token);
|
|
461
439
|
if (token.isCancellationRequested) {
|
|
462
440
|
return;
|
|
@@ -478,14 +456,14 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
478
456
|
}, progress, token);
|
|
479
457
|
}
|
|
480
458
|
};
|
|
481
|
-
CodeActionOnSaveParticipant = ( __decorate([
|
|
482
|
-
( __param(0, IConfigurationService)),
|
|
483
|
-
( __param(1, ILogService)),
|
|
484
|
-
( __param(2, IWorkspaceTrustManagementService)),
|
|
485
|
-
( __param(3, ILanguageFeaturesService)),
|
|
486
|
-
( __param(4, ITextModelService)),
|
|
487
|
-
( __param(5, IInstantiationService))
|
|
488
|
-
], CodeActionOnSaveParticipant));
|
|
459
|
+
CodeActionOnSaveParticipant = ( (__decorate([
|
|
460
|
+
( (__param(0, IConfigurationService))),
|
|
461
|
+
( (__param(1, ILogService))),
|
|
462
|
+
( (__param(2, IWorkspaceTrustManagementService))),
|
|
463
|
+
( (__param(3, ILanguageFeaturesService))),
|
|
464
|
+
( (__param(4, ITextModelService))),
|
|
465
|
+
( (__param(5, IInstantiationService)))
|
|
466
|
+
], CodeActionOnSaveParticipant)));
|
|
489
467
|
function getActiveCellCodeEditor(editorService) {
|
|
490
468
|
const activePane = editorService.activeEditorPane;
|
|
491
469
|
const notebookEditor = getNotebookEditorFromEditorPane(activePane);
|
|
@@ -507,11 +485,11 @@ let SaveParticipantsContribution = class SaveParticipantsContribution extends Di
|
|
|
507
485
|
this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(TrimFinalNewLinesParticipant)));
|
|
508
486
|
}
|
|
509
487
|
};
|
|
510
|
-
SaveParticipantsContribution = ( __decorate([
|
|
511
|
-
( __param(0, IInstantiationService)),
|
|
512
|
-
( __param(1, IWorkingCopyFileService))
|
|
513
|
-
], SaveParticipantsContribution));
|
|
514
|
-
const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
|
|
488
|
+
SaveParticipantsContribution = ( (__decorate([
|
|
489
|
+
( (__param(0, IInstantiationService))),
|
|
490
|
+
( (__param(1, IWorkingCopyFileService)))
|
|
491
|
+
], SaveParticipantsContribution)));
|
|
492
|
+
const workbenchContributionsRegistry = ( (Registry.as(Extensions.Workbench)));
|
|
515
493
|
workbenchContributionsRegistry.registerWorkbenchContribution(SaveParticipantsContribution, 3 );
|
|
516
494
|
|
|
517
495
|
export { SaveParticipantsContribution };
|
|
@@ -7,12 +7,13 @@ import { registerNotebookContribution } from 'vscode/vscode/vs/workbench/contrib
|
|
|
7
7
|
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
8
8
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
9
9
|
|
|
10
|
+
const _moduleId = "vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout";
|
|
10
11
|
class TroubleshootController extends Disposable {
|
|
11
12
|
static { this.id = 'workbench.notebook.troubleshoot'; }
|
|
12
13
|
constructor(_notebookEditor) {
|
|
13
14
|
super();
|
|
14
15
|
this._notebookEditor = _notebookEditor;
|
|
15
|
-
this._localStore = this._register(( new DisposableStore()));
|
|
16
|
+
this._localStore = this._register(( (new DisposableStore())));
|
|
16
17
|
this._cellStateListeners = [];
|
|
17
18
|
this._enabled = false;
|
|
18
19
|
this._cellStatusItems = [];
|
|
@@ -52,11 +53,11 @@ class TroubleshootController extends Disposable {
|
|
|
52
53
|
this._localStore.add(this._notebookEditor.onDidChangeViewCells(e => {
|
|
53
54
|
[...e.splices].reverse().forEach(splice => {
|
|
54
55
|
const [start, deleted, newCells] = splice;
|
|
55
|
-
const deletedCells = this._cellStateListeners.splice(start, deleted, ...( newCells.map(cell => {
|
|
56
|
+
const deletedCells = this._cellStateListeners.splice(start, deleted, ...( (newCells.map(cell => {
|
|
56
57
|
return cell.onDidChangeLayout((e) => {
|
|
57
58
|
this._log(cell, e);
|
|
58
59
|
});
|
|
59
|
-
})));
|
|
60
|
+
}))));
|
|
60
61
|
dispose(deletedCells);
|
|
61
62
|
});
|
|
62
63
|
}));
|
|
@@ -93,11 +94,7 @@ registerAction2(class extends Action2 {
|
|
|
93
94
|
constructor() {
|
|
94
95
|
super({
|
|
95
96
|
id: 'notebook.toggleLayoutTroubleshoot',
|
|
96
|
-
title: ( localize2WithPath(
|
|
97
|
-
'vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout',
|
|
98
|
-
'workbench.notebook.toggleLayoutTroubleshoot',
|
|
99
|
-
"Toggle Layout Troubleshoot"
|
|
100
|
-
)),
|
|
97
|
+
title: ( localize2WithPath(_moduleId, 0, "Toggle Layout Troubleshoot")),
|
|
101
98
|
category: Categories.Developer,
|
|
102
99
|
f1: true
|
|
103
100
|
});
|
|
@@ -116,11 +113,7 @@ registerAction2(class extends Action2 {
|
|
|
116
113
|
constructor() {
|
|
117
114
|
super({
|
|
118
115
|
id: 'notebook.inspectLayout',
|
|
119
|
-
title: ( localize2WithPath(
|
|
120
|
-
'vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout',
|
|
121
|
-
'workbench.notebook.inspectLayout',
|
|
122
|
-
"Inspect Notebook Layout"
|
|
123
|
-
)),
|
|
116
|
+
title: ( localize2WithPath(_moduleId, 1, "Inspect Notebook Layout")),
|
|
124
117
|
category: Categories.Developer,
|
|
125
118
|
f1: true
|
|
126
119
|
});
|
|
@@ -141,11 +134,7 @@ registerAction2(class extends Action2 {
|
|
|
141
134
|
constructor() {
|
|
142
135
|
super({
|
|
143
136
|
id: 'notebook.clearNotebookEdtitorTypeCache',
|
|
144
|
-
title: ( localize2WithPath(
|
|
145
|
-
'vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout',
|
|
146
|
-
'workbench.notebook.clearNotebookEdtitorTypeCache',
|
|
147
|
-
"Clear Notebook Editor Type Cache"
|
|
148
|
-
)),
|
|
137
|
+
title: ( localize2WithPath(_moduleId, 2, "Clear Notebook Editor Type Cache")),
|
|
149
138
|
category: Categories.Developer,
|
|
150
139
|
f1: true
|
|
151
140
|
});
|