@codingame/monaco-vscode-notebook-service-override 4.1.0 → 4.1.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.
Files changed (77) 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/notebook.js +12 -12
  4. package/override/vs/platform/dialogs/common/dialogs.js +10 -0
  5. package/package.json +2 -2
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +391 -0
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +544 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +320 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +84 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +101 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +393 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +5 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +97 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +120 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +60 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +150 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +656 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +77 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +517 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +159 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +56 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +652 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +721 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +315 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +47 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +115 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +911 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +395 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +185 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1187 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +451 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +192 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +510 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +130 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +341 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +641 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +90 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1002 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +203 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +386 -0
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +408 -0
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
@@ -0,0 +1,67 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
3
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
5
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
6
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
7
+ import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
8
+ import { CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
9
+ import { CellExecutionUpdateType } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionService';
10
+ import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
11
+
12
+ let NotebookCellPausing = class NotebookCellPausing extends Disposable {
13
+ constructor(_debugService, _notebookExecutionStateService) {
14
+ super();
15
+ this._debugService = _debugService;
16
+ this._notebookExecutionStateService = _notebookExecutionStateService;
17
+ this._pausedCells = ( new Set());
18
+ this._register(_debugService.getModel().onDidChangeCallStack(() => {
19
+ this.onDidChangeCallStack(true);
20
+ this._scheduler.schedule();
21
+ }));
22
+ this._scheduler = this._register(( new RunOnceScheduler(() => this.onDidChangeCallStack(false), 2000)));
23
+ }
24
+ async onDidChangeCallStack(fallBackOnStaleCallstack) {
25
+ const newPausedCells = ( new Set());
26
+ for (const session of this._debugService.getModel().getSessions()) {
27
+ for (const thread of session.getAllThreads()) {
28
+ let callStack = thread.getCallStack();
29
+ if (fallBackOnStaleCallstack && !callStack.length) {
30
+ callStack = thread.getStaleCallStack();
31
+ }
32
+ callStack.forEach(sf => {
33
+ const parsed = CellUri.parse(sf.source.uri);
34
+ if (parsed) {
35
+ newPausedCells.add(( sf.source.uri.toString()));
36
+ this.editIsPaused(sf.source.uri, true);
37
+ }
38
+ });
39
+ }
40
+ }
41
+ for (const uri of this._pausedCells) {
42
+ if (!( newPausedCells.has(uri))) {
43
+ this.editIsPaused(( URI.parse(uri)), false);
44
+ this._pausedCells.delete(uri);
45
+ }
46
+ }
47
+ newPausedCells.forEach(cell => this._pausedCells.add(cell));
48
+ }
49
+ editIsPaused(cellUri, isPaused) {
50
+ const parsed = CellUri.parse(cellUri);
51
+ if (parsed) {
52
+ const exeState = this._notebookExecutionStateService.getCellExecution(cellUri);
53
+ if (exeState && (exeState.isPaused !== isPaused || !exeState.didPause)) {
54
+ exeState.update([{
55
+ editType: CellExecutionUpdateType.ExecutionState,
56
+ didPause: true,
57
+ isPaused
58
+ }]);
59
+ }
60
+ }
61
+ }
62
+ };
63
+ NotebookCellPausing = ( __decorate([
64
+ ( __param(0, IDebugService)),
65
+ ( __param(1, INotebookExecutionStateService))
66
+ ], NotebookCellPausing));
67
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookCellPausing, 3 );
@@ -0,0 +1,165 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { Range } from 'vscode/vscode/vs/editor/common/core/range';
4
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
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 'vscode/vscode/vs/base/common/network';
3
+ import { registerEditorContribution } from 'vscode/vscode/vs/editor/browser/editorExtensions';
4
+ import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
5
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
6
+ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
7
+ import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
8
+ import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
9
+ import { EmptyTextEditorHintContribution } from '../../../../codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js';
10
+ import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService';
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,320 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
+ import { Disposable, DisposableStore, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { Schemas } from 'vscode/vscode/vs/base/common/network';
5
+ import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
6
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
7
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
8
+ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
9
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
10
+ import { Extensions, registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
11
+ import { CENTER_ACTIVE_CELL } from '../navigation/arrow.js';
12
+ import { SELECT_KERNEL_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
13
+ import { SELECT_NOTEBOOK_INDENTATION_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/editActions';
14
+ import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
15
+ import { NotebookCellsChangeType } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
16
+ import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
17
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
18
+ import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
19
+
20
+ let ImplictKernelSelector = class ImplictKernelSelector {
21
+ constructor(notebook, suggested, notebookKernelService, languageFeaturesService, logService) {
22
+ const disposables = ( new DisposableStore());
23
+ this.dispose = disposables.dispose.bind(disposables);
24
+ const selectKernel = () => {
25
+ disposables.clear();
26
+ notebookKernelService.selectKernelForNotebook(suggested, notebook);
27
+ };
28
+ disposables.add(notebook.onDidChangeContent(e => {
29
+ for (const event of e.rawEvents) {
30
+ switch (event.kind) {
31
+ case NotebookCellsChangeType.ChangeCellContent:
32
+ case NotebookCellsChangeType.ModelChange:
33
+ case NotebookCellsChangeType.Move:
34
+ case NotebookCellsChangeType.ChangeCellLanguage:
35
+ logService.trace('IMPLICIT kernel selection because of change event', event.kind);
36
+ selectKernel();
37
+ break;
38
+ }
39
+ }
40
+ }));
41
+ disposables.add(languageFeaturesService.hoverProvider.register({ scheme: Schemas.vscodeNotebookCell, pattern: notebook.uri.path }, {
42
+ provideHover() {
43
+ logService.trace('IMPLICIT kernel selection because of hover');
44
+ selectKernel();
45
+ return undefined;
46
+ }
47
+ }));
48
+ }
49
+ };
50
+ ImplictKernelSelector = ( __decorate([
51
+ ( __param(2, INotebookKernelService)),
52
+ ( __param(3, ILanguageFeaturesService)),
53
+ ( __param(4, ILogService))
54
+ ], ImplictKernelSelector));
55
+ let KernelStatus = class KernelStatus extends Disposable {
56
+ constructor(_editorService, _statusbarService, _notebookKernelService, _instantiationService) {
57
+ super();
58
+ this._editorService = _editorService;
59
+ this._statusbarService = _statusbarService;
60
+ this._notebookKernelService = _notebookKernelService;
61
+ this._instantiationService = _instantiationService;
62
+ this._editorDisposables = this._register(( new DisposableStore()));
63
+ this._kernelInfoElement = this._register(( new DisposableStore()));
64
+ this._register(this._editorService.onDidActiveEditorChange(() => this._updateStatusbar()));
65
+ }
66
+ _updateStatusbar() {
67
+ this._editorDisposables.clear();
68
+ const activeEditor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
69
+ if (!activeEditor) {
70
+ this._kernelInfoElement.clear();
71
+ return;
72
+ }
73
+ const updateStatus = () => {
74
+ if (activeEditor.notebookOptions.getDisplayOptions().globalToolbar) {
75
+ this._kernelInfoElement.clear();
76
+ return;
77
+ }
78
+ const notebook = activeEditor.textModel;
79
+ if (notebook) {
80
+ this._showKernelStatus(notebook);
81
+ }
82
+ else {
83
+ this._kernelInfoElement.clear();
84
+ }
85
+ };
86
+ this._editorDisposables.add(this._notebookKernelService.onDidAddKernel(updateStatus));
87
+ this._editorDisposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(updateStatus));
88
+ this._editorDisposables.add(this._notebookKernelService.onDidChangeNotebookAffinity(updateStatus));
89
+ this._editorDisposables.add(activeEditor.onDidChangeModel(updateStatus));
90
+ this._editorDisposables.add(activeEditor.notebookOptions.onDidChangeOptions(updateStatus));
91
+ updateStatus();
92
+ }
93
+ _showKernelStatus(notebook) {
94
+ this._kernelInfoElement.clear();
95
+ const { selected, suggestions, all } = this._notebookKernelService.getMatchingKernel(notebook);
96
+ const suggested = (suggestions.length === 1 ? suggestions[0] : undefined)
97
+ ?? (all.length === 1) ? all[0] : undefined;
98
+ let isSuggested = false;
99
+ if (all.length === 0) {
100
+ return;
101
+ }
102
+ else if (selected || suggested) {
103
+ let kernel = selected;
104
+ if (!kernel) {
105
+ kernel = suggested;
106
+ isSuggested = true;
107
+ this._kernelInfoElement.add(this._instantiationService.createInstance(ImplictKernelSelector, notebook, kernel));
108
+ }
109
+ const tooltip = kernel.description ?? kernel.detail ?? kernel.label;
110
+ this._kernelInfoElement.add(this._statusbarService.addEntry({
111
+ name: ( localizeWithPath(
112
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
113
+ 'notebook.info',
114
+ "Notebook Kernel Info"
115
+ )),
116
+ text: `$(notebook-kernel-select) ${kernel.label}`,
117
+ ariaLabel: kernel.label,
118
+ tooltip: isSuggested ? ( localizeWithPath(
119
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
120
+ 'tooltop',
121
+ "{0} (suggestion)",
122
+ tooltip
123
+ )) : tooltip,
124
+ command: SELECT_KERNEL_ID,
125
+ }, SELECT_KERNEL_ID, 1 , 10));
126
+ this._kernelInfoElement.add(kernel.onDidChange(() => this._showKernelStatus(notebook)));
127
+ }
128
+ else {
129
+ this._kernelInfoElement.add(this._statusbarService.addEntry({
130
+ name: ( localizeWithPath(
131
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
132
+ 'notebook.select',
133
+ "Notebook Kernel Selection"
134
+ )),
135
+ text: ( localizeWithPath(
136
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
137
+ 'kernel.select.label',
138
+ "Select Kernel"
139
+ )),
140
+ ariaLabel: ( localizeWithPath(
141
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
142
+ 'kernel.select.label',
143
+ "Select Kernel"
144
+ )),
145
+ command: SELECT_KERNEL_ID,
146
+ kind: 'prominent'
147
+ }, SELECT_KERNEL_ID, 1 , 10));
148
+ }
149
+ }
150
+ };
151
+ KernelStatus = ( __decorate([
152
+ ( __param(0, IEditorService)),
153
+ ( __param(1, IStatusbarService)),
154
+ ( __param(2, INotebookKernelService)),
155
+ ( __param(3, IInstantiationService))
156
+ ], KernelStatus));
157
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(KernelStatus, 3 );
158
+ let ActiveCellStatus = class ActiveCellStatus extends Disposable {
159
+ constructor(_editorService, _statusbarService) {
160
+ super();
161
+ this._editorService = _editorService;
162
+ this._statusbarService = _statusbarService;
163
+ this._itemDisposables = this._register(( new DisposableStore()));
164
+ this._accessor = this._register(( new MutableDisposable()));
165
+ this._register(this._editorService.onDidActiveEditorChange(() => this._update()));
166
+ }
167
+ _update() {
168
+ this._itemDisposables.clear();
169
+ const activeEditor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
170
+ if (activeEditor) {
171
+ this._itemDisposables.add(activeEditor.onDidChangeSelection(() => this._show(activeEditor)));
172
+ this._itemDisposables.add(activeEditor.onDidChangeActiveCell(() => this._show(activeEditor)));
173
+ this._show(activeEditor);
174
+ }
175
+ else {
176
+ this._accessor.clear();
177
+ }
178
+ }
179
+ _show(editor) {
180
+ if (!editor.hasModel()) {
181
+ this._accessor.clear();
182
+ return;
183
+ }
184
+ const newText = this._getSelectionsText(editor);
185
+ if (!newText) {
186
+ this._accessor.clear();
187
+ return;
188
+ }
189
+ const entry = {
190
+ name: ( localizeWithPath(
191
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
192
+ 'notebook.activeCellStatusName',
193
+ "Notebook Editor Selections"
194
+ )),
195
+ text: newText,
196
+ ariaLabel: newText,
197
+ command: CENTER_ACTIVE_CELL
198
+ };
199
+ if (!this._accessor.value) {
200
+ this._accessor.value = this._statusbarService.addEntry(entry, 'notebook.activeCellStatus', 1 , 100);
201
+ }
202
+ else {
203
+ this._accessor.value.update(entry);
204
+ }
205
+ }
206
+ _getSelectionsText(editor) {
207
+ if (!editor.hasModel()) {
208
+ return undefined;
209
+ }
210
+ const activeCell = editor.getActiveCell();
211
+ if (!activeCell) {
212
+ return undefined;
213
+ }
214
+ const idxFocused = editor.getCellIndex(activeCell) + 1;
215
+ const numSelected = editor.getSelections().reduce((prev, range) => prev + (range.end - range.start), 0);
216
+ const totalCells = editor.getLength();
217
+ return numSelected > 1 ?
218
+ ( localizeWithPath(
219
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
220
+ 'notebook.multiActiveCellIndicator',
221
+ "Cell {0} ({1} selected)",
222
+ idxFocused,
223
+ numSelected
224
+ )) :
225
+ ( localizeWithPath(
226
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
227
+ 'notebook.singleActiveCellIndicator',
228
+ "Cell {0} of {1}",
229
+ idxFocused,
230
+ totalCells
231
+ ));
232
+ }
233
+ };
234
+ ActiveCellStatus = ( __decorate([
235
+ ( __param(0, IEditorService)),
236
+ ( __param(1, IStatusbarService))
237
+ ], ActiveCellStatus));
238
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ActiveCellStatus, 3 );
239
+ let NotebookIndentationStatus = class NotebookIndentationStatus extends Disposable {
240
+ static { this.ID = 'selectNotebookIndentation'; }
241
+ constructor(_editorService, _statusbarService, _configurationService) {
242
+ super();
243
+ this._editorService = _editorService;
244
+ this._statusbarService = _statusbarService;
245
+ this._configurationService = _configurationService;
246
+ this._itemDisposables = this._register(( new DisposableStore()));
247
+ this._accessor = this._register(( new MutableDisposable()));
248
+ this._register(this._editorService.onDidActiveEditorChange(() => this._update()));
249
+ this._register(this._configurationService.onDidChangeConfiguration(e => {
250
+ if (e.affectsConfiguration('editor') || e.affectsConfiguration('notebook')) {
251
+ this._update();
252
+ }
253
+ }));
254
+ }
255
+ _update() {
256
+ this._itemDisposables.clear();
257
+ const activeEditor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
258
+ if (activeEditor) {
259
+ this._show(activeEditor);
260
+ this._itemDisposables.add(activeEditor.onDidChangeSelection(() => {
261
+ this._accessor.clear();
262
+ this._show(activeEditor);
263
+ }));
264
+ }
265
+ else {
266
+ this._accessor.clear();
267
+ }
268
+ }
269
+ _show(editor) {
270
+ if (!editor.hasModel()) {
271
+ this._accessor.clear();
272
+ return;
273
+ }
274
+ const cellOptions = editor.getActiveCell()?.textModel?.getOptions();
275
+ if (!cellOptions) {
276
+ this._accessor.clear();
277
+ return;
278
+ }
279
+ const cellEditorOverridesRaw = editor.notebookOptions.getDisplayOptions().editorOptionsCustomizations;
280
+ const indentSize = cellEditorOverridesRaw['editor.indentSize'] ?? cellOptions?.indentSize;
281
+ const insertSpaces = cellEditorOverridesRaw['editor.insertSpaces'] ?? cellOptions?.tabSize;
282
+ const tabSize = cellEditorOverridesRaw['editor.tabSize'] ?? cellOptions?.insertSpaces;
283
+ const width = typeof indentSize === 'number' ? indentSize : tabSize;
284
+ const message = insertSpaces ? `Spaces: ${width}` : `Tab Size: ${width}`;
285
+ const newText = message;
286
+ if (!newText) {
287
+ this._accessor.clear();
288
+ return;
289
+ }
290
+ const entry = {
291
+ name: ( localizeWithPath(
292
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
293
+ 'notebook.indentation',
294
+ "Notebook Indentation"
295
+ )),
296
+ text: newText,
297
+ ariaLabel: newText,
298
+ tooltip: ( localizeWithPath(
299
+ 'vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar',
300
+ 'selectNotebookIndentation',
301
+ "Select Indentation"
302
+ )),
303
+ command: SELECT_NOTEBOOK_INDENTATION_ID
304
+ };
305
+ if (!this._accessor.value) {
306
+ this._accessor.value = this._statusbarService.addEntry(entry, 'notebook.status.indentation', 1 , 100.4);
307
+ }
308
+ else {
309
+ this._accessor.value.update(entry);
310
+ }
311
+ }
312
+ };
313
+ NotebookIndentationStatus = ( __decorate([
314
+ ( __param(0, IEditorService)),
315
+ ( __param(1, IStatusbarService)),
316
+ ( __param(2, IConfigurationService))
317
+ ], NotebookIndentationStatus));
318
+ registerWorkbenchContribution2(NotebookIndentationStatus.ID, NotebookIndentationStatus, 3 );
319
+
320
+ export { ActiveCellStatus, KernelStatus, NotebookIndentationStatus };