diff --git a/extensions/vscode-notebook-tests/package.json b/extensions/vscode-notebook-tests/package.json index 3479ad57701..53ba12569a9 100644 --- a/extensions/vscode-notebook-tests/package.json +++ b/extensions/vscode-notebook-tests/package.json @@ -62,7 +62,7 @@ ], "notebookOutputRenderer": [ { - "viewType": "notebookCoreTestRenderer", + "id": "notebookCoreTestRenderer", "displayName": "Notebook Core Test Renderer", "entrypoint": "./src/customRenderer.js", "mimeTypes": [ diff --git a/src/vs/workbench/contrib/notebook/browser/extensionPoint.ts b/src/vs/workbench/contrib/notebook/browser/extensionPoint.ts index a2945c71589..f9b0f8bd14d 100644 --- a/src/vs/workbench/contrib/notebook/browser/extensionPoint.ts +++ b/src/vs/workbench/contrib/notebook/browser/extensionPoint.ts @@ -25,13 +25,15 @@ export interface INotebookEditorContribution { namespace NotebookRendererContribution { export const viewType = 'viewType'; + export const id = 'id'; export const displayName = 'displayName'; export const mimeTypes = 'mimeTypes'; export const entrypoint = 'entrypoint'; } export interface INotebookRendererContribution { - readonly [NotebookRendererContribution.viewType]: string; + readonly [NotebookRendererContribution.id]?: string; + readonly [NotebookRendererContribution.viewType]?: string; readonly [NotebookRendererContribution.displayName]: string; readonly [NotebookRendererContribution.mimeTypes]?: readonly string[]; readonly [NotebookRendererContribution.entrypoint]: string; @@ -94,18 +96,23 @@ const notebookProviderContribution: IJSONSchema = { const notebookRendererContribution: IJSONSchema = { description: nls.localize('contributes.notebook.renderer', 'Contributes notebook output renderer provider.'), type: 'array', - defaultSnippets: [{ body: [{ viewType: '', displayName: '', mimeTypes: [''] }] }], + defaultSnippets: [{ body: [{ id: '', displayName: '', mimeTypes: [''] }] }], items: { type: 'object', required: [ - NotebookRendererContribution.viewType, + NotebookRendererContribution.id, NotebookRendererContribution.displayName, NotebookRendererContribution.mimeTypes, NotebookRendererContribution.entrypoint, ], properties: { + [NotebookRendererContribution.id]: { + type: 'string', + description: nls.localize('contributes.notebook.renderer.viewType', 'Unique identifier of the notebook output renderer.'), + }, [NotebookRendererContribution.viewType]: { type: 'string', + deprecationMessage: nls.localize('contributes.notebook.provider.viewType.deprecated', 'Rename `viewType` to `id`.'), description: nls.localize('contributes.notebook.renderer.viewType', 'Unique identifier of the notebook output renderer.'), }, [NotebookRendererContribution.displayName]: { diff --git a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts index 7e0fb78f8aa..4fdbe29a434 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts @@ -293,8 +293,14 @@ export class NotebookService extends Disposable implements INotebookService, ICu continue; } + const id = notebookContribution.id ?? notebookContribution.viewType; + if (!id) { + console.error(`Notebook renderer from ${extension.description.identifier.value} is missing an 'id'`); + continue; + } + this.notebookRenderersInfoStore.add(new NotebookOutputRendererInfo({ - id: notebookContribution.viewType, + id, extension: extension.description, entrypoint: notebookContribution.entrypoint, displayName: notebookContribution.displayName, @@ -302,8 +308,6 @@ export class NotebookService extends Disposable implements INotebookService, ICu })); } } - - // console.log(this.notebookRenderersInfoStore); }); this._editorService.registerCustomEditorViewTypesHandler('Notebook', this);