Skip to content

Commit 0daeaf5

Browse files
authored
Merge pull request microsoft#187070 from microsoft/aamunger/notebookInfoRegistration2
just use the extension property to know if an editor needs to be registered
2 parents 56f97a4 + f5f7127 commit 0daeaf5

File tree

5 files changed

+6
-13
lines changed

5 files changed

+6
-13
lines changed

src/vs/workbench/contrib/interactive/browser/interactive.contribution.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,12 @@ export class InteractiveDocumentContribution extends Disposable implements IWork
8989
const info = notebookService.getContributedNotebookType('interactive');
9090

9191
// We need to contribute a notebook type for the Interactive Window to provide notebook models.
92-
// Don't add a file selector for the notebook type to avoid having the notebook Service create an editor for it.
93-
// The IW editor is registered below, and we don't want it overwritten by the notebook Service.
9492
if (!info) {
9593
this._register(notebookService.registerContributedNotebookType('interactive', {
9694
providerDisplayName: 'Interactive Notebook',
9795
displayName: 'Interactive',
9896
filenamePattern: ['*.interactive'],
99-
exclusive: true,
100-
externalEditor: true
97+
exclusive: true
10198
}));
10299
}
103100

src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,9 @@ export class NotebookProviderInfoStore extends Disposable {
279279
}
280280
this._contributedEditors.set(info.id, info);
281281
let editorRegistration: IDisposable | undefined;
282-
// Don't overwrite editor contributions if they come from elsewhere
283-
if (!info.externalEditor) {
282+
283+
// built-in notebook providers contribute their own editors
284+
if (info.extension) {
284285
editorRegistration = this._registerContributionPoint(info);
285286
this._contributedEditorDisposables.add(editorRegistration);
286287
}
@@ -640,8 +641,7 @@ export class NotebookService extends Disposable implements INotebookService {
640641
providerDisplayName: data.providerDisplayName,
641642
exclusive: data.exclusive,
642643
priority: RegisteredEditorPriority.default,
643-
selectors: [],
644-
externalEditor: !!data.externalEditor
644+
selectors: []
645645
});
646646

647647
info.update({ selectors: data.filenamePattern });

src/vs/workbench/contrib/notebook/common/notebookCommon.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,6 @@ export interface INotebookContributionData {
533533
displayName: string;
534534
filenamePattern: (string | glob.IRelativePattern | INotebookExclusiveDocumentFilter)[];
535535
exclusive: boolean;
536-
/// Editor contribution is handled elswhere e.g. interactive
537-
externalEditor?: boolean;
538536
}
539537

540538

src/vs/workbench/contrib/notebook/common/notebookProvider.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export interface NotebookEditorDescriptor {
2020
readonly priority: RegisteredEditorPriority;
2121
readonly providerDisplayName: string;
2222
readonly exclusive: boolean;
23-
readonly externalEditor?: boolean;
2423
}
2524

2625
export class NotebookProviderInfo {
@@ -31,7 +30,6 @@ export class NotebookProviderInfo {
3130
readonly priority: RegisteredEditorPriority;
3231
readonly providerDisplayName: string;
3332
readonly exclusive: boolean;
34-
readonly externalEditor: boolean;
3533

3634
private _selectors: NotebookSelector[];
3735
get selectors() {
@@ -59,7 +57,6 @@ export class NotebookProviderInfo {
5957
transientOutputs: false,
6058
cellContentMetadata: {}
6159
};
62-
this.externalEditor = !!descriptor.externalEditor;
6360
}
6461

6562
update(args: { selectors?: NotebookSelector[]; options?: TransientOptions }) {

src/vs/workbench/contrib/notebook/common/notebookService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export interface INotebookService {
7979
getNotebookTextModels(): Iterable<NotebookTextModel>;
8080
listNotebookDocuments(): readonly NotebookTextModel[];
8181

82+
/** Register a notebook type that we will handle. The notebook editor will be registered for notebook types contributed by extensions */
8283
registerContributedNotebookType(viewType: string, data: INotebookContributionData): IDisposable;
8384
getContributedNotebookType(viewType: string): NotebookProviderInfo | undefined;
8485
getContributedNotebookTypes(resource?: URI): readonly NotebookProviderInfo[];

0 commit comments

Comments
 (0)