diff --git a/src/vs/workbench/contrib/interactive/browser/interactive.contribution.ts b/src/vs/workbench/contrib/interactive/browser/interactive.contribution.ts index 86bf90f9304..da64485f909 100644 --- a/src/vs/workbench/contrib/interactive/browser/interactive.contribution.ts +++ b/src/vs/workbench/contrib/interactive/browser/interactive.contribution.ts @@ -89,15 +89,12 @@ export class InteractiveDocumentContribution extends Disposable implements IWork const info = notebookService.getContributedNotebookType('interactive'); // We need to contribute a notebook type for the Interactive Window to provide notebook models. - // Don't add a file selector for the notebook type to avoid having the notebook Service create an editor for it. - // The IW editor is registered below, and we don't want it overwritten by the notebook Service. if (!info) { this._register(notebookService.registerContributedNotebookType('interactive', { providerDisplayName: 'Interactive Notebook', displayName: 'Interactive', filenamePattern: ['*.interactive'], - exclusive: true, - externalEditor: true + exclusive: true })); } diff --git a/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.ts b/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.ts index 6afedbfff8e..0c82eb7cb7f 100644 --- a/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.ts +++ b/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.ts @@ -279,8 +279,9 @@ export class NotebookProviderInfoStore extends Disposable { } this._contributedEditors.set(info.id, info); let editorRegistration: IDisposable | undefined; - // Don't overwrite editor contributions if they come from elsewhere - if (!info.externalEditor) { + + // built-in notebook providers contribute their own editors + if (info.extension) { editorRegistration = this._registerContributionPoint(info); this._contributedEditorDisposables.add(editorRegistration); } @@ -640,8 +641,7 @@ export class NotebookService extends Disposable implements INotebookService { providerDisplayName: data.providerDisplayName, exclusive: data.exclusive, priority: RegisteredEditorPriority.default, - selectors: [], - externalEditor: !!data.externalEditor + selectors: [] }); info.update({ selectors: data.filenamePattern }); diff --git a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts index f9df8c3c694..e57bc24b374 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts @@ -533,8 +533,6 @@ export interface INotebookContributionData { displayName: string; filenamePattern: (string | glob.IRelativePattern | INotebookExclusiveDocumentFilter)[]; exclusive: boolean; - /// Editor contribution is handled elswhere e.g. interactive - externalEditor?: boolean; } diff --git a/src/vs/workbench/contrib/notebook/common/notebookProvider.ts b/src/vs/workbench/contrib/notebook/common/notebookProvider.ts index 8345ef61981..16a9ee3a57b 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookProvider.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookProvider.ts @@ -20,7 +20,6 @@ export interface NotebookEditorDescriptor { readonly priority: RegisteredEditorPriority; readonly providerDisplayName: string; readonly exclusive: boolean; - readonly externalEditor?: boolean; } export class NotebookProviderInfo { @@ -31,7 +30,6 @@ export class NotebookProviderInfo { readonly priority: RegisteredEditorPriority; readonly providerDisplayName: string; readonly exclusive: boolean; - readonly externalEditor: boolean; private _selectors: NotebookSelector[]; get selectors() { @@ -59,7 +57,6 @@ export class NotebookProviderInfo { transientOutputs: false, cellContentMetadata: {} }; - this.externalEditor = !!descriptor.externalEditor; } update(args: { selectors?: NotebookSelector[]; options?: TransientOptions }) { diff --git a/src/vs/workbench/contrib/notebook/common/notebookService.ts b/src/vs/workbench/contrib/notebook/common/notebookService.ts index 2024a6fb925..6614adc8fbf 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookService.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookService.ts @@ -79,6 +79,7 @@ export interface INotebookService { getNotebookTextModels(): Iterable; listNotebookDocuments(): readonly NotebookTextModel[]; + /** Register a notebook type that we will handle. The notebook editor will be registered for notebook types contributed by extensions */ registerContributedNotebookType(viewType: string, data: INotebookContributionData): IDisposable; getContributedNotebookType(viewType: string): NotebookProviderInfo | undefined; getContributedNotebookTypes(resource?: URI): readonly NotebookProviderInfo[]; diff --git a/src/vs/workbench/services/extensions/common/extensions.ts b/src/vs/workbench/services/extensions/common/extensions.ts index 436f780bd00..cb18e8ac6f3 100644 --- a/src/vs/workbench/services/extensions/common/extensions.ts +++ b/src/vs/workbench/services/extensions/common/extensions.ts @@ -260,7 +260,8 @@ function extensionDescriptionArrayToMap(extensions: IExtensionDescription[]): Ex } export function isProposedApiEnabled(extension: IExtensionDescription, proposal: ApiProposalName): boolean { - if (!extension.enabledApiProposals) { + if (!extension. + enabledApiProposals) { return false; } return extension.enabledApiProposals.includes(proposal);