adopt viewType everywhere and drop support for it, fixes https://github.com/microsoft/vscode/issues/125163

This commit is contained in:
Johannes Rieken 2021-06-02 12:05:19 +02:00
parent b1e613481b
commit 109c9d9486
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798
4 changed files with 19 additions and 24 deletions

View file

@ -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": [
{

View file

@ -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"
}
]

View file

@ -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.'),

View file

@ -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;