@codingame/monaco-vscode-notebook-service-override 1.85.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.
Files changed (84) hide show
  1. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  2. package/external/tslib/tslib.es6.js +11 -0
  3. package/index.d.ts +1 -0
  4. package/index.js +1 -0
  5. package/notebook.d.ts +5 -0
  6. package/notebook.js +44 -0
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +32 -0
  9. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  10. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +387 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +668 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +319 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +485 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +238 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +317 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +87 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +93 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +383 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +51 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +46 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +135 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +383 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +117 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +511 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +168 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +57 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +702 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +268 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +45 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +108 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +872 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +393 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +175 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1121 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +339 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +41 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +182 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +509 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +133 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +342 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +666 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +80 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1001 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +202 -0
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  75. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  76. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +217 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  78. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +372 -0
  79. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +706 -0
  80. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +407 -0
  81. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  82. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
  83. package/worker.js +1 -0
  84. package/workers/notebook.worker.js +9 -0
@@ -0,0 +1,165 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
+ import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
4
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
5
+ import { debugIconBreakpointForeground } from 'vscode/vscode/vs/workbench/contrib/debug/browser/breakpointEditorContribution';
6
+ import { topStackFrameColor, focusedStackFrameColor } from 'vscode/vscode/vs/workbench/contrib/debug/browser/callStackEditorContribution';
7
+ import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
8
+ import { NotebookOverviewRulerLane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
9
+ import { registerNotebookContribution } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
10
+ import { runningCellRulerDecorationColor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorWidget';
11
+ import { NotebookCellExecutionState, CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
12
+ import { NotebookExecutionType, INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
13
+
14
+ let PausedCellDecorationContribution = class PausedCellDecorationContribution extends Disposable {
15
+ static { this.id = 'workbench.notebook.debug.pausedCellDecorations'; }
16
+ constructor(_notebookEditor, _debugService, _notebookExecutionStateService) {
17
+ super();
18
+ this._notebookEditor = _notebookEditor;
19
+ this._debugService = _debugService;
20
+ this._notebookExecutionStateService = _notebookExecutionStateService;
21
+ this._currentTopDecorations = [];
22
+ this._currentOtherDecorations = [];
23
+ this._executingCellDecorations = [];
24
+ this._register(_debugService.getModel().onDidChangeCallStack(() => this.updateExecutionDecorations()));
25
+ this._register(_debugService.getViewModel().onDidFocusStackFrame(() => this.updateExecutionDecorations()));
26
+ this._register(_notebookExecutionStateService.onDidChangeExecution(e => {
27
+ if (e.type === NotebookExecutionType.cell && this._notebookEditor.textModel && e.affectsNotebook(this._notebookEditor.textModel.uri)) {
28
+ this.updateExecutionDecorations();
29
+ }
30
+ }));
31
+ }
32
+ updateExecutionDecorations() {
33
+ const exes = this._notebookEditor.textModel ?
34
+ this._notebookExecutionStateService.getCellExecutionsByHandleForNotebook(this._notebookEditor.textModel.uri)
35
+ : undefined;
36
+ const topFrameCellsAndRanges = [];
37
+ let focusedFrameCellAndRange = undefined;
38
+ const getNotebookCellAndRange = (sf) => {
39
+ const parsed = CellUri.parse(sf.source.uri);
40
+ if (parsed && ( parsed.notebook.toString()) === this._notebookEditor.textModel?.uri.toString()) {
41
+ return { handle: parsed.handle, range: sf.range };
42
+ }
43
+ return undefined;
44
+ };
45
+ for (const session of this._debugService.getModel().getSessions()) {
46
+ for (const thread of session.getAllThreads()) {
47
+ const topFrame = thread.getTopStackFrame();
48
+ if (topFrame) {
49
+ const notebookCellAndRange = getNotebookCellAndRange(topFrame);
50
+ if (notebookCellAndRange) {
51
+ topFrameCellsAndRanges.push(notebookCellAndRange);
52
+ exes?.delete(notebookCellAndRange.handle);
53
+ }
54
+ }
55
+ }
56
+ }
57
+ const focusedFrame = this._debugService.getViewModel().focusedStackFrame;
58
+ if (focusedFrame && focusedFrame.thread.stopped) {
59
+ const thisFocusedFrameCellAndRange = getNotebookCellAndRange(focusedFrame);
60
+ if (thisFocusedFrameCellAndRange &&
61
+ !( topFrameCellsAndRanges.some(
62
+ topFrame => topFrame.handle === thisFocusedFrameCellAndRange?.handle && Range.equalsRange(topFrame.range, thisFocusedFrameCellAndRange?.range)
63
+ ))) {
64
+ focusedFrameCellAndRange = thisFocusedFrameCellAndRange;
65
+ exes?.delete(focusedFrameCellAndRange.handle);
66
+ }
67
+ }
68
+ this.setTopFrameDecoration(topFrameCellsAndRanges);
69
+ this.setFocusedFrameDecoration(focusedFrameCellAndRange);
70
+ const exeHandles = exes ?
71
+ ( Array.from(exes.entries())
72
+ .filter(([_, exe]) => exe.state === NotebookCellExecutionState.Executing)
73
+ .map(([handle]) => handle))
74
+ : [];
75
+ this.setExecutingCellDecorations(exeHandles);
76
+ }
77
+ setTopFrameDecoration(handlesAndRanges) {
78
+ const newDecorations = ( handlesAndRanges.map(({ handle, range }) => {
79
+ const options = {
80
+ overviewRuler: {
81
+ color: topStackFrameColor,
82
+ includeOutput: false,
83
+ modelRanges: [range],
84
+ position: NotebookOverviewRulerLane.Full
85
+ }
86
+ };
87
+ return { handle, options };
88
+ }));
89
+ this._currentTopDecorations = this._notebookEditor.deltaCellDecorations(this._currentTopDecorations, newDecorations);
90
+ }
91
+ setFocusedFrameDecoration(focusedFrameCellAndRange) {
92
+ let newDecorations = [];
93
+ if (focusedFrameCellAndRange) {
94
+ const options = {
95
+ overviewRuler: {
96
+ color: focusedStackFrameColor,
97
+ includeOutput: false,
98
+ modelRanges: [focusedFrameCellAndRange.range],
99
+ position: NotebookOverviewRulerLane.Full
100
+ }
101
+ };
102
+ newDecorations = [{ handle: focusedFrameCellAndRange.handle, options }];
103
+ }
104
+ this._currentOtherDecorations = this._notebookEditor.deltaCellDecorations(this._currentOtherDecorations, newDecorations);
105
+ }
106
+ setExecutingCellDecorations(handles) {
107
+ const newDecorations = ( handles.map(handle => {
108
+ const options = {
109
+ overviewRuler: {
110
+ color: runningCellRulerDecorationColor,
111
+ includeOutput: false,
112
+ modelRanges: [( new Range(0, 0, 0, 0))],
113
+ position: NotebookOverviewRulerLane.Left
114
+ }
115
+ };
116
+ return { handle, options };
117
+ }));
118
+ this._executingCellDecorations = this._notebookEditor.deltaCellDecorations(this._executingCellDecorations, newDecorations);
119
+ }
120
+ };
121
+ PausedCellDecorationContribution = ( __decorate([
122
+ ( __param(1, IDebugService)),
123
+ ( __param(2, INotebookExecutionStateService))
124
+ ], PausedCellDecorationContribution));
125
+ registerNotebookContribution(PausedCellDecorationContribution.id, PausedCellDecorationContribution);
126
+ let NotebookBreakpointDecorations = class NotebookBreakpointDecorations extends Disposable {
127
+ static { this.id = 'workbench.notebook.debug.notebookBreakpointDecorations'; }
128
+ constructor(_notebookEditor, _debugService, _configService) {
129
+ super();
130
+ this._notebookEditor = _notebookEditor;
131
+ this._debugService = _debugService;
132
+ this._configService = _configService;
133
+ this._currentDecorations = [];
134
+ this._register(_debugService.getModel().onDidChangeBreakpoints(() => this.updateDecorations()));
135
+ this._register(_configService.onDidChangeConfiguration(e => e.affectsConfiguration('debug.showBreakpointsInOverviewRuler') && this.updateDecorations()));
136
+ }
137
+ updateDecorations() {
138
+ const enabled = this._configService.getValue('debug.showBreakpointsInOverviewRuler');
139
+ const newDecorations = enabled ?
140
+ ( this._debugService.getModel().getBreakpoints().map(breakpoint => {
141
+ const parsed = CellUri.parse(breakpoint.uri);
142
+ if (!parsed || ( parsed.notebook.toString()) !== ( this._notebookEditor.textModel.uri.toString())) {
143
+ return null;
144
+ }
145
+ const options = {
146
+ overviewRuler: {
147
+ color: debugIconBreakpointForeground,
148
+ includeOutput: false,
149
+ modelRanges: [( new Range(breakpoint.lineNumber, 0, breakpoint.lineNumber, 0))],
150
+ position: NotebookOverviewRulerLane.Left
151
+ }
152
+ };
153
+ return { handle: parsed.handle, options };
154
+ })).filter(x => !!x)
155
+ : [];
156
+ this._currentDecorations = this._notebookEditor.deltaCellDecorations(this._currentDecorations, newDecorations);
157
+ }
158
+ };
159
+ NotebookBreakpointDecorations = ( __decorate([
160
+ ( __param(1, IDebugService)),
161
+ ( __param(2, IConfigurationService))
162
+ ], NotebookBreakpointDecorations));
163
+ registerNotebookContribution(NotebookBreakpointDecorations.id, NotebookBreakpointDecorations);
164
+
165
+ export { NotebookBreakpointDecorations, PausedCellDecorationContribution };
@@ -0,0 +1,67 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
3
+ import { registerEditorContribution } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
4
+ import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
5
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
6
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
7
+ import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
8
+ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
9
+ import { EmptyTextEditorHintContribution } from '../../../../codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js';
10
+ import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSession';
11
+ import { IInlineChatService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
12
+ import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
13
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
14
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
15
+
16
+ let EmptyCellEditorHintContribution = class EmptyCellEditorHintContribution extends EmptyTextEditorHintContribution {
17
+ static { this.CONTRIB_ID = 'notebook.editor.contrib.emptyCellEditorHint'; }
18
+ constructor(editor, _editorService, editorGroupsService, commandService, configurationService, keybindingService, inlineChatSessionService, inlineChatService, telemetryService, productService) {
19
+ super(editor, editorGroupsService, commandService, configurationService, keybindingService, inlineChatSessionService, inlineChatService, telemetryService, productService);
20
+ this._editorService = _editorService;
21
+ const activeEditor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
22
+ if (!activeEditor) {
23
+ return;
24
+ }
25
+ this.toDispose.push(activeEditor.onDidChangeActiveCell(() => this.update()));
26
+ }
27
+ _getOptions() {
28
+ return { clickable: false };
29
+ }
30
+ _shouldRenderHint() {
31
+ const shouldRenderHint = super._shouldRenderHint();
32
+ if (!shouldRenderHint) {
33
+ return false;
34
+ }
35
+ const model = this.editor.getModel();
36
+ if (!model) {
37
+ return false;
38
+ }
39
+ const isNotebookCell = model?.uri.scheme === Schemas.vscodeNotebookCell;
40
+ if (!isNotebookCell) {
41
+ return false;
42
+ }
43
+ const activeEditor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
44
+ if (!activeEditor) {
45
+ return false;
46
+ }
47
+ const activeCell = activeEditor.getActiveCell();
48
+ if (activeCell?.uri.fragment !== model.uri.fragment) {
49
+ return false;
50
+ }
51
+ return true;
52
+ }
53
+ };
54
+ EmptyCellEditorHintContribution = ( __decorate([
55
+ ( __param(1, IEditorService)),
56
+ ( __param(2, IEditorGroupsService)),
57
+ ( __param(3, ICommandService)),
58
+ ( __param(4, IConfigurationService)),
59
+ ( __param(5, IKeybindingService)),
60
+ ( __param(6, IInlineChatSessionService)),
61
+ ( __param(7, IInlineChatService)),
62
+ ( __param(8, ITelemetryService)),
63
+ ( __param(9, IProductService))
64
+ ], EmptyCellEditorHintContribution));
65
+ registerEditorContribution(EmptyCellEditorHintContribution.CONTRIB_ID, EmptyCellEditorHintContribution, 0 );
66
+
67
+ export { EmptyCellEditorHintContribution };
@@ -0,0 +1,238 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable, DisposableStore, MutableDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
4
+ import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
5
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
6
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
7
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
8
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
9
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
10
+ import { CENTER_ACTIVE_CELL } from '../navigation/arrow.js';
11
+ import { SELECT_KERNEL_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
12
+ import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
13
+ import { NotebookCellsChangeType } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
14
+ import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
15
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
16
+ import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
17
+
18
+ let ImplictKernelSelector = class ImplictKernelSelector {
19
+ constructor(notebook, suggested, notebookKernelService, languageFeaturesService, logService) {
20
+ const disposables = ( new DisposableStore());
21
+ this.dispose = disposables.dispose.bind(disposables);
22
+ const selectKernel = () => {
23
+ disposables.clear();
24
+ notebookKernelService.selectKernelForNotebook(suggested, notebook);
25
+ };
26
+ disposables.add(notebook.onDidChangeContent(e => {
27
+ for (const event of e.rawEvents) {
28
+ switch (event.kind) {
29
+ case NotebookCellsChangeType.ChangeCellContent:
30
+ case NotebookCellsChangeType.ModelChange:
31
+ case NotebookCellsChangeType.Move:
32
+ case NotebookCellsChangeType.ChangeCellLanguage:
33
+ logService.trace('IMPLICIT kernel selection because of change event', event.kind);
34
+ selectKernel();
35
+ break;
36
+ }
37
+ }
38
+ }));
39
+ disposables.add(languageFeaturesService.hoverProvider.register({ scheme: Schemas.vscodeNotebookCell, pattern: notebook.uri.path }, {
40
+ provideHover() {
41
+ logService.trace('IMPLICIT kernel selection because of hover');
42
+ selectKernel();
43
+ return undefined;
44
+ }
45
+ }));
46
+ }
47
+ };
48
+ ImplictKernelSelector = ( __decorate([
49
+ ( __param(2, INotebookKernelService)),
50
+ ( __param(3, ILanguageFeaturesService)),
51
+ ( __param(4, ILogService))
52
+ ], ImplictKernelSelector));
53
+ let KernelStatus = class KernelStatus extends Disposable {
54
+ constructor(_editorService, _statusbarService, _notebookKernelService, _instantiationService) {
55
+ super();
56
+ this._editorService = _editorService;
57
+ this._statusbarService = _statusbarService;
58
+ this._notebookKernelService = _notebookKernelService;
59
+ this._instantiationService = _instantiationService;
60
+ this._editorDisposables = this._register(( new DisposableStore()));
61
+ this._kernelInfoElement = this._register(( new DisposableStore()));
62
+ this._register(this._editorService.onDidActiveEditorChange(() => this._updateStatusbar()));
63
+ }
64
+ _updateStatusbar() {
65
+ this._editorDisposables.clear();
66
+ const activeEditor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
67
+ if (!activeEditor) {
68
+ this._kernelInfoElement.clear();
69
+ return;
70
+ }
71
+ const updateStatus = () => {
72
+ if (activeEditor.notebookOptions.getDisplayOptions().globalToolbar) {
73
+ this._kernelInfoElement.clear();
74
+ return;
75
+ }
76
+ const notebook = activeEditor.textModel;
77
+ if (notebook) {
78
+ this._showKernelStatus(notebook);
79
+ }
80
+ else {
81
+ this._kernelInfoElement.clear();
82
+ }
83
+ };
84
+ this._editorDisposables.add(this._notebookKernelService.onDidAddKernel(updateStatus));
85
+ this._editorDisposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(updateStatus));
86
+ this._editorDisposables.add(this._notebookKernelService.onDidChangeNotebookAffinity(updateStatus));
87
+ this._editorDisposables.add(activeEditor.onDidChangeModel(updateStatus));
88
+ this._editorDisposables.add(activeEditor.notebookOptions.onDidChangeOptions(updateStatus));
89
+ updateStatus();
90
+ }
91
+ _showKernelStatus(notebook) {
92
+ this._kernelInfoElement.clear();
93
+ const { selected, suggestions, all } = this._notebookKernelService.getMatchingKernel(notebook);
94
+ const suggested = (suggestions.length === 1 ? suggestions[0] : undefined)
95
+ ?? (all.length === 1) ? all[0] : undefined;
96
+ let isSuggested = false;
97
+ if (all.length === 0) {
98
+ return;
99
+ }
100
+ else if (selected || suggested) {
101
+ let kernel = selected;
102
+ if (!kernel) {
103
+ kernel = suggested;
104
+ isSuggested = true;
105
+ this._kernelInfoElement.add(this._instantiationService.createInstance(ImplictKernelSelector, notebook, kernel));
106
+ }
107
+ const tooltip = kernel.description ?? kernel.detail ?? kernel.label;
108
+ this._kernelInfoElement.add(this._statusbarService.addEntry({
109
+ name: ( nls.localizeWithPath(
110
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
111
+ 'notebook.info',
112
+ "Notebook Kernel Info"
113
+ )),
114
+ text: `$(notebook-kernel-select) ${kernel.label}`,
115
+ ariaLabel: kernel.label,
116
+ tooltip: isSuggested ? ( nls.localizeWithPath(
117
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
118
+ 'tooltop',
119
+ "{0} (suggestion)",
120
+ tooltip
121
+ )) : tooltip,
122
+ command: SELECT_KERNEL_ID,
123
+ }, SELECT_KERNEL_ID, 1 , 10));
124
+ this._kernelInfoElement.add(kernel.onDidChange(() => this._showKernelStatus(notebook)));
125
+ }
126
+ else {
127
+ this._kernelInfoElement.add(this._statusbarService.addEntry({
128
+ name: ( nls.localizeWithPath(
129
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
130
+ 'notebook.select',
131
+ "Notebook Kernel Selection"
132
+ )),
133
+ text: ( nls.localizeWithPath(
134
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
135
+ 'kernel.select.label',
136
+ "Select Kernel"
137
+ )),
138
+ ariaLabel: ( nls.localizeWithPath(
139
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
140
+ 'kernel.select.label',
141
+ "Select Kernel"
142
+ )),
143
+ command: SELECT_KERNEL_ID,
144
+ kind: 'prominent'
145
+ }, SELECT_KERNEL_ID, 1 , 10));
146
+ }
147
+ }
148
+ };
149
+ KernelStatus = ( __decorate([
150
+ ( __param(0, IEditorService)),
151
+ ( __param(1, IStatusbarService)),
152
+ ( __param(2, INotebookKernelService)),
153
+ ( __param(3, IInstantiationService))
154
+ ], KernelStatus));
155
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(KernelStatus, 3 );
156
+ let ActiveCellStatus = class ActiveCellStatus extends Disposable {
157
+ constructor(_editorService, _statusbarService) {
158
+ super();
159
+ this._editorService = _editorService;
160
+ this._statusbarService = _statusbarService;
161
+ this._itemDisposables = this._register(( new DisposableStore()));
162
+ this._accessor = this._register(( new MutableDisposable()));
163
+ this._register(this._editorService.onDidActiveEditorChange(() => this._update()));
164
+ }
165
+ _update() {
166
+ this._itemDisposables.clear();
167
+ const activeEditor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
168
+ if (activeEditor) {
169
+ this._itemDisposables.add(activeEditor.onDidChangeSelection(() => this._show(activeEditor)));
170
+ this._itemDisposables.add(activeEditor.onDidChangeActiveCell(() => this._show(activeEditor)));
171
+ this._show(activeEditor);
172
+ }
173
+ else {
174
+ this._accessor.clear();
175
+ }
176
+ }
177
+ _show(editor) {
178
+ if (!editor.hasModel()) {
179
+ this._accessor.clear();
180
+ return;
181
+ }
182
+ const newText = this._getSelectionsText(editor);
183
+ if (!newText) {
184
+ this._accessor.clear();
185
+ return;
186
+ }
187
+ const entry = {
188
+ name: ( nls.localizeWithPath(
189
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
190
+ 'notebook.activeCellStatusName',
191
+ "Notebook Editor Selections"
192
+ )),
193
+ text: newText,
194
+ ariaLabel: newText,
195
+ command: CENTER_ACTIVE_CELL
196
+ };
197
+ if (!this._accessor.value) {
198
+ this._accessor.value = this._statusbarService.addEntry(entry, 'notebook.activeCellStatus', 1 , 100);
199
+ }
200
+ else {
201
+ this._accessor.value.update(entry);
202
+ }
203
+ }
204
+ _getSelectionsText(editor) {
205
+ if (!editor.hasModel()) {
206
+ return undefined;
207
+ }
208
+ const activeCell = editor.getActiveCell();
209
+ if (!activeCell) {
210
+ return undefined;
211
+ }
212
+ const idxFocused = editor.getCellIndex(activeCell) + 1;
213
+ const numSelected = editor.getSelections().reduce((prev, range) => prev + (range.end - range.start), 0);
214
+ const totalCells = editor.getLength();
215
+ return numSelected > 1 ?
216
+ ( nls.localizeWithPath(
217
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
218
+ 'notebook.multiActiveCellIndicator',
219
+ "Cell {0} ({1} selected)",
220
+ idxFocused,
221
+ numSelected
222
+ )) :
223
+ ( nls.localizeWithPath(
224
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
225
+ 'notebook.singleActiveCellIndicator',
226
+ "Cell {0} of {1}",
227
+ idxFocused,
228
+ totalCells
229
+ ));
230
+ }
231
+ };
232
+ ActiveCellStatus = ( __decorate([
233
+ ( __param(0, IEditorService)),
234
+ ( __param(1, IStatusbarService))
235
+ ], ActiveCellStatus));
236
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ActiveCellStatus, 3 );
237
+
238
+ export { ActiveCellStatus, KernelStatus };
@@ -0,0 +1,72 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { throttle } from 'monaco-editor/esm/vs/base/common/decorators.js';
3
+ import { Disposable, MutableDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
+ import { registerNotebookContribution } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
5
+ import { NotebookCellExecutionState } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
6
+ import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
7
+ import { IUserActivityService } from 'vscode/vscode/vs/workbench/services/userActivity/common/userActivityService';
8
+
9
+ let ExecutionEditorProgressController = class ExecutionEditorProgressController extends Disposable {
10
+ static { this.id = 'workbench.notebook.executionEditorProgress'; }
11
+ constructor(_notebookEditor, _notebookExecutionStateService, _userActivity) {
12
+ super();
13
+ this._notebookEditor = _notebookEditor;
14
+ this._notebookExecutionStateService = _notebookExecutionStateService;
15
+ this._userActivity = _userActivity;
16
+ this._activityMutex = this._register(( new MutableDisposable()));
17
+ this._register(_notebookEditor.onDidScroll(() => this._update()));
18
+ this._register(_notebookExecutionStateService.onDidChangeExecution(e => {
19
+ if (( e.notebook.toString()) !== this._notebookEditor.textModel?.uri.toString()) {
20
+ return;
21
+ }
22
+ this._update();
23
+ }));
24
+ this._register(_notebookEditor.onDidChangeModel(() => this._update()));
25
+ }
26
+ _update() {
27
+ if (!this._notebookEditor.hasModel()) {
28
+ return;
29
+ }
30
+ const cellExecutions = this._notebookExecutionStateService.getCellExecutionsForNotebook(this._notebookEditor.textModel?.uri)
31
+ .filter(exe => exe.state === NotebookCellExecutionState.Executing);
32
+ const notebookExecution = this._notebookExecutionStateService.getExecution(this._notebookEditor.textModel?.uri);
33
+ const executionIsVisible = (exe) => {
34
+ for (const range of this._notebookEditor.visibleRanges) {
35
+ for (const cell of this._notebookEditor.getCellsInRange(range)) {
36
+ if (cell.handle === exe.cellHandle) {
37
+ const top = this._notebookEditor.getAbsoluteTopOfElement(cell);
38
+ if (this._notebookEditor.scrollTop < top + 5) {
39
+ return true;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ return false;
45
+ };
46
+ const hasAnyExecution = cellExecutions.length || notebookExecution;
47
+ if (hasAnyExecution && !this._activityMutex.value) {
48
+ this._activityMutex.value = this._userActivity.markActive();
49
+ }
50
+ else if (!hasAnyExecution && this._activityMutex.value) {
51
+ this._activityMutex.clear();
52
+ }
53
+ const shouldShowEditorProgressbarForCellExecutions = cellExecutions.length && !( cellExecutions.some(executionIsVisible)) && !( cellExecutions.some(e => e.isPaused));
54
+ const showEditorProgressBar = !!notebookExecution || shouldShowEditorProgressbarForCellExecutions;
55
+ if (showEditorProgressBar) {
56
+ this._notebookEditor.showProgress();
57
+ }
58
+ else {
59
+ this._notebookEditor.hideProgress();
60
+ }
61
+ }
62
+ };
63
+ ExecutionEditorProgressController.__decorator = ( __decorate([
64
+ throttle(100)
65
+ ], ExecutionEditorProgressController.prototype, "_update", null));
66
+ ExecutionEditorProgressController = ( __decorate([
67
+ ( __param(1, INotebookExecutionStateService)),
68
+ ( __param(2, IUserActivityService))
69
+ ], ExecutionEditorProgressController));
70
+ registerNotebookContribution(ExecutionEditorProgressController.id, ExecutionEditorProgressController);
71
+
72
+ export { ExecutionEditorProgressController };
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".monaco-workbench .notebookOverlay.notebook-editor.find-hide-transition,.monaco-workbench .notebookOverlay.notebook-editor.find-show-transition{overflow-y:hidden}.monaco-workbench .notebookOverlay.notebook-editor .simple-fr-find-part-wrapper .matchesCount{box-sizing:border-box;overflow:hidden;padding:0 2px;text-align:center;text-overflow:ellipsis;white-space:nowrap}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };