@codingame/monaco-vscode-notebook-service-override 11.1.2 → 12.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.d.ts +2 -1
- package/index.js +64 -1
- package/package.json +47 -15
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +43 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +109 -130
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +13 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +72 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +23 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +30 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.js +76 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +61 -58
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +5 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +4 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +10 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +52 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +3 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +28 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +51 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +21 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +4 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +3 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +6 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.d.ts +69 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +460 -382
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +124 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +87 -145
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +16 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +9 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +40 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +112 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +115 -116
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +111 -117
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +11 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +5 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +7 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +113 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +25 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +115 -145
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +76 -147
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +45 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +30 -35
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +19 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +59 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +11 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +69 -113
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +194 -184
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +51 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +14 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.d.ts +48 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +57 -56
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +29 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +17 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.d.ts +46 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +14 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +21 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +7 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +30 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +6 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.d.ts +134 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +164 -121
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +37 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +6 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +101 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +131 -55
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +48 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +12 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +75 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.js +2 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.d.ts +31 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +2 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.d.ts +78 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +45 -42
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.d.ts +96 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +57 -54
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +74 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +6 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.d.ts +53 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +2 -1
- package/worker.js +2 -1
- package/workers/notebook.worker.d.ts +1 -0
- package/notebook.js +0 -50
- package/workers/notebook.worker.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { HierarchicalKind } from 'vscode/vscode/vs/base/common/hierarchicalKind';
|
|
3
4
|
import { DisposableStore, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
5
|
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
@@ -6,12 +7,13 @@ import { ResourceTextEdit, IBulkEditService } from 'vscode/vscode/vs/editor/brow
|
|
|
6
7
|
import { trimTrailingWhitespace } from 'vscode/vscode/vs/editor/common/commands/trimTrailingWhitespaceCommand';
|
|
7
8
|
import { Position } from 'vscode/vscode/vs/editor/common/core/position';
|
|
8
9
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
10
|
+
import { CodeActionTriggerType } from 'vscode/vscode/vs/editor/common/languages';
|
|
9
11
|
import { IEditorWorkerService } from 'vscode/vscode/vs/editor/common/services/editorWorker';
|
|
10
12
|
import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
|
|
11
13
|
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
12
14
|
import { applyCodeAction, ApplyCodeActionReason, getCodeActions } from 'vscode/vscode/vs/editor/contrib/codeAction/browser/codeAction';
|
|
13
15
|
import { CodeActionKind, CodeActionTriggerSource } from 'vscode/vscode/vs/editor/contrib/codeAction/common/types';
|
|
14
|
-
import { getDocumentFormattingEditsWithSelectedProvider } from 'vscode/vscode/vs/editor/contrib/format/browser/format';
|
|
16
|
+
import { getDocumentFormattingEditsWithSelectedProvider, FormattingMode } from 'vscode/vscode/vs/editor/contrib/format/browser/format';
|
|
15
17
|
import { SnippetController2 } from 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetController2';
|
|
16
18
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
17
19
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
@@ -20,10 +22,12 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
|
20
22
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
21
23
|
import { IWorkspaceTrustManagementService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
22
24
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
23
|
-
import {
|
|
25
|
+
import { SaveReason } from 'vscode/vscode/vs/workbench/common/editor';
|
|
26
|
+
import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
24
27
|
import { NotebookSetting, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
25
|
-
import { NotebookFileWorkingCopyModel } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModel';
|
|
28
|
+
import { NotebookFileWorkingCopyModel } from '@codingame/monaco-vscode-99f24462-c56d-5407-83fb-2ea9dd33cc8c-common/vscode/vs/workbench/contrib/notebook/common/notebookEditorModel';
|
|
26
29
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
30
|
+
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
27
31
|
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
28
32
|
import { NotebookMultiCursorController, NotebookMultiCursorState } from '../multicursor/notebookMulticursor.js';
|
|
29
33
|
|
|
@@ -53,34 +57,32 @@ let FormatOnSaveParticipant = class FormatOnSaveParticipant {
|
|
|
53
57
|
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
54
58
|
return;
|
|
55
59
|
}
|
|
56
|
-
if (context.reason ===
|
|
60
|
+
if (context.reason === SaveReason.AUTO) {
|
|
57
61
|
return undefined;
|
|
58
62
|
}
|
|
59
63
|
const enabled = this.configurationService.getValue(NotebookSetting.formatOnSave);
|
|
60
64
|
if (!enabled) {
|
|
61
65
|
return undefined;
|
|
62
66
|
}
|
|
63
|
-
progress.report({ message: ( localize(
|
|
67
|
+
progress.report({ message: ( localize(7394, "Formatting")) });
|
|
64
68
|
const notebook = workingCopy.model.notebookModel;
|
|
65
69
|
const formatApplied = await this.instantiationService.invokeFunction(CodeActionParticipantUtils.checkAndRunFormatCodeAction, notebook, progress, token);
|
|
66
|
-
const disposable = (
|
|
70
|
+
const disposable = ( new DisposableStore());
|
|
67
71
|
try {
|
|
68
72
|
if (!formatApplied) {
|
|
69
|
-
const allCellEdits = await Promise.all((
|
|
73
|
+
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
70
74
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
71
75
|
disposable.add(ref);
|
|
72
76
|
const model = ref.object.textEditorModel;
|
|
73
|
-
const formatEdits = await getDocumentFormattingEditsWithSelectedProvider(this.editorWorkerService, this.languageFeaturesService, model,
|
|
77
|
+
const formatEdits = await getDocumentFormattingEditsWithSelectedProvider(this.editorWorkerService, this.languageFeaturesService, model, FormattingMode.Silent, token);
|
|
74
78
|
const edits = [];
|
|
75
79
|
if (formatEdits) {
|
|
76
|
-
edits.push(...(
|
|
77
|
-
edit => ( (new ResourceTextEdit(model.uri, edit, model.getVersionId())))
|
|
78
|
-
))));
|
|
80
|
+
edits.push(...( formatEdits.map(edit => ( new ResourceTextEdit(model.uri, edit, model.getVersionId())))));
|
|
79
81
|
return edits;
|
|
80
82
|
}
|
|
81
83
|
return [];
|
|
82
|
-
})))
|
|
83
|
-
await this.bulkEditService.apply( allCellEdits.flat(), { label: ( localize(
|
|
84
|
+
})));
|
|
85
|
+
await this.bulkEditService.apply( allCellEdits.flat(), { label: ( localize(7395, "Format Notebook")), code: 'undoredo.formatNotebook', });
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
finally {
|
|
@@ -89,14 +91,14 @@ let FormatOnSaveParticipant = class FormatOnSaveParticipant {
|
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
|
-
FormatOnSaveParticipant = (
|
|
93
|
-
(
|
|
94
|
-
(
|
|
95
|
-
(
|
|
96
|
-
(
|
|
97
|
-
(
|
|
98
|
-
(
|
|
99
|
-
], FormatOnSaveParticipant))
|
|
94
|
+
FormatOnSaveParticipant = ( __decorate([
|
|
95
|
+
( __param(0, IEditorWorkerService)),
|
|
96
|
+
( __param(1, ILanguageFeaturesService)),
|
|
97
|
+
( __param(2, IInstantiationService)),
|
|
98
|
+
( __param(3, ITextModelService)),
|
|
99
|
+
( __param(4, IBulkEditService)),
|
|
100
|
+
( __param(5, IConfigurationService))
|
|
101
|
+
], FormatOnSaveParticipant));
|
|
100
102
|
let TrimWhitespaceParticipant = class TrimWhitespaceParticipant extends NotebookSaveParticipant {
|
|
101
103
|
constructor(configurationService, editorService, textModelService, bulkEditService) {
|
|
102
104
|
super(editorService);
|
|
@@ -109,35 +111,35 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant extends Notebook
|
|
|
109
111
|
const trimTrailingWhitespaceOption = this.configurationService.getValue('files.trimTrailingWhitespace');
|
|
110
112
|
const trimInRegexAndStrings = this.configurationService.getValue('files.trimTrailingWhitespaceInRegexAndStrings');
|
|
111
113
|
if (trimTrailingWhitespaceOption && this.canParticipate()) {
|
|
112
|
-
await this.doTrimTrailingWhitespace(workingCopy, context.reason ===
|
|
114
|
+
await this.doTrimTrailingWhitespace(workingCopy, context.reason === SaveReason.AUTO, trimInRegexAndStrings, progress);
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
async doTrimTrailingWhitespace(workingCopy, isAutoSaved, trimInRegexesAndStrings, progress) {
|
|
116
118
|
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
117
119
|
return;
|
|
118
120
|
}
|
|
119
|
-
const disposable = (
|
|
121
|
+
const disposable = ( new DisposableStore());
|
|
120
122
|
const notebook = workingCopy.model.notebookModel;
|
|
121
123
|
const activeCellEditor = getActiveCellCodeEditor(this.editorService);
|
|
122
124
|
let cursors = [];
|
|
123
125
|
let prevSelection = [];
|
|
124
126
|
try {
|
|
125
|
-
const allCellEdits = await Promise.all((
|
|
127
|
+
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
126
128
|
if (cell.cellKind !== CellKind.Code) {
|
|
127
129
|
return [];
|
|
128
130
|
}
|
|
129
131
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
130
132
|
disposable.add(ref);
|
|
131
133
|
const model = ref.object.textEditorModel;
|
|
132
|
-
const isActiveCell = (activeCellEditor && (
|
|
134
|
+
const isActiveCell = (activeCellEditor && ( cell.uri.toString()) === activeCellEditor.getModel()?.uri.toString());
|
|
133
135
|
if (isActiveCell) {
|
|
134
136
|
prevSelection = activeCellEditor.getSelections() ?? [];
|
|
135
137
|
if (isAutoSaved) {
|
|
136
|
-
cursors = (
|
|
138
|
+
cursors = ( prevSelection.map(s => s.getPosition()));
|
|
137
139
|
const snippetsRange = SnippetController2.get(activeCellEditor)?.getSessionEnclosingRange();
|
|
138
140
|
if (snippetsRange) {
|
|
139
141
|
for (let lineNumber = snippetsRange.startLineNumber; lineNumber <= snippetsRange.endLineNumber; lineNumber++) {
|
|
140
|
-
cursors.push((
|
|
142
|
+
cursors.push(( new Position(lineNumber, model.getLineMaxColumn(lineNumber))));
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
}
|
|
@@ -146,14 +148,10 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant extends Notebook
|
|
|
146
148
|
if (!ops.length) {
|
|
147
149
|
return [];
|
|
148
150
|
}
|
|
149
|
-
return (
|
|
150
|
-
|
|
151
|
-
op => ( (new ResourceTextEdit(model.uri, { ...op, text: op.text || '' }, model.getVersionId())))
|
|
152
|
-
))
|
|
153
|
-
);
|
|
154
|
-
}))));
|
|
151
|
+
return ( ops.map(op => ( new ResourceTextEdit(model.uri, { ...op, text: op.text || '' }, model.getVersionId()))));
|
|
152
|
+
})));
|
|
155
153
|
const filteredEdits = allCellEdits.flat().filter(edit => edit !== undefined);
|
|
156
|
-
await this.bulkEditService.apply(filteredEdits, { label: ( localize(
|
|
154
|
+
await this.bulkEditService.apply(filteredEdits, { label: ( localize(7396, "Notebook Trim Trailing Whitespace")), code: 'undoredo.notebookTrimTrailingWhitespace' });
|
|
157
155
|
}
|
|
158
156
|
finally {
|
|
159
157
|
progress.report({ increment: 100 });
|
|
@@ -161,12 +159,12 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant extends Notebook
|
|
|
161
159
|
}
|
|
162
160
|
}
|
|
163
161
|
};
|
|
164
|
-
TrimWhitespaceParticipant = (
|
|
165
|
-
(
|
|
166
|
-
(
|
|
167
|
-
(
|
|
168
|
-
(
|
|
169
|
-
], TrimWhitespaceParticipant))
|
|
162
|
+
TrimWhitespaceParticipant = ( __decorate([
|
|
163
|
+
( __param(0, IConfigurationService)),
|
|
164
|
+
( __param(1, IEditorService)),
|
|
165
|
+
( __param(2, ITextModelService)),
|
|
166
|
+
( __param(3, IBulkEditService))
|
|
167
|
+
], TrimWhitespaceParticipant));
|
|
170
168
|
let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant extends NotebookSaveParticipant {
|
|
171
169
|
constructor(configurationService, editorService, bulkEditService) {
|
|
172
170
|
super(editorService);
|
|
@@ -176,7 +174,7 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant extends No
|
|
|
176
174
|
}
|
|
177
175
|
async participate(workingCopy, context, progress, _token) {
|
|
178
176
|
if (this.configurationService.getValue('files.trimFinalNewlines') && this.canParticipate()) {
|
|
179
|
-
await this.doTrimFinalNewLines(workingCopy, context.reason ===
|
|
177
|
+
await this.doTrimFinalNewLines(workingCopy, context.reason === SaveReason.AUTO, progress);
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
180
|
findLastNonEmptyLine(textBuffer) {
|
|
@@ -192,16 +190,16 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant extends No
|
|
|
192
190
|
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
193
191
|
return;
|
|
194
192
|
}
|
|
195
|
-
const disposable = (
|
|
193
|
+
const disposable = ( new DisposableStore());
|
|
196
194
|
const notebook = workingCopy.model.notebookModel;
|
|
197
195
|
const activeCellEditor = getActiveCellCodeEditor(this.editorService);
|
|
198
196
|
try {
|
|
199
|
-
const allCellEdits = await Promise.all((
|
|
197
|
+
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
200
198
|
if (cell.cellKind !== CellKind.Code) {
|
|
201
199
|
return;
|
|
202
200
|
}
|
|
203
201
|
let cannotTouchLineNumber = 0;
|
|
204
|
-
const isActiveCell = (activeCellEditor && (
|
|
202
|
+
const isActiveCell = (activeCellEditor && ( cell.uri.toString()) === activeCellEditor.getModel()?.uri.toString());
|
|
205
203
|
if (isAutoSaved && isActiveCell) {
|
|
206
204
|
const selections = activeCellEditor.getSelections() ?? [];
|
|
207
205
|
for (const sel of selections) {
|
|
@@ -214,25 +212,23 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant extends No
|
|
|
214
212
|
if (deleteFromLineNumber > textBuffer.getLineCount()) {
|
|
215
213
|
return;
|
|
216
214
|
}
|
|
217
|
-
const deletionRange = (
|
|
215
|
+
const deletionRange = ( new Range(
|
|
218
216
|
deleteFromLineNumber,
|
|
219
217
|
1,
|
|
220
218
|
textBuffer.getLineCount(),
|
|
221
219
|
textBuffer.getLineLastNonWhitespaceColumn(textBuffer.getLineCount())
|
|
222
|
-
))
|
|
220
|
+
));
|
|
223
221
|
if (deletionRange.isEmpty()) {
|
|
224
222
|
return;
|
|
225
223
|
}
|
|
226
|
-
return (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
);
|
|
233
|
-
}))));
|
|
224
|
+
return ( new ResourceTextEdit(
|
|
225
|
+
cell.uri,
|
|
226
|
+
{ range: deletionRange, text: '' },
|
|
227
|
+
cell.textModel?.getVersionId()
|
|
228
|
+
));
|
|
229
|
+
})));
|
|
234
230
|
const filteredEdits = allCellEdits.flat().filter(edit => edit !== undefined);
|
|
235
|
-
await this.bulkEditService.apply(filteredEdits, { label: ( localize(
|
|
231
|
+
await this.bulkEditService.apply(filteredEdits, { label: ( localize(7397, "Trim Final New Lines")), code: 'undoredo.trimFinalNewLines' });
|
|
236
232
|
}
|
|
237
233
|
finally {
|
|
238
234
|
progress.report({ increment: 100 });
|
|
@@ -240,11 +236,11 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant extends No
|
|
|
240
236
|
}
|
|
241
237
|
}
|
|
242
238
|
};
|
|
243
|
-
TrimFinalNewLinesParticipant = (
|
|
244
|
-
(
|
|
245
|
-
(
|
|
246
|
-
(
|
|
247
|
-
], TrimFinalNewLinesParticipant))
|
|
239
|
+
TrimFinalNewLinesParticipant = ( __decorate([
|
|
240
|
+
( __param(0, IConfigurationService)),
|
|
241
|
+
( __param(1, IEditorService)),
|
|
242
|
+
( __param(2, IBulkEditService))
|
|
243
|
+
], TrimFinalNewLinesParticipant));
|
|
248
244
|
let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant extends NotebookSaveParticipant {
|
|
249
245
|
constructor(configurationService, bulkEditService, editorService) {
|
|
250
246
|
super(editorService);
|
|
@@ -254,14 +250,14 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant extends
|
|
|
254
250
|
}
|
|
255
251
|
async participate(workingCopy, context, progress, _token) {
|
|
256
252
|
if (this.configurationService.getValue(NotebookSetting.insertFinalNewline) && this.canParticipate()) {
|
|
257
|
-
await this.doInsertFinalNewLine(workingCopy, context.reason ===
|
|
253
|
+
await this.doInsertFinalNewLine(workingCopy, context.reason === SaveReason.AUTO, progress);
|
|
258
254
|
}
|
|
259
255
|
}
|
|
260
256
|
async doInsertFinalNewLine(workingCopy, isAutoSaved, progress) {
|
|
261
257
|
if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
|
|
262
258
|
return;
|
|
263
259
|
}
|
|
264
|
-
const disposable = (
|
|
260
|
+
const disposable = ( new DisposableStore());
|
|
265
261
|
const notebook = workingCopy.model.notebookModel;
|
|
266
262
|
const activeCellEditor = getActiveCellCodeEditor(this.editorService);
|
|
267
263
|
let selections;
|
|
@@ -269,7 +265,7 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant extends
|
|
|
269
265
|
selections = activeCellEditor.getSelections() ?? [];
|
|
270
266
|
}
|
|
271
267
|
try {
|
|
272
|
-
const allCellEdits = await Promise.all((
|
|
268
|
+
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
273
269
|
if (cell.cellKind !== CellKind.Code) {
|
|
274
270
|
return;
|
|
275
271
|
}
|
|
@@ -278,17 +274,15 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant extends
|
|
|
278
274
|
if (!lineCount || lastLineIsEmptyOrWhitespace) {
|
|
279
275
|
return;
|
|
280
276
|
}
|
|
281
|
-
return (
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
);
|
|
289
|
-
}))));
|
|
277
|
+
return ( new ResourceTextEdit(cell.uri, { range: ( new Range(
|
|
278
|
+
lineCount + 1,
|
|
279
|
+
cell.textBuffer.getLineLength(lineCount),
|
|
280
|
+
lineCount + 1,
|
|
281
|
+
cell.textBuffer.getLineLength(lineCount)
|
|
282
|
+
)), text: cell.textBuffer.getEOL() }, cell.textModel?.getVersionId()));
|
|
283
|
+
})));
|
|
290
284
|
const filteredEdits = allCellEdits.filter(edit => edit !== undefined);
|
|
291
|
-
await this.bulkEditService.apply(filteredEdits, { label: ( localize(
|
|
285
|
+
await this.bulkEditService.apply(filteredEdits, { label: ( localize(7398, "Insert Final New Line")), code: 'undoredo.insertFinalNewLine' });
|
|
292
286
|
if (activeCellEditor && selections) {
|
|
293
287
|
activeCellEditor.setSelections(selections);
|
|
294
288
|
}
|
|
@@ -299,11 +293,11 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant extends
|
|
|
299
293
|
}
|
|
300
294
|
}
|
|
301
295
|
};
|
|
302
|
-
InsertFinalNewLineParticipant = (
|
|
303
|
-
(
|
|
304
|
-
(
|
|
305
|
-
(
|
|
306
|
-
], InsertFinalNewLineParticipant))
|
|
296
|
+
InsertFinalNewLineParticipant = ( __decorate([
|
|
297
|
+
( __param(0, IConfigurationService)),
|
|
298
|
+
( __param(1, IBulkEditService)),
|
|
299
|
+
( __param(2, IEditorService))
|
|
300
|
+
], InsertFinalNewLineParticipant));
|
|
307
301
|
let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
308
302
|
constructor(configurationService, logService, workspaceTrustManagementService, textModelService, instantiationService) {
|
|
309
303
|
this.configurationService = configurationService;
|
|
@@ -321,10 +315,10 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
321
315
|
return;
|
|
322
316
|
}
|
|
323
317
|
let saveTrigger = '';
|
|
324
|
-
if (context.reason ===
|
|
318
|
+
if (context.reason === SaveReason.AUTO) {
|
|
325
319
|
return undefined;
|
|
326
320
|
}
|
|
327
|
-
else if (context.reason ===
|
|
321
|
+
else if (context.reason === SaveReason.EXPLICIT) {
|
|
328
322
|
saveTrigger = 'explicit';
|
|
329
323
|
}
|
|
330
324
|
else {
|
|
@@ -334,7 +328,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
334
328
|
const setting = this.configurationService.getValue(NotebookSetting.codeActionsOnSave);
|
|
335
329
|
const settingItems = Array.isArray(setting)
|
|
336
330
|
? setting
|
|
337
|
-
: (
|
|
331
|
+
: ( Object.keys(setting)).filter(x => setting[x]);
|
|
338
332
|
const allCodeActions = this.createCodeActionsOnSave(settingItems);
|
|
339
333
|
const excludedActions = allCodeActions
|
|
340
334
|
.filter(x => setting[x.value] === 'never' || setting[x.value] === false);
|
|
@@ -343,8 +337,8 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
343
337
|
const editorCodeActionsOnSave = includedActions.filter(x => !CodeActionKind.Notebook.contains(x));
|
|
344
338
|
const notebookCodeActionsOnSave = includedActions.filter(x => CodeActionKind.Notebook.contains(x));
|
|
345
339
|
if (notebookCodeActionsOnSave.length) {
|
|
346
|
-
const nbDisposable = (
|
|
347
|
-
progress.report({ message: ( localize(
|
|
340
|
+
const nbDisposable = ( new DisposableStore());
|
|
341
|
+
progress.report({ message: ( localize(7399, "Running 'Notebook' code actions")) });
|
|
348
342
|
try {
|
|
349
343
|
const cell = notebookModel.cells[0];
|
|
350
344
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
@@ -375,15 +369,15 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
375
369
|
return 0;
|
|
376
370
|
});
|
|
377
371
|
}
|
|
378
|
-
const cellDisposable = (
|
|
379
|
-
progress.report({ message: ( localize(
|
|
372
|
+
const cellDisposable = ( new DisposableStore());
|
|
373
|
+
progress.report({ message: ( localize(7400, "Running 'Cell' code actions")) });
|
|
380
374
|
try {
|
|
381
|
-
await Promise.all((
|
|
375
|
+
await Promise.all(( notebookModel.cells.map(async (cell) => {
|
|
382
376
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
383
377
|
cellDisposable.add(ref);
|
|
384
378
|
const textEditorModel = ref.object.textEditorModel;
|
|
385
379
|
await this.instantiationService.invokeFunction(CodeActionParticipantUtils.applyOnSaveGenericCodeActions, textEditorModel, editorCodeActionsOnSave, excludedActions, progress, token);
|
|
386
|
-
})))
|
|
380
|
+
})));
|
|
387
381
|
}
|
|
388
382
|
catch {
|
|
389
383
|
this.logService.error('Failed to apply code action on save');
|
|
@@ -395,35 +389,35 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
395
389
|
}
|
|
396
390
|
}
|
|
397
391
|
createCodeActionsOnSave(settingItems) {
|
|
398
|
-
const kinds = (
|
|
392
|
+
const kinds = ( settingItems.map(x => ( new HierarchicalKind(x))));
|
|
399
393
|
return kinds.filter(kind => {
|
|
400
394
|
return kinds.every(otherKind => otherKind.equals(kind) || !otherKind.contains(kind));
|
|
401
395
|
});
|
|
402
396
|
}
|
|
403
397
|
};
|
|
404
|
-
CodeActionOnSaveParticipant = (
|
|
405
|
-
(
|
|
406
|
-
(
|
|
407
|
-
(
|
|
408
|
-
(
|
|
409
|
-
(
|
|
410
|
-
], CodeActionOnSaveParticipant))
|
|
398
|
+
CodeActionOnSaveParticipant = ( __decorate([
|
|
399
|
+
( __param(0, IConfigurationService)),
|
|
400
|
+
( __param(1, ILogService)),
|
|
401
|
+
( __param(2, IWorkspaceTrustManagementService)),
|
|
402
|
+
( __param(3, ITextModelService)),
|
|
403
|
+
( __param(4, IInstantiationService))
|
|
404
|
+
], CodeActionOnSaveParticipant));
|
|
411
405
|
class CodeActionParticipantUtils {
|
|
412
406
|
static async checkAndRunFormatCodeAction(accessor, notebookModel, progress, token) {
|
|
413
407
|
const instantiationService = accessor.get(IInstantiationService);
|
|
414
408
|
const textModelService = accessor.get(ITextModelService);
|
|
415
409
|
const logService = accessor.get(ILogService);
|
|
416
410
|
const configurationService = accessor.get(IConfigurationService);
|
|
417
|
-
const formatDisposable = (
|
|
411
|
+
const formatDisposable = ( new DisposableStore());
|
|
418
412
|
let formatResult = false;
|
|
419
|
-
progress.report({ message: ( localize(
|
|
413
|
+
progress.report({ message: ( localize(7401, "Running 'Format' code actions")) });
|
|
420
414
|
try {
|
|
421
415
|
const cell = notebookModel.cells[0];
|
|
422
416
|
const ref = await textModelService.createModelReference(cell.uri);
|
|
423
417
|
formatDisposable.add(ref);
|
|
424
418
|
const textEditorModel = ref.object.textEditorModel;
|
|
425
419
|
const defaultFormatterExtId = configurationService.getValue(NotebookSetting.defaultFormatter);
|
|
426
|
-
formatResult = await instantiationService.invokeFunction(CodeActionParticipantUtils.applyOnSaveFormatCodeAction, textEditorModel, (
|
|
420
|
+
formatResult = await instantiationService.invokeFunction(CodeActionParticipantUtils.applyOnSaveFormatCodeAction, textEditorModel, ( new HierarchicalKind('notebook.format')), [], defaultFormatterExtId, progress, token);
|
|
427
421
|
}
|
|
428
422
|
catch {
|
|
429
423
|
logService.error('Failed to apply notebook format action on save');
|
|
@@ -440,20 +434,20 @@ class CodeActionParticipantUtils {
|
|
|
440
434
|
const logService = accessor.get(ILogService);
|
|
441
435
|
const getActionProgress = new (class {
|
|
442
436
|
constructor() {
|
|
443
|
-
this._names = (
|
|
437
|
+
this._names = ( new Set());
|
|
444
438
|
}
|
|
445
439
|
_report() {
|
|
446
440
|
progress.report({
|
|
447
441
|
message: ( localize(
|
|
448
|
-
|
|
442
|
+
7402,
|
|
449
443
|
"Getting code actions from '{0}' ([configure]({1})).",
|
|
450
|
-
(
|
|
444
|
+
( [...this._names].map(name => `'${name}'`)).join(', '),
|
|
451
445
|
'command:workbench.action.openSettings?%5B%22notebook.codeActionsOnSave%22%5D'
|
|
452
446
|
))
|
|
453
447
|
});
|
|
454
448
|
}
|
|
455
449
|
report(provider) {
|
|
456
|
-
if (provider.displayName && !(
|
|
450
|
+
if (provider.displayName && !( this._names.has(provider.displayName))) {
|
|
457
451
|
this._names.add(provider.displayName);
|
|
458
452
|
this._report();
|
|
459
453
|
}
|
|
@@ -485,7 +479,7 @@ class CodeActionParticipantUtils {
|
|
|
485
479
|
logService.warn('Failed to apply code action on save, applied to multiple resources.');
|
|
486
480
|
continue;
|
|
487
481
|
}
|
|
488
|
-
progress.report({ message: ( localize(
|
|
482
|
+
progress.report({ message: ( localize(7403, "Applying code action '{0}'.", action.action.title)) });
|
|
489
483
|
await instantiationService.invokeFunction(applyCodeAction, action, ApplyCodeActionReason.OnSave, {}, token);
|
|
490
484
|
if (token.isCancellationRequested) {
|
|
491
485
|
return;
|
|
@@ -505,20 +499,20 @@ class CodeActionParticipantUtils {
|
|
|
505
499
|
const logService = accessor.get(ILogService);
|
|
506
500
|
const getActionProgress = new (class {
|
|
507
501
|
constructor() {
|
|
508
|
-
this._names = (
|
|
502
|
+
this._names = ( new Set());
|
|
509
503
|
}
|
|
510
504
|
_report() {
|
|
511
505
|
progress.report({
|
|
512
506
|
message: ( localize(
|
|
513
|
-
|
|
507
|
+
7402,
|
|
514
508
|
"Getting code actions from '{0}' ([configure]({1})).",
|
|
515
|
-
(
|
|
509
|
+
( [...this._names].map(name => `'${name}'`)).join(', '),
|
|
516
510
|
'command:workbench.action.openSettings?%5B%22notebook.defaultFormatter%22%5D'
|
|
517
511
|
))
|
|
518
512
|
});
|
|
519
513
|
}
|
|
520
514
|
report(provider) {
|
|
521
|
-
if (provider.displayName && !(
|
|
515
|
+
if (provider.displayName && !( this._names.has(provider.displayName))) {
|
|
522
516
|
this._names.add(provider.displayName);
|
|
523
517
|
this._report();
|
|
524
518
|
}
|
|
@@ -537,7 +531,7 @@ class CodeActionParticipantUtils {
|
|
|
537
531
|
if (!action) {
|
|
538
532
|
return false;
|
|
539
533
|
}
|
|
540
|
-
progress.report({ message: ( localize(
|
|
534
|
+
progress.report({ message: ( localize(7403, "Applying code action '{0}'.", action.action.title)) });
|
|
541
535
|
await instantiationService.invokeFunction(applyCodeAction, action, ApplyCodeActionReason.OnSave, {}, token);
|
|
542
536
|
if (token.isCancellationRequested) {
|
|
543
537
|
return false;
|
|
@@ -554,7 +548,7 @@ class CodeActionParticipantUtils {
|
|
|
554
548
|
}
|
|
555
549
|
static getActionsToRun(model, codeActionKind, excludes, languageFeaturesService, progress, token) {
|
|
556
550
|
return getCodeActions(languageFeaturesService.codeActionProvider, model, model.getFullModelRange(), {
|
|
557
|
-
type:
|
|
551
|
+
type: CodeActionTriggerType.Invoke,
|
|
558
552
|
triggerAction: CodeActionTriggerSource.OnSave,
|
|
559
553
|
filter: { include: codeActionKind, excludes: excludes, includeSourceActions: true },
|
|
560
554
|
}, progress, token);
|
|
@@ -581,11 +575,11 @@ let SaveParticipantsContribution = class SaveParticipantsContribution extends Di
|
|
|
581
575
|
this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(TrimFinalNewLinesParticipant)));
|
|
582
576
|
}
|
|
583
577
|
};
|
|
584
|
-
SaveParticipantsContribution = (
|
|
585
|
-
(
|
|
586
|
-
(
|
|
587
|
-
], SaveParticipantsContribution))
|
|
588
|
-
const workbenchContributionsRegistry = (
|
|
589
|
-
workbenchContributionsRegistry.registerWorkbenchContribution(SaveParticipantsContribution,
|
|
578
|
+
SaveParticipantsContribution = ( __decorate([
|
|
579
|
+
( __param(0, IInstantiationService)),
|
|
580
|
+
( __param(1, IWorkingCopyFileService))
|
|
581
|
+
], SaveParticipantsContribution));
|
|
582
|
+
const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
|
|
583
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(SaveParticipantsContribution, LifecyclePhase.Restored);
|
|
590
584
|
|
|
591
|
-
export { CodeActionParticipantUtils, SaveParticipantsContribution };
|
|
585
|
+
export { CodeActionParticipantUtils, NotebookSaveParticipant, SaveParticipantsContribution };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { INotebookEditor, INotebookEditorContribution } from "@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
3
|
+
export declare class TroubleshootController extends Disposable implements INotebookEditorContribution {
|
|
4
|
+
private readonly _notebookEditor;
|
|
5
|
+
static id: string;
|
|
6
|
+
private readonly _localStore;
|
|
7
|
+
private _cellStateListeners;
|
|
8
|
+
private _enabled;
|
|
9
|
+
private _cellStatusItems;
|
|
10
|
+
constructor(_notebookEditor: INotebookEditor);
|
|
11
|
+
toggle(): void;
|
|
12
|
+
private _update;
|
|
13
|
+
private _log;
|
|
14
|
+
private _updateListener;
|
|
15
|
+
private _getItemsForCells;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
|
|
1
2
|
import { Disposable, DisposableStore, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
2
3
|
import { localize2 } from 'vscode/vscode/vs/nls';
|
|
3
4
|
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
4
5
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
|
-
import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
6
|
-
import { registerNotebookContribution } from '@codingame/monaco-vscode-
|
|
6
|
+
import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
7
|
+
import { registerNotebookContribution } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
8
|
+
import { CellStatusbarAlignment } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
7
9
|
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
8
10
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
9
11
|
|
|
@@ -12,7 +14,7 @@ class TroubleshootController extends Disposable {
|
|
|
12
14
|
constructor(_notebookEditor) {
|
|
13
15
|
super();
|
|
14
16
|
this._notebookEditor = _notebookEditor;
|
|
15
|
-
this._localStore = this._register((
|
|
17
|
+
this._localStore = this._register(( new DisposableStore()));
|
|
16
18
|
this._cellStateListeners = [];
|
|
17
19
|
this._enabled = false;
|
|
18
20
|
this._cellStatusItems = [];
|
|
@@ -52,11 +54,11 @@ class TroubleshootController extends Disposable {
|
|
|
52
54
|
this._localStore.add(this._notebookEditor.onDidChangeViewCells(e => {
|
|
53
55
|
[...e.splices].reverse().forEach(splice => {
|
|
54
56
|
const [start, deleted, newCells] = splice;
|
|
55
|
-
const deletedCells = this._cellStateListeners.splice(start, deleted, ...(
|
|
57
|
+
const deletedCells = this._cellStateListeners.splice(start, deleted, ...( newCells.map(cell => {
|
|
56
58
|
return cell.onDidChangeLayout((e) => {
|
|
57
59
|
this._log(cell, e);
|
|
58
60
|
});
|
|
59
|
-
})))
|
|
61
|
+
})));
|
|
60
62
|
dispose(deletedCells);
|
|
61
63
|
});
|
|
62
64
|
}));
|
|
@@ -75,7 +77,7 @@ class TroubleshootController extends Disposable {
|
|
|
75
77
|
items: [
|
|
76
78
|
{
|
|
77
79
|
text: `index: ${i}`,
|
|
78
|
-
alignment:
|
|
80
|
+
alignment: CellStatusbarAlignment.Left,
|
|
79
81
|
priority: Number.MAX_SAFE_INTEGER
|
|
80
82
|
}
|
|
81
83
|
]
|
|
@@ -93,7 +95,7 @@ registerAction2(class extends Action2 {
|
|
|
93
95
|
constructor() {
|
|
94
96
|
super({
|
|
95
97
|
id: 'notebook.toggleLayoutTroubleshoot',
|
|
96
|
-
title: ( localize2(
|
|
98
|
+
title: ( localize2(7404, "Toggle Layout Troubleshoot")),
|
|
97
99
|
category: Categories.Developer,
|
|
98
100
|
f1: true
|
|
99
101
|
});
|
|
@@ -112,7 +114,7 @@ registerAction2(class extends Action2 {
|
|
|
112
114
|
constructor() {
|
|
113
115
|
super({
|
|
114
116
|
id: 'notebook.inspectLayout',
|
|
115
|
-
title: ( localize2(
|
|
117
|
+
title: ( localize2(7405, "Inspect Notebook Layout")),
|
|
116
118
|
category: Categories.Developer,
|
|
117
119
|
f1: true
|
|
118
120
|
});
|
|
@@ -133,7 +135,7 @@ registerAction2(class extends Action2 {
|
|
|
133
135
|
constructor() {
|
|
134
136
|
super({
|
|
135
137
|
id: 'notebook.clearNotebookEdtitorTypeCache',
|
|
136
|
-
title: ( localize2(
|
|
138
|
+
title: ( localize2(7406, "Clear Notebook Editor Type Cache")),
|
|
137
139
|
category: Categories.Developer,
|
|
138
140
|
f1: true
|
|
139
141
|
});
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
4
|
+
import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
4
5
|
import { CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
5
6
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
6
|
-
import { getNotebookEditorFromEditorPane, CellEditState } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
7
|
+
import { getNotebookEditorFromEditorPane, CellEditState } from '@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
7
8
|
import { UndoCommand, RedoCommand } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
8
9
|
|
|
9
10
|
let NotebookUndoRedoContribution = class NotebookUndoRedoContribution extends Disposable {
|
|
@@ -53,4 +54,4 @@ let NotebookUndoRedoContribution = class NotebookUndoRedoContribution extends Di
|
|
|
53
54
|
NotebookUndoRedoContribution = ( __decorate([
|
|
54
55
|
( __param(0, IEditorService))
|
|
55
56
|
], NotebookUndoRedoContribution));
|
|
56
|
-
registerWorkbenchContribution2(NotebookUndoRedoContribution.ID, NotebookUndoRedoContribution,
|
|
57
|
+
registerWorkbenchContribution2(NotebookUndoRedoContribution.ID, NotebookUndoRedoContribution, WorkbenchPhase.BlockRestore);
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|