diff --git a/extensions/vscode-api-tests/package.json b/extensions/vscode-api-tests/package.json index da178fb01ae..dcdd8b608a9 100644 --- a/extensions/vscode-api-tests/package.json +++ b/extensions/vscode-api-tests/package.json @@ -119,7 +119,7 @@ ], "notebooks": [ { - "viewType": "notebookCoreTest", + "type": "notebookCoreTest", "displayName": "Notebook Core Test", "selector": [ { @@ -129,7 +129,7 @@ ] }, { - "viewType": "notebook.nbdtest", + "type": "notebook.nbdtest", "displayName": "notebook.nbdtest", "selector": [ { @@ -138,7 +138,7 @@ ] }, { - "viewType": "notebook.nbdserializer", + "type": "notebook.nbdserializer", "displayName": "notebook.nbdserializer", "selector": [ { diff --git a/extensions/vscode-notebook-tests/package.json b/extensions/vscode-notebook-tests/package.json index 6a0e2d648de..cc0264bb1a3 100644 --- a/extensions/vscode-notebook-tests/package.json +++ b/extensions/vscode-notebook-tests/package.json @@ -36,7 +36,7 @@ ], "notebooks": [ { - "viewType": "notebookSmokeTest", + "type": "notebookSmokeTest", "displayName": "Notebook Smoke Test", "selector": [ { @@ -60,7 +60,7 @@ "notebook/cell/title": [ { "command": "vscode-notebook-tests.debugAction", - "when": "notebookViewType == notebookSmokeTest", + "when": "notebookType == notebookSmokeTest", "group": "inline@1" } ] diff --git a/src/vs/workbench/contrib/notebook/browser/extensionPoint.ts b/src/vs/workbench/contrib/notebook/browser/extensionPoint.ts index 9db9e5c5991..3e827183b54 100644 --- a/src/vs/workbench/contrib/notebook/browser/extensionPoint.ts +++ b/src/vs/workbench/contrib/notebook/browser/extensionPoint.ts @@ -10,8 +10,6 @@ import { NotebookEditorPriority, NotebookRendererEntrypoint, RendererMessagingSp namespace NotebookEditorContribution { export const type = 'type'; - /** @deprecated use type */ - export const viewType = 'viewType'; export const displayName = 'displayName'; export const selector = 'selector'; export const priority = 'priority'; @@ -19,16 +17,13 @@ namespace NotebookEditorContribution { export interface INotebookEditorContribution { readonly [NotebookEditorContribution.type]: string; - /** @deprecated use type */ - readonly [NotebookEditorContribution.viewType]: string; readonly [NotebookEditorContribution.displayName]: string; readonly [NotebookEditorContribution.selector]?: readonly { filenamePattern?: string; excludeFileNamePattern?: string; }[]; readonly [NotebookEditorContribution.priority]?: string; } namespace NotebookRendererContribution { - /** @deprecated use type */ - export const viewType = 'viewType'; + export const id = 'id'; export const displayName = 'displayName'; export const mimeTypes = 'mimeTypes'; @@ -40,8 +35,6 @@ namespace NotebookRendererContribution { export interface INotebookRendererContribution { readonly [NotebookRendererContribution.id]?: string; - /** @deprecated use type */ - readonly [NotebookRendererContribution.viewType]?: string; readonly [NotebookRendererContribution.displayName]: string; readonly [NotebookRendererContribution.mimeTypes]?: readonly string[]; readonly [NotebookRendererContribution.entrypoint]: NotebookRendererEntrypoint; @@ -66,10 +59,6 @@ const notebookProviderContribution: IJSONSchema = { type: 'string', description: nls.localize('contributes.notebook.provider.viewType', 'Type of the notebook.'), }, - [NotebookEditorContribution.viewType]: { - type: 'string', - deprecationMessage: nls.localize('viewType.deprecated2', 'Rename `viewType` to `type`.'), - }, [NotebookEditorContribution.displayName]: { type: 'string', description: nls.localize('contributes.notebook.provider.displayName', 'Human readable name of the notebook.'), @@ -125,11 +114,6 @@ const notebookRendererContribution: IJSONSchema = { 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]: { type: 'string', description: nls.localize('contributes.notebook.renderer.displayName', 'Human readable name of the notebook output renderer.'), diff --git a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts index baa92c9de3c..a85a27938d0 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts @@ -94,9 +94,20 @@ export class NotebookProviderInfoStore extends Disposable { for (const extension of extensions) { for (const notebookContribution of extension.value) { + + if (!notebookContribution.type) { + extension.collector.error(`Notebook does not specify type-property`); + continue; + } + + if (this.get(notebookContribution.type)) { + extension.collector.error(`Notebook type '${notebookContribution.type}' already used`); + continue; + } + this.add(new NotebookProviderInfo({ extension: extension.description.identifier, - id: notebookContribution.type || notebookContribution.viewType, + id: notebookContribution.type, displayName: notebookContribution.displayName, selectors: notebookContribution.selector || [], priority: this._convertPriority(notebookContribution.priority), @@ -353,7 +364,7 @@ export class NotebookService extends Disposable implements INotebookService { continue; } - const id = notebookContribution.id ?? notebookContribution.viewType; + const id = notebookContribution.id; if (!id) { extension.collector.error(`Notebook renderer does not specify id-property`); continue;