mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 05:28:19 -05:00
notebooks: deprecate viewType for renderers, prefer renderer ID
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
],
|
||||
"notebookOutputRenderer": [
|
||||
{
|
||||
"viewType": "notebookCoreTestRenderer",
|
||||
"id": "notebookCoreTestRenderer",
|
||||
"displayName": "Notebook Core Test Renderer",
|
||||
"entrypoint": "./src/customRenderer.js",
|
||||
"mimeTypes": [
|
||||
|
||||
@@ -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]: {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user