@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,159 @@
1
+ import { Disposable, DisposableStore, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
2
+ import { localize2WithPath } from 'vscode/vscode/vs/nls';
3
+ import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
4
+ 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 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
7
+ import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
8
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
9
+
10
+ class TroubleshootController extends Disposable {
11
+ static { this.id = 'workbench.notebook.troubleshoot'; }
12
+ constructor(_notebookEditor) {
13
+ super();
14
+ this._notebookEditor = _notebookEditor;
15
+ this._localStore = this._register(( new DisposableStore()));
16
+ this._cellStateListeners = [];
17
+ this._enabled = false;
18
+ this._cellStatusItems = [];
19
+ this._register(this._notebookEditor.onDidChangeModel(() => {
20
+ this._update();
21
+ }));
22
+ this._update();
23
+ }
24
+ toggle() {
25
+ this._enabled = !this._enabled;
26
+ this._update();
27
+ }
28
+ _update() {
29
+ this._localStore.clear();
30
+ this._cellStateListeners.forEach(listener => listener.dispose());
31
+ if (!this._notebookEditor.hasModel()) {
32
+ return;
33
+ }
34
+ this._updateListener();
35
+ }
36
+ _log(cell, e) {
37
+ if (this._enabled) {
38
+ const oldHeight = this._notebookEditor.getViewHeight(cell);
39
+ console.log(`cell#${cell.handle}`, e, `${oldHeight} -> ${cell.layoutInfo.totalHeight}`);
40
+ }
41
+ }
42
+ _updateListener() {
43
+ if (!this._notebookEditor.hasModel()) {
44
+ return;
45
+ }
46
+ for (let i = 0; i < this._notebookEditor.getLength(); i++) {
47
+ const cell = this._notebookEditor.cellAt(i);
48
+ this._cellStateListeners.push(cell.onDidChangeLayout(e => {
49
+ this._log(cell, e);
50
+ }));
51
+ }
52
+ this._localStore.add(this._notebookEditor.onDidChangeViewCells(e => {
53
+ [...e.splices].reverse().forEach(splice => {
54
+ const [start, deleted, newCells] = splice;
55
+ const deletedCells = this._cellStateListeners.splice(start, deleted, ...( newCells.map(cell => {
56
+ return cell.onDidChangeLayout((e) => {
57
+ this._log(cell, e);
58
+ });
59
+ })));
60
+ dispose(deletedCells);
61
+ });
62
+ }));
63
+ const vm = this._notebookEditor.getViewModel();
64
+ let items = [];
65
+ if (this._enabled) {
66
+ items = this._getItemsForCells();
67
+ }
68
+ this._cellStatusItems = vm.deltaCellStatusBarItems(this._cellStatusItems, items);
69
+ }
70
+ _getItemsForCells() {
71
+ const items = [];
72
+ for (let i = 0; i < this._notebookEditor.getLength(); i++) {
73
+ items.push({
74
+ handle: i,
75
+ items: [
76
+ {
77
+ text: `index: ${i}`,
78
+ alignment: 1 ,
79
+ priority: Number.MAX_SAFE_INTEGER
80
+ }
81
+ ]
82
+ });
83
+ }
84
+ return items;
85
+ }
86
+ dispose() {
87
+ dispose(this._cellStateListeners);
88
+ super.dispose();
89
+ }
90
+ }
91
+ registerNotebookContribution(TroubleshootController.id, TroubleshootController);
92
+ registerAction2(class extends Action2 {
93
+ constructor() {
94
+ super({
95
+ id: 'notebook.toggleLayoutTroubleshoot',
96
+ title: ( localize2WithPath(
97
+ 'vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout',
98
+ 'workbench.notebook.toggleLayoutTroubleshoot',
99
+ "Toggle Layout Troubleshoot"
100
+ )),
101
+ category: Categories.Developer,
102
+ f1: true
103
+ });
104
+ }
105
+ async run(accessor) {
106
+ const editorService = accessor.get(IEditorService);
107
+ const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
108
+ if (!editor) {
109
+ return;
110
+ }
111
+ const controller = editor.getContribution(TroubleshootController.id);
112
+ controller?.toggle();
113
+ }
114
+ });
115
+ registerAction2(class extends Action2 {
116
+ constructor() {
117
+ super({
118
+ id: 'notebook.inspectLayout',
119
+ title: ( localize2WithPath(
120
+ 'vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout',
121
+ 'workbench.notebook.inspectLayout',
122
+ "Inspect Notebook Layout"
123
+ )),
124
+ category: Categories.Developer,
125
+ f1: true
126
+ });
127
+ }
128
+ async run(accessor) {
129
+ const editorService = accessor.get(IEditorService);
130
+ const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
131
+ if (!editor || !editor.hasModel()) {
132
+ return;
133
+ }
134
+ for (let i = 0; i < editor.getLength(); i++) {
135
+ const cell = editor.cellAt(i);
136
+ console.log(`cell#${cell.handle}`, cell.layoutInfo);
137
+ }
138
+ }
139
+ });
140
+ registerAction2(class extends Action2 {
141
+ constructor() {
142
+ super({
143
+ id: 'notebook.clearNotebookEdtitorTypeCache',
144
+ title: ( localize2WithPath(
145
+ 'vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout',
146
+ 'workbench.notebook.clearNotebookEdtitorTypeCache',
147
+ "Clear Notebook Editor Type Cache"
148
+ )),
149
+ category: Categories.Developer,
150
+ f1: true
151
+ });
152
+ }
153
+ async run(accessor) {
154
+ const notebookService = accessor.get(INotebookService);
155
+ notebookService.clearEditorCache();
156
+ }
157
+ });
158
+
159
+ export { TroubleshootController };
@@ -0,0 +1,56 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
4
+ import { CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
5
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
6
+ import { getNotebookEditorFromEditorPane, CellEditState } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
7
+ import { UndoCommand, RedoCommand } from 'vscode/vscode/vs/editor/browser/editorExtensions';
8
+
9
+ let NotebookUndoRedoContribution = class NotebookUndoRedoContribution extends Disposable {
10
+ static { this.ID = 'workbench.contrib.notebookUndoRedo'; }
11
+ constructor(_editorService) {
12
+ super();
13
+ this._editorService = _editorService;
14
+ const PRIORITY = 105;
15
+ this._register(UndoCommand.addImplementation(PRIORITY, 'notebook-undo-redo', () => {
16
+ const editor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
17
+ const viewModel = editor?.getViewModel();
18
+ if (editor && editor.hasModel() && viewModel) {
19
+ return viewModel.undo().then(cellResources => {
20
+ if (cellResources?.length) {
21
+ for (let i = 0; i < editor.getLength(); i++) {
22
+ const cell = editor.cellAt(i);
23
+ if (cell.cellKind === CellKind.Markup && cellResources.find(resource => resource.fragment === cell.model.uri.fragment)) {
24
+ cell.updateEditState(CellEditState.Editing, 'undo');
25
+ }
26
+ }
27
+ editor?.setOptions({ cellOptions: { resource: cellResources[0] }, preserveFocus: true });
28
+ }
29
+ });
30
+ }
31
+ return false;
32
+ }));
33
+ this._register(RedoCommand.addImplementation(PRIORITY, 'notebook-undo-redo', () => {
34
+ const editor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
35
+ const viewModel = editor?.getViewModel();
36
+ if (editor && editor.hasModel() && viewModel) {
37
+ return viewModel.redo().then(cellResources => {
38
+ if (cellResources?.length) {
39
+ for (let i = 0; i < editor.getLength(); i++) {
40
+ const cell = editor.cellAt(i);
41
+ if (cell.cellKind === CellKind.Markup && cellResources.find(resource => resource.fragment === cell.model.uri.fragment)) {
42
+ cell.updateEditState(CellEditState.Editing, 'redo');
43
+ }
44
+ }
45
+ editor?.setOptions({ cellOptions: { resource: cellResources[0] }, preserveFocus: true });
46
+ }
47
+ });
48
+ }
49
+ return false;
50
+ }));
51
+ }
52
+ };
53
+ NotebookUndoRedoContribution = ( __decorate([
54
+ ( __param(0, IEditorService))
55
+ ], NotebookUndoRedoContribution));
56
+ registerWorkbenchContribution2(NotebookUndoRedoContribution.ID, NotebookUndoRedoContribution, 2 );
@@ -0,0 +1,94 @@
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 { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
5
+ import { CellEditState } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
6
+ import { registerNotebookContribution } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
7
+ import { outputDisplayLimit } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
8
+ import { CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
9
+ import { cellRangesToIndexes } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookRange';
10
+ import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
11
+
12
+ let NotebookViewportContribution = class NotebookViewportContribution extends Disposable {
13
+ static { this.id = 'workbench.notebook.viewportWarmup'; }
14
+ constructor(_notebookEditor, _notebookService, accessibilityService) {
15
+ super();
16
+ this._notebookEditor = _notebookEditor;
17
+ this._notebookService = _notebookService;
18
+ this._warmupDocument = null;
19
+ this._warmupViewport = ( new RunOnceScheduler(() => this._warmupViewportNow(), 200));
20
+ this._register(this._warmupViewport);
21
+ this._register(this._notebookEditor.onDidScroll(() => {
22
+ this._warmupViewport.schedule();
23
+ }));
24
+ this._warmupDocument = ( new RunOnceScheduler(() => this._warmupDocumentNow(), 200));
25
+ this._register(this._warmupDocument);
26
+ this._register(this._notebookEditor.onDidAttachViewModel(() => {
27
+ if (this._notebookEditor.hasModel()) {
28
+ this._warmupDocument?.schedule();
29
+ }
30
+ }));
31
+ if (this._notebookEditor.hasModel()) {
32
+ this._warmupDocument?.schedule();
33
+ }
34
+ }
35
+ _warmupDocumentNow() {
36
+ if (this._notebookEditor.hasModel()) {
37
+ for (let i = 0; i < this._notebookEditor.getLength(); i++) {
38
+ const cell = this._notebookEditor.cellAt(i);
39
+ if (cell?.cellKind === CellKind.Markup && cell?.getEditState() === CellEditState.Preview && !cell.isInputCollapsed) ;
40
+ else if (cell?.cellKind === CellKind.Code) {
41
+ this._warmupCodeCell(cell);
42
+ }
43
+ }
44
+ }
45
+ }
46
+ _warmupViewportNow() {
47
+ if (this._notebookEditor.isDisposed) {
48
+ return;
49
+ }
50
+ if (!this._notebookEditor.hasModel()) {
51
+ return;
52
+ }
53
+ const visibleRanges = this._notebookEditor.getVisibleRangesPlusViewportAboveAndBelow();
54
+ cellRangesToIndexes(visibleRanges).forEach(index => {
55
+ const cell = this._notebookEditor.cellAt(index);
56
+ if (cell?.cellKind === CellKind.Markup && cell?.getEditState() === CellEditState.Preview && !cell.isInputCollapsed) {
57
+ this._notebookEditor.createMarkupPreview(cell);
58
+ }
59
+ else if (cell?.cellKind === CellKind.Code) {
60
+ this._warmupCodeCell(cell);
61
+ }
62
+ });
63
+ }
64
+ _warmupCodeCell(viewCell) {
65
+ if (viewCell.isOutputCollapsed) {
66
+ return;
67
+ }
68
+ const outputs = viewCell.outputsViewModels;
69
+ for (const output of outputs.slice(0, outputDisplayLimit)) {
70
+ const [mimeTypes, pick] = output.resolveMimeTypes(this._notebookEditor.textModel, undefined);
71
+ if (!mimeTypes.find(mimeType => mimeType.isTrusted) || mimeTypes.length === 0) {
72
+ continue;
73
+ }
74
+ const pickedMimeTypeRenderer = mimeTypes[pick];
75
+ if (!pickedMimeTypeRenderer) {
76
+ return;
77
+ }
78
+ if (!this._notebookEditor.hasModel()) {
79
+ return;
80
+ }
81
+ const renderer = this._notebookService.getRendererInfo(pickedMimeTypeRenderer.rendererId);
82
+ if (!renderer) {
83
+ return;
84
+ }
85
+ const result = { type: 1 , renderer, source: output, mimeType: pickedMimeTypeRenderer.mimeType };
86
+ this._notebookEditor.createOutput(viewCell, result, 0, true);
87
+ }
88
+ }
89
+ };
90
+ NotebookViewportContribution = ( __decorate([
91
+ ( __param(1, INotebookService)),
92
+ ( __param(2, IAccessibilityService))
93
+ ], NotebookViewportContribution));
94
+ registerNotebookContribution(NotebookViewportContribution.id, NotebookViewportContribution);
@@ -0,0 +1,51 @@
1
+ import { isRelativePattern } from 'vscode/vscode/vs/base/common/glob';
2
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
3
+ import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
4
+ import { isDocumentExcludePattern } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
5
+ import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
6
+ import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
7
+
8
+ CommandsRegistry.registerCommand('_resolveNotebookContentProvider', (accessor) => {
9
+ const notebookService = accessor.get(INotebookService);
10
+ const contentProviders = notebookService.getContributedNotebookTypes();
11
+ return ( contentProviders.map(provider => {
12
+ const filenamePatterns = ( provider.selectors.map(selector => {
13
+ if (typeof selector === 'string') {
14
+ return selector;
15
+ }
16
+ if (isRelativePattern(selector)) {
17
+ return selector;
18
+ }
19
+ if (isDocumentExcludePattern(selector)) {
20
+ return {
21
+ include: selector.include,
22
+ exclude: selector.exclude
23
+ };
24
+ }
25
+ return null;
26
+ })).filter(pattern => pattern !== null);
27
+ return {
28
+ viewType: provider.id,
29
+ displayName: provider.displayName,
30
+ filenamePattern: filenamePatterns,
31
+ options: {
32
+ transientCellMetadata: provider.options.transientCellMetadata,
33
+ transientDocumentMetadata: provider.options.transientDocumentMetadata,
34
+ transientOutputs: provider.options.transientOutputs
35
+ }
36
+ };
37
+ }));
38
+ });
39
+ CommandsRegistry.registerCommand('_resolveNotebookKernels', async (accessor, args) => {
40
+ const notebookKernelService = accessor.get(INotebookKernelService);
41
+ const uri = URI.revive(args.uri);
42
+ const kernels = notebookKernelService.getMatchingKernel({ uri, viewType: args.viewType });
43
+ return ( kernels.all.map(provider => ({
44
+ id: provider.id,
45
+ label: provider.label,
46
+ description: provider.description,
47
+ detail: provider.detail,
48
+ isPreferred: false,
49
+ preloads: provider.preloadUris,
50
+ })));
51
+ });