@codingame/monaco-vscode-notebook-service-override 4.0.0 → 4.1.0

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/notebook.js +12 -12
  2. package/package.json +2 -2
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -10
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +0 -391
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -544
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -101
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -120
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -60
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -150
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -656
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -517
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -652
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +0 -721
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -315
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +0 -199
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -47
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -115
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -911
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -395
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -185
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1187
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -510
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -90
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1002
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -203
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -386
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +0 -129
@@ -1,159 +0,0 @@
1
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
- import { format } from 'vscode/vscode/vs/base/common/strings';
3
- import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
4
- import { IAccessibleViewService } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleView';
5
- import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
6
-
7
- function getAccessibilityHelpText(accessor) {
8
- const keybindingService = accessor.get(IKeybindingService);
9
- const content = [];
10
- content.push(( localizeWithPath(
11
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
12
- 'notebook.overview',
13
- 'The notebook view is a collection of code and markdown cells. Code cells can be executed and will produce output directly below the cell.'
14
- )));
15
- content.push(descriptionForCommand('notebook.cell.edit', ( localizeWithPath(
16
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
17
- 'notebook.cell.edit',
18
- 'The Edit Cell command ({0}) will focus on the cell input.'
19
- )), ( localizeWithPath(
20
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
21
- 'notebook.cell.editNoKb',
22
- 'The Edit Cell command will focus on the cell input and is currently not triggerable by a keybinding.'
23
- )), keybindingService));
24
- content.push(descriptionForCommand('notebook.cell.quitEdit', ( localizeWithPath(
25
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
26
- 'notebook.cell.quitEdit',
27
- 'The Quit Edit command ({0}) will set focus on the cell container. The default (Escape) key may need to be pressed twice first exit the virtual cursor if active.'
28
- )), ( localizeWithPath(
29
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
30
- 'notebook.cell.quitEditNoKb',
31
- 'The Quit Edit command will set focus on the cell container and is currently not triggerable by a keybinding.'
32
- )), keybindingService));
33
- content.push(descriptionForCommand('notebook.cell.focusInOutput', ( localizeWithPath(
34
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
35
- 'notebook.cell.focusInOutput',
36
- 'The Focus Output command ({0}) will set focus in the cell\'s output.'
37
- )), ( localizeWithPath(
38
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
39
- 'notebook.cell.focusInOutputNoKb',
40
- 'The Quit Edit command will set focus in the cell\'s output and is currently not triggerable by a keybinding.'
41
- )), keybindingService));
42
- content.push(descriptionForCommand('notebook.focusNextEditor', ( localizeWithPath(
43
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
44
- 'notebook.focusNextEditor',
45
- 'The Focus Next Cell Editor command ({0}) will set focus in the next cell\'s editor.'
46
- )), ( localizeWithPath(
47
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
48
- 'notebook.focusNextEditorNoKb',
49
- 'The Focus Next Cell Editor command will set focus in the next cell\'s editor and is currently not triggerable by a keybinding.'
50
- )), keybindingService));
51
- content.push(descriptionForCommand('notebook.focusPreviousEditor', ( localizeWithPath(
52
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
53
- 'notebook.focusPreviousEditor',
54
- 'The Focus Previous Cell Editor command ({0}) will set focus in the previous cell\'s editor.'
55
- )), ( localizeWithPath(
56
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
57
- 'notebook.focusPreviousEditorNoKb',
58
- 'The Focus Previous Cell Editor command will set focus in the previous cell\'s editor and is currently not triggerable by a keybinding.'
59
- )), keybindingService));
60
- content.push(( localizeWithPath(
61
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
62
- 'notebook.cellNavigation',
63
- 'The up and down arrows will also move focus between cells while focused on the outer cell container.'
64
- )));
65
- content.push(descriptionForCommand('notebook.cell.executeAndFocusContainer', ( localizeWithPath(
66
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
67
- 'notebook.cell.executeAndFocusContainer',
68
- 'The Execute Cell command ({0}) executes the cell that currently has focus.'
69
- )), ( localizeWithPath(
70
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
71
- 'notebook.cell.executeAndFocusContainerNoKb',
72
- 'The Execute Cell command executes the cell that currently has focus and is currently not triggerable by a keybinding.'
73
- )), keybindingService));
74
- content.push(( localizeWithPath(
75
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
76
- 'notebook.cell.insertCodeCellBelowAndFocusContainer',
77
- 'The Insert Cell Above/Below commands will create new empty code cells'
78
- )));
79
- content.push(( localizeWithPath(
80
- 'vs/workbench/contrib/notebook/browser/notebookAccessibility',
81
- 'notebook.changeCellType',
82
- 'The Change Cell to Code/Markdown commands are used to switch between cell types.'
83
- )));
84
- return content.join('\n\n');
85
- }
86
- function descriptionForCommand(commandId, msg, noKbMsg, keybindingService) {
87
- const kb = keybindingService.lookupKeybinding(commandId);
88
- if (kb) {
89
- return format(msg, kb.getAriaLabel());
90
- }
91
- return format(noKbMsg, commandId);
92
- }
93
- async function runAccessibilityHelpAction(accessor, editor) {
94
- const accessibleViewService = accessor.get(IAccessibleViewService);
95
- const helpText = getAccessibilityHelpText(accessor);
96
- accessibleViewService.show({
97
- id: "notebook" ,
98
- verbositySettingKey: "accessibility.verbosity.notebook" ,
99
- provideContent: () => helpText,
100
- onClose: () => {
101
- editor.focus();
102
- },
103
- options: { type: "help" }
104
- });
105
- }
106
- function showAccessibleOutput(accessibleViewService, editorService) {
107
- const activePane = editorService.activeEditorPane;
108
- const notebookEditor = getNotebookEditorFromEditorPane(activePane);
109
- const notebookViewModel = notebookEditor?.getViewModel();
110
- const selections = notebookViewModel?.getSelections();
111
- const notebookDocument = notebookViewModel?.notebookDocument;
112
- if (!selections || !notebookDocument || !notebookEditor?.textModel) {
113
- return false;
114
- }
115
- const viewCell = notebookViewModel.viewCells[selections[0].start];
116
- let outputContent = '';
117
- const decoder = ( new TextDecoder());
118
- for (let i = 0; i < viewCell.outputsViewModels.length; i++) {
119
- const outputViewModel = viewCell.outputsViewModels[i];
120
- const outputTextModel = viewCell.model.outputs[i];
121
- const [mimeTypes, pick] = outputViewModel.resolveMimeTypes(notebookEditor.textModel, undefined);
122
- const mimeType = mimeTypes[pick].mimeType;
123
- let buffer = outputTextModel.outputs.find(output => output.mime === mimeType);
124
- if (!buffer || mimeType.startsWith('image')) {
125
- buffer = outputTextModel.outputs.find(output => !output.mime.startsWith('image'));
126
- }
127
- let text = `${mimeType}`;
128
- if (buffer) {
129
- const charLimit = 100_000;
130
- text = decoder.decode(buffer.data.slice(0, charLimit).buffer);
131
- if (buffer.data.byteLength > charLimit) {
132
- text = text + '...(truncated)';
133
- }
134
- if (mimeType.endsWith('error')) {
135
- text = text.replace(/\\u001b\[[0-9;]*m/gi, '').replaceAll('\\n', '\n');
136
- }
137
- }
138
- const index = viewCell.outputsViewModels.length > 1
139
- ? `Cell output ${i + 1} of ${viewCell.outputsViewModels.length}\n`
140
- : '';
141
- outputContent = outputContent.concat(`${index}${text}\n`);
142
- }
143
- if (!outputContent) {
144
- return false;
145
- }
146
- accessibleViewService.show({
147
- id: "notebook" ,
148
- verbositySettingKey: "accessibility.verbosity.notebook" ,
149
- provideContent() { return outputContent; },
150
- onClose() {
151
- notebookEditor?.setFocus(selections[0]);
152
- activePane?.focus();
153
- },
154
- options: { type: "view" }
155
- });
156
- return true;
157
- }
158
-
159
- export { getAccessibilityHelpText, runAccessibilityHelpAction, showAccessibleOutput };
@@ -1,451 +0,0 @@
1
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
- import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
3
- import { NotebookEditorPriority } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
4
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
6
- import { Extensions } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures';
7
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
8
-
9
- const NotebookEditorContribution = ( Object.freeze({
10
- type: 'type',
11
- displayName: 'displayName',
12
- selector: 'selector',
13
- priority: 'priority',
14
- }));
15
- const NotebookRendererContribution = ( Object.freeze({
16
- id: 'id',
17
- displayName: 'displayName',
18
- mimeTypes: 'mimeTypes',
19
- entrypoint: 'entrypoint',
20
- hardDependencies: 'dependencies',
21
- optionalDependencies: 'optionalDependencies',
22
- requiresMessaging: 'requiresMessaging',
23
- }));
24
- const NotebookPreloadContribution = ( Object.freeze({
25
- type: 'type',
26
- entrypoint: 'entrypoint',
27
- localResourceRoots: 'localResourceRoots',
28
- }));
29
- const notebookProviderContribution = {
30
- description: ( localizeWithPath(
31
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
32
- 'contributes.notebook.provider',
33
- 'Contributes notebook document provider.'
34
- )),
35
- type: 'array',
36
- defaultSnippets: [{ body: [{ type: '', displayName: '', 'selector': [{ 'filenamePattern': '' }] }] }],
37
- items: {
38
- type: 'object',
39
- required: [
40
- NotebookEditorContribution.type,
41
- NotebookEditorContribution.displayName,
42
- NotebookEditorContribution.selector,
43
- ],
44
- properties: {
45
- [NotebookEditorContribution.type]: {
46
- type: 'string',
47
- description: ( localizeWithPath(
48
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
49
- 'contributes.notebook.provider.viewType',
50
- 'Type of the notebook.'
51
- )),
52
- },
53
- [NotebookEditorContribution.displayName]: {
54
- type: 'string',
55
- description: ( localizeWithPath(
56
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
57
- 'contributes.notebook.provider.displayName',
58
- 'Human readable name of the notebook.'
59
- )),
60
- },
61
- [NotebookEditorContribution.selector]: {
62
- type: 'array',
63
- description: ( localizeWithPath(
64
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
65
- 'contributes.notebook.provider.selector',
66
- 'Set of globs that the notebook is for.'
67
- )),
68
- items: {
69
- type: 'object',
70
- properties: {
71
- filenamePattern: {
72
- type: 'string',
73
- description: ( localizeWithPath(
74
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
75
- 'contributes.notebook.provider.selector.filenamePattern',
76
- 'Glob that the notebook is enabled for.'
77
- )),
78
- },
79
- excludeFileNamePattern: {
80
- type: 'string',
81
- description: ( localizeWithPath(
82
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
83
- 'contributes.notebook.selector.provider.excludeFileNamePattern',
84
- 'Glob that the notebook is disabled for.'
85
- ))
86
- }
87
- }
88
- }
89
- },
90
- [NotebookEditorContribution.priority]: {
91
- type: 'string',
92
- markdownDeprecationMessage: ( localizeWithPath(
93
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
94
- 'contributes.priority',
95
- 'Controls if the custom editor is enabled automatically when the user opens a file. This may be overridden by users using the `workbench.editorAssociations` setting.'
96
- )),
97
- enum: [
98
- NotebookEditorPriority.default,
99
- NotebookEditorPriority.option,
100
- ],
101
- markdownEnumDescriptions: [
102
- ( localizeWithPath(
103
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
104
- 'contributes.priority.default',
105
- 'The editor is automatically used when the user opens a resource, provided that no other default custom editors are registered for that resource.'
106
- )),
107
- ( localizeWithPath(
108
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
109
- 'contributes.priority.option',
110
- 'The editor is not automatically used when the user opens a resource, but a user can switch to the editor using the `Reopen With` command.'
111
- )),
112
- ],
113
- default: 'default'
114
- }
115
- }
116
- }
117
- };
118
- const defaultRendererSnippet = ( Object.freeze({ id: '', displayName: '', mimeTypes: [''], entrypoint: '' }));
119
- const notebookRendererContribution = {
120
- description: ( localizeWithPath(
121
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
122
- 'contributes.notebook.renderer',
123
- 'Contributes notebook output renderer provider.'
124
- )),
125
- type: 'array',
126
- defaultSnippets: [{ body: [defaultRendererSnippet] }],
127
- items: {
128
- defaultSnippets: [{ body: defaultRendererSnippet }],
129
- allOf: [
130
- {
131
- type: 'object',
132
- required: [
133
- NotebookRendererContribution.id,
134
- NotebookRendererContribution.displayName,
135
- ],
136
- properties: {
137
- [NotebookRendererContribution.id]: {
138
- type: 'string',
139
- description: ( localizeWithPath(
140
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
141
- 'contributes.notebook.renderer.viewType',
142
- 'Unique identifier of the notebook output renderer.'
143
- )),
144
- },
145
- [NotebookRendererContribution.displayName]: {
146
- type: 'string',
147
- description: ( localizeWithPath(
148
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
149
- 'contributes.notebook.renderer.displayName',
150
- 'Human readable name of the notebook output renderer.'
151
- )),
152
- },
153
- [NotebookRendererContribution.hardDependencies]: {
154
- type: 'array',
155
- uniqueItems: true,
156
- items: { type: 'string' },
157
- markdownDescription: ( localizeWithPath(
158
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
159
- 'contributes.notebook.renderer.hardDependencies',
160
- 'List of kernel dependencies the renderer requires. If any of the dependencies are present in the `NotebookKernel.preloads`, the renderer can be used.'
161
- )),
162
- },
163
- [NotebookRendererContribution.optionalDependencies]: {
164
- type: 'array',
165
- uniqueItems: true,
166
- items: { type: 'string' },
167
- markdownDescription: ( localizeWithPath(
168
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
169
- 'contributes.notebook.renderer.optionalDependencies',
170
- 'List of soft kernel dependencies the renderer can make use of. If any of the dependencies are present in the `NotebookKernel.preloads`, the renderer will be preferred over renderers that don\'t interact with the kernel.'
171
- )),
172
- },
173
- [NotebookRendererContribution.requiresMessaging]: {
174
- default: 'never',
175
- enum: [
176
- 'always',
177
- 'optional',
178
- 'never',
179
- ],
180
- enumDescriptions: [
181
- ( localizeWithPath(
182
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
183
- 'contributes.notebook.renderer.requiresMessaging.always',
184
- 'Messaging is required. The renderer will only be used when it\'s part of an extension that can be run in an extension host.'
185
- )),
186
- ( localizeWithPath(
187
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
188
- 'contributes.notebook.renderer.requiresMessaging.optional',
189
- 'The renderer is better with messaging available, but it\'s not requried.'
190
- )),
191
- ( localizeWithPath(
192
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
193
- 'contributes.notebook.renderer.requiresMessaging.never',
194
- 'The renderer does not require messaging.'
195
- )),
196
- ],
197
- description: ( localizeWithPath(
198
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
199
- 'contributes.notebook.renderer.requiresMessaging',
200
- 'Defines how and if the renderer needs to communicate with an extension host, via `createRendererMessaging`. Renderers with stronger messaging requirements may not work in all environments.'
201
- )),
202
- },
203
- }
204
- },
205
- {
206
- oneOf: [
207
- {
208
- required: [
209
- NotebookRendererContribution.entrypoint,
210
- NotebookRendererContribution.mimeTypes,
211
- ],
212
- properties: {
213
- [NotebookRendererContribution.mimeTypes]: {
214
- type: 'array',
215
- description: ( localizeWithPath(
216
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
217
- 'contributes.notebook.selector',
218
- 'Set of globs that the notebook is for.'
219
- )),
220
- items: {
221
- type: 'string'
222
- }
223
- },
224
- [NotebookRendererContribution.entrypoint]: {
225
- description: ( localizeWithPath(
226
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
227
- 'contributes.notebook.renderer.entrypoint',
228
- 'File to load in the webview to render the extension.'
229
- )),
230
- type: 'string',
231
- },
232
- }
233
- },
234
- {
235
- required: [
236
- NotebookRendererContribution.entrypoint,
237
- ],
238
- properties: {
239
- [NotebookRendererContribution.entrypoint]: {
240
- description: ( localizeWithPath(
241
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
242
- 'contributes.notebook.renderer.entrypoint',
243
- 'File to load in the webview to render the extension.'
244
- )),
245
- type: 'object',
246
- required: ['extends', 'path'],
247
- properties: {
248
- extends: {
249
- type: 'string',
250
- description: ( localizeWithPath(
251
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
252
- 'contributes.notebook.renderer.entrypoint.extends',
253
- 'Existing renderer that this one extends.'
254
- )),
255
- },
256
- path: {
257
- type: 'string',
258
- description: ( localizeWithPath(
259
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
260
- 'contributes.notebook.renderer.entrypoint',
261
- 'File to load in the webview to render the extension.'
262
- )),
263
- },
264
- }
265
- },
266
- }
267
- }
268
- ]
269
- }
270
- ]
271
- }
272
- };
273
- const notebookPreloadContribution = {
274
- description: ( localizeWithPath(
275
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
276
- 'contributes.preload.provider',
277
- 'Contributes notebook preloads.'
278
- )),
279
- type: 'array',
280
- defaultSnippets: [{ body: [{ type: '', entrypoint: '' }] }],
281
- items: {
282
- type: 'object',
283
- required: [
284
- NotebookPreloadContribution.type,
285
- NotebookPreloadContribution.entrypoint
286
- ],
287
- properties: {
288
- [NotebookPreloadContribution.type]: {
289
- type: 'string',
290
- description: ( localizeWithPath(
291
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
292
- 'contributes.preload.provider.viewType',
293
- 'Type of the notebook.'
294
- )),
295
- },
296
- [NotebookPreloadContribution.entrypoint]: {
297
- type: 'string',
298
- description: ( localizeWithPath(
299
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
300
- 'contributes.preload.entrypoint',
301
- 'Path to file loaded in the webview.'
302
- )),
303
- },
304
- [NotebookPreloadContribution.localResourceRoots]: {
305
- type: 'array',
306
- items: { type: 'string' },
307
- description: ( localizeWithPath(
308
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
309
- 'contributes.preload.localResourceRoots',
310
- 'Paths to additional resources that should be allowed in the webview.'
311
- )),
312
- },
313
- }
314
- }
315
- };
316
- const notebooksExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
317
- extensionPoint: 'notebooks',
318
- jsonSchema: notebookProviderContribution,
319
- activationEventsGenerator: (contribs, result) => {
320
- for (const contrib of contribs) {
321
- if (contrib.type) {
322
- result.push(`onNotebookSerializer:${contrib.type}`);
323
- }
324
- }
325
- }
326
- });
327
- const notebookRendererExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
328
- extensionPoint: 'notebookRenderer',
329
- jsonSchema: notebookRendererContribution,
330
- activationEventsGenerator: (contribs, result) => {
331
- for (const contrib of contribs) {
332
- if (contrib.id) {
333
- result.push(`onRenderer:${contrib.id}`);
334
- }
335
- }
336
- }
337
- });
338
- const notebookPreloadExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
339
- extensionPoint: 'notebookPreload',
340
- jsonSchema: notebookPreloadContribution,
341
- });
342
- class NotebooksDataRenderer extends Disposable {
343
- constructor() {
344
- super(...arguments);
345
- this.type = 'table';
346
- }
347
- shouldRender(manifest) {
348
- return !!manifest.contributes?.notebooks;
349
- }
350
- render(manifest) {
351
- const contrib = manifest.contributes?.notebooks || [];
352
- if (!contrib.length) {
353
- return { data: { headers: [], rows: [] }, dispose: () => { } };
354
- }
355
- const headers = [
356
- ( localizeWithPath(
357
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
358
- 'Notebook id',
359
- "ID"
360
- )),
361
- ( localizeWithPath(
362
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
363
- 'Notebook name',
364
- "Name"
365
- )),
366
- ];
367
- const rows = ( contrib
368
- .sort((a, b) => a.type.localeCompare(b.type))
369
- .map(notebook => {
370
- return [
371
- notebook.type,
372
- notebook.displayName
373
- ];
374
- }));
375
- return {
376
- data: {
377
- headers,
378
- rows
379
- },
380
- dispose: () => { }
381
- };
382
- }
383
- }
384
- class NotebookRenderersDataRenderer extends Disposable {
385
- constructor() {
386
- super(...arguments);
387
- this.type = 'table';
388
- }
389
- shouldRender(manifest) {
390
- return !!manifest.contributes?.notebookRenderer;
391
- }
392
- render(manifest) {
393
- const contrib = manifest.contributes?.notebookRenderer || [];
394
- if (!contrib.length) {
395
- return { data: { headers: [], rows: [] }, dispose: () => { } };
396
- }
397
- const headers = [
398
- ( localizeWithPath(
399
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
400
- 'Notebook renderer name',
401
- "Name"
402
- )),
403
- ( localizeWithPath(
404
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
405
- 'Notebook mimetypes',
406
- "Mimetypes"
407
- )),
408
- ];
409
- const rows = ( contrib
410
- .sort((a, b) => a.displayName.localeCompare(b.displayName))
411
- .map(notebookRenderer => {
412
- return [
413
- notebookRenderer.displayName,
414
- notebookRenderer.mimeTypes.join(',')
415
- ];
416
- }));
417
- return {
418
- data: {
419
- headers,
420
- rows
421
- },
422
- dispose: () => { }
423
- };
424
- }
425
- }
426
- ( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
427
- id: 'notebooks',
428
- label: ( localizeWithPath(
429
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
430
- 'notebooks',
431
- "Notebooks"
432
- )),
433
- access: {
434
- canToggle: false
435
- },
436
- renderer: ( new SyncDescriptor(NotebooksDataRenderer)),
437
- });
438
- ( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
439
- id: 'notebookRenderer',
440
- label: ( localizeWithPath(
441
- 'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
442
- 'notebookRenderer',
443
- "Notebook Renderers"
444
- )),
445
- access: {
446
- canToggle: false
447
- },
448
- renderer: ( new SyncDescriptor(NotebookRenderersDataRenderer)),
449
- });
450
-
451
- export { notebookPreloadExtensionPoint, notebookRendererExtensionPoint, notebooksExtensionPoint };