@codingame/monaco-vscode-notebook-service-override 1.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/notebook.d.ts +5 -0
- package/notebook.js +44 -0
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/package.json +32 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +387 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +668 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +319 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +485 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +238 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +93 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +383 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +46 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +135 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +383 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +117 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +511 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +168 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +702 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +268 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +45 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +108 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +872 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +393 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +175 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1121 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +339 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +182 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +509 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +133 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +342 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +666 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +80 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1001 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +202 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +217 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +372 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +706 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +407 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
- package/worker.js +1 -0
- package/workers/notebook.worker.js +9 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import { format } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
3
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
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 = 100000;
|
|
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 };
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
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
|
+
|
|
5
|
+
const NotebookEditorContribution = ( Object.freeze({
|
|
6
|
+
type: 'type',
|
|
7
|
+
displayName: 'displayName',
|
|
8
|
+
selector: 'selector',
|
|
9
|
+
priority: 'priority',
|
|
10
|
+
}));
|
|
11
|
+
const NotebookRendererContribution = ( Object.freeze({
|
|
12
|
+
id: 'id',
|
|
13
|
+
displayName: 'displayName',
|
|
14
|
+
mimeTypes: 'mimeTypes',
|
|
15
|
+
entrypoint: 'entrypoint',
|
|
16
|
+
hardDependencies: 'dependencies',
|
|
17
|
+
optionalDependencies: 'optionalDependencies',
|
|
18
|
+
requiresMessaging: 'requiresMessaging',
|
|
19
|
+
}));
|
|
20
|
+
const NotebookPreloadContribution = ( Object.freeze({
|
|
21
|
+
type: 'type',
|
|
22
|
+
entrypoint: 'entrypoint',
|
|
23
|
+
localResourceRoots: 'localResourceRoots',
|
|
24
|
+
}));
|
|
25
|
+
const notebookProviderContribution = {
|
|
26
|
+
description: ( nls.localizeWithPath(
|
|
27
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
28
|
+
'contributes.notebook.provider',
|
|
29
|
+
'Contributes notebook document provider.'
|
|
30
|
+
)),
|
|
31
|
+
type: 'array',
|
|
32
|
+
defaultSnippets: [{ body: [{ type: '', displayName: '', 'selector': [{ 'filenamePattern': '' }] }] }],
|
|
33
|
+
items: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
required: [
|
|
36
|
+
NotebookEditorContribution.type,
|
|
37
|
+
NotebookEditorContribution.displayName,
|
|
38
|
+
NotebookEditorContribution.selector,
|
|
39
|
+
],
|
|
40
|
+
properties: {
|
|
41
|
+
[NotebookEditorContribution.type]: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: ( nls.localizeWithPath(
|
|
44
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
45
|
+
'contributes.notebook.provider.viewType',
|
|
46
|
+
'Type of the notebook.'
|
|
47
|
+
)),
|
|
48
|
+
},
|
|
49
|
+
[NotebookEditorContribution.displayName]: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: ( nls.localizeWithPath(
|
|
52
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
53
|
+
'contributes.notebook.provider.displayName',
|
|
54
|
+
'Human readable name of the notebook.'
|
|
55
|
+
)),
|
|
56
|
+
},
|
|
57
|
+
[NotebookEditorContribution.selector]: {
|
|
58
|
+
type: 'array',
|
|
59
|
+
description: ( nls.localizeWithPath(
|
|
60
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
61
|
+
'contributes.notebook.provider.selector',
|
|
62
|
+
'Set of globs that the notebook is for.'
|
|
63
|
+
)),
|
|
64
|
+
items: {
|
|
65
|
+
type: 'object',
|
|
66
|
+
properties: {
|
|
67
|
+
filenamePattern: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: ( nls.localizeWithPath(
|
|
70
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
71
|
+
'contributes.notebook.provider.selector.filenamePattern',
|
|
72
|
+
'Glob that the notebook is enabled for.'
|
|
73
|
+
)),
|
|
74
|
+
},
|
|
75
|
+
excludeFileNamePattern: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: ( nls.localizeWithPath(
|
|
78
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
79
|
+
'contributes.notebook.selector.provider.excludeFileNamePattern',
|
|
80
|
+
'Glob that the notebook is disabled for.'
|
|
81
|
+
))
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
[NotebookEditorContribution.priority]: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
markdownDeprecationMessage: ( nls.localizeWithPath(
|
|
89
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
90
|
+
'contributes.priority',
|
|
91
|
+
'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.'
|
|
92
|
+
)),
|
|
93
|
+
enum: [
|
|
94
|
+
NotebookEditorPriority.default,
|
|
95
|
+
NotebookEditorPriority.option,
|
|
96
|
+
],
|
|
97
|
+
markdownEnumDescriptions: [
|
|
98
|
+
( nls.localizeWithPath(
|
|
99
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
100
|
+
'contributes.priority.default',
|
|
101
|
+
'The editor is automatically used when the user opens a resource, provided that no other default custom editors are registered for that resource.'
|
|
102
|
+
)),
|
|
103
|
+
( nls.localizeWithPath(
|
|
104
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
105
|
+
'contributes.priority.option',
|
|
106
|
+
'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.'
|
|
107
|
+
)),
|
|
108
|
+
],
|
|
109
|
+
default: 'default'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const defaultRendererSnippet = ( Object.freeze({ id: '', displayName: '', mimeTypes: [''], entrypoint: '' }));
|
|
115
|
+
const notebookRendererContribution = {
|
|
116
|
+
description: ( nls.localizeWithPath(
|
|
117
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
118
|
+
'contributes.notebook.renderer',
|
|
119
|
+
'Contributes notebook output renderer provider.'
|
|
120
|
+
)),
|
|
121
|
+
type: 'array',
|
|
122
|
+
defaultSnippets: [{ body: [defaultRendererSnippet] }],
|
|
123
|
+
items: {
|
|
124
|
+
defaultSnippets: [{ body: defaultRendererSnippet }],
|
|
125
|
+
allOf: [
|
|
126
|
+
{
|
|
127
|
+
type: 'object',
|
|
128
|
+
required: [
|
|
129
|
+
NotebookRendererContribution.id,
|
|
130
|
+
NotebookRendererContribution.displayName,
|
|
131
|
+
],
|
|
132
|
+
properties: {
|
|
133
|
+
[NotebookRendererContribution.id]: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: ( nls.localizeWithPath(
|
|
136
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
137
|
+
'contributes.notebook.renderer.viewType',
|
|
138
|
+
'Unique identifier of the notebook output renderer.'
|
|
139
|
+
)),
|
|
140
|
+
},
|
|
141
|
+
[NotebookRendererContribution.displayName]: {
|
|
142
|
+
type: 'string',
|
|
143
|
+
description: ( nls.localizeWithPath(
|
|
144
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
145
|
+
'contributes.notebook.renderer.displayName',
|
|
146
|
+
'Human readable name of the notebook output renderer.'
|
|
147
|
+
)),
|
|
148
|
+
},
|
|
149
|
+
[NotebookRendererContribution.hardDependencies]: {
|
|
150
|
+
type: 'array',
|
|
151
|
+
uniqueItems: true,
|
|
152
|
+
items: { type: 'string' },
|
|
153
|
+
markdownDescription: ( nls.localizeWithPath(
|
|
154
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
155
|
+
'contributes.notebook.renderer.hardDependencies',
|
|
156
|
+
'List of kernel dependencies the renderer requires. If any of the dependencies are present in the `NotebookKernel.preloads`, the renderer can be used.'
|
|
157
|
+
)),
|
|
158
|
+
},
|
|
159
|
+
[NotebookRendererContribution.optionalDependencies]: {
|
|
160
|
+
type: 'array',
|
|
161
|
+
uniqueItems: true,
|
|
162
|
+
items: { type: 'string' },
|
|
163
|
+
markdownDescription: ( nls.localizeWithPath(
|
|
164
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
165
|
+
'contributes.notebook.renderer.optionalDependencies',
|
|
166
|
+
'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.'
|
|
167
|
+
)),
|
|
168
|
+
},
|
|
169
|
+
[NotebookRendererContribution.requiresMessaging]: {
|
|
170
|
+
default: 'never',
|
|
171
|
+
enum: [
|
|
172
|
+
'always',
|
|
173
|
+
'optional',
|
|
174
|
+
'never',
|
|
175
|
+
],
|
|
176
|
+
enumDescriptions: [
|
|
177
|
+
( nls.localizeWithPath(
|
|
178
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
179
|
+
'contributes.notebook.renderer.requiresMessaging.always',
|
|
180
|
+
'Messaging is required. The renderer will only be used when it\'s part of an extension that can be run in an extension host.'
|
|
181
|
+
)),
|
|
182
|
+
( nls.localizeWithPath(
|
|
183
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
184
|
+
'contributes.notebook.renderer.requiresMessaging.optional',
|
|
185
|
+
'The renderer is better with messaging available, but it\'s not requried.'
|
|
186
|
+
)),
|
|
187
|
+
( nls.localizeWithPath(
|
|
188
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
189
|
+
'contributes.notebook.renderer.requiresMessaging.never',
|
|
190
|
+
'The renderer does not require messaging.'
|
|
191
|
+
)),
|
|
192
|
+
],
|
|
193
|
+
description: ( nls.localizeWithPath(
|
|
194
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
195
|
+
'contributes.notebook.renderer.requiresMessaging',
|
|
196
|
+
'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.'
|
|
197
|
+
)),
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
oneOf: [
|
|
203
|
+
{
|
|
204
|
+
required: [
|
|
205
|
+
NotebookRendererContribution.entrypoint,
|
|
206
|
+
NotebookRendererContribution.mimeTypes,
|
|
207
|
+
],
|
|
208
|
+
properties: {
|
|
209
|
+
[NotebookRendererContribution.mimeTypes]: {
|
|
210
|
+
type: 'array',
|
|
211
|
+
description: ( nls.localizeWithPath(
|
|
212
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
213
|
+
'contributes.notebook.selector',
|
|
214
|
+
'Set of globs that the notebook is for.'
|
|
215
|
+
)),
|
|
216
|
+
items: {
|
|
217
|
+
type: 'string'
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
[NotebookRendererContribution.entrypoint]: {
|
|
221
|
+
description: ( nls.localizeWithPath(
|
|
222
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
223
|
+
'contributes.notebook.renderer.entrypoint',
|
|
224
|
+
'File to load in the webview to render the extension.'
|
|
225
|
+
)),
|
|
226
|
+
type: 'string',
|
|
227
|
+
},
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
required: [
|
|
232
|
+
NotebookRendererContribution.entrypoint,
|
|
233
|
+
],
|
|
234
|
+
properties: {
|
|
235
|
+
[NotebookRendererContribution.entrypoint]: {
|
|
236
|
+
description: ( nls.localizeWithPath(
|
|
237
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
238
|
+
'contributes.notebook.renderer.entrypoint',
|
|
239
|
+
'File to load in the webview to render the extension.'
|
|
240
|
+
)),
|
|
241
|
+
type: 'object',
|
|
242
|
+
required: ['extends', 'path'],
|
|
243
|
+
properties: {
|
|
244
|
+
extends: {
|
|
245
|
+
type: 'string',
|
|
246
|
+
description: ( nls.localizeWithPath(
|
|
247
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
248
|
+
'contributes.notebook.renderer.entrypoint.extends',
|
|
249
|
+
'Existing renderer that this one extends.'
|
|
250
|
+
)),
|
|
251
|
+
},
|
|
252
|
+
path: {
|
|
253
|
+
type: 'string',
|
|
254
|
+
description: ( nls.localizeWithPath(
|
|
255
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
256
|
+
'contributes.notebook.renderer.entrypoint',
|
|
257
|
+
'File to load in the webview to render the extension.'
|
|
258
|
+
)),
|
|
259
|
+
},
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const notebookPreloadContribution = {
|
|
270
|
+
description: ( nls.localizeWithPath(
|
|
271
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
272
|
+
'contributes.preload.provider',
|
|
273
|
+
'Contributes notebook preloads.'
|
|
274
|
+
)),
|
|
275
|
+
type: 'array',
|
|
276
|
+
defaultSnippets: [{ body: [{ type: '', entrypoint: '' }] }],
|
|
277
|
+
items: {
|
|
278
|
+
type: 'object',
|
|
279
|
+
required: [
|
|
280
|
+
NotebookPreloadContribution.type,
|
|
281
|
+
NotebookPreloadContribution.entrypoint
|
|
282
|
+
],
|
|
283
|
+
properties: {
|
|
284
|
+
[NotebookPreloadContribution.type]: {
|
|
285
|
+
type: 'string',
|
|
286
|
+
description: ( nls.localizeWithPath(
|
|
287
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
288
|
+
'contributes.preload.provider.viewType',
|
|
289
|
+
'Type of the notebook.'
|
|
290
|
+
)),
|
|
291
|
+
},
|
|
292
|
+
[NotebookPreloadContribution.entrypoint]: {
|
|
293
|
+
type: 'string',
|
|
294
|
+
description: ( nls.localizeWithPath(
|
|
295
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
296
|
+
'contributes.preload.entrypoint',
|
|
297
|
+
'Path to file loaded in the webview.'
|
|
298
|
+
)),
|
|
299
|
+
},
|
|
300
|
+
[NotebookPreloadContribution.localResourceRoots]: {
|
|
301
|
+
type: 'array',
|
|
302
|
+
items: { type: 'string' },
|
|
303
|
+
description: ( nls.localizeWithPath(
|
|
304
|
+
'vs/workbench/contrib/notebook/browser/notebookExtensionPoint',
|
|
305
|
+
'contributes.preload.localResourceRoots',
|
|
306
|
+
'Paths to additional resources that should be allowed in the webview.'
|
|
307
|
+
)),
|
|
308
|
+
},
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
const notebooksExtensionPoint = ( ExtensionsRegistry.registerExtensionPoint({
|
|
313
|
+
extensionPoint: 'notebooks',
|
|
314
|
+
jsonSchema: notebookProviderContribution,
|
|
315
|
+
activationEventsGenerator: (contribs, result) => {
|
|
316
|
+
for (const contrib of contribs) {
|
|
317
|
+
if (contrib.type) {
|
|
318
|
+
result.push(`onNotebookSerializer:${contrib.type}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}));
|
|
323
|
+
const notebookRendererExtensionPoint = ( ExtensionsRegistry.registerExtensionPoint({
|
|
324
|
+
extensionPoint: 'notebookRenderer',
|
|
325
|
+
jsonSchema: notebookRendererContribution,
|
|
326
|
+
activationEventsGenerator: (contribs, result) => {
|
|
327
|
+
for (const contrib of contribs) {
|
|
328
|
+
if (contrib.id) {
|
|
329
|
+
result.push(`onRenderer:${contrib.id}`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}));
|
|
334
|
+
const notebookPreloadExtensionPoint = ( ExtensionsRegistry.registerExtensionPoint({
|
|
335
|
+
extensionPoint: 'notebookPreload',
|
|
336
|
+
jsonSchema: notebookPreloadContribution,
|
|
337
|
+
}));
|
|
338
|
+
|
|
339
|
+
export { notebookPreloadExtensionPoint, notebookRendererExtensionPoint, notebooksExtensionPoint };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { onUnexpectedExternalError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
2
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
+
import { Disposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
|
|
5
|
+
class NotebookCellStatusBarService extends Disposable {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this._onDidChangeProviders = this._register(( new Emitter()));
|
|
9
|
+
this.onDidChangeProviders = this._onDidChangeProviders.event;
|
|
10
|
+
this._onDidChangeItems = this._register(( new Emitter()));
|
|
11
|
+
this.onDidChangeItems = this._onDidChangeItems.event;
|
|
12
|
+
this._providers = [];
|
|
13
|
+
}
|
|
14
|
+
registerCellStatusBarItemProvider(provider) {
|
|
15
|
+
this._providers.push(provider);
|
|
16
|
+
let changeListener;
|
|
17
|
+
if (provider.onDidChangeStatusBarItems) {
|
|
18
|
+
changeListener = provider.onDidChangeStatusBarItems(() => this._onDidChangeItems.fire());
|
|
19
|
+
}
|
|
20
|
+
this._onDidChangeProviders.fire();
|
|
21
|
+
return toDisposable(() => {
|
|
22
|
+
changeListener?.dispose();
|
|
23
|
+
const idx = this._providers.findIndex(p => p === provider);
|
|
24
|
+
this._providers.splice(idx, 1);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async getStatusBarItemsForCell(docUri, cellIndex, viewType, token) {
|
|
28
|
+
const providers = this._providers.filter(p => p.viewType === viewType || p.viewType === '*');
|
|
29
|
+
return await Promise.all(( providers.map(async (p) => {
|
|
30
|
+
try {
|
|
31
|
+
return (await p.provideCellStatusBarItems(docUri, cellIndex, token)) ?? { items: [] };
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
onUnexpectedExternalError(e);
|
|
35
|
+
return { items: [] };
|
|
36
|
+
}
|
|
37
|
+
})));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { NotebookCellStatusBarService };
|