diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 968fb7f776d..e801af2c03c 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -223,6 +223,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I if (typeof filter.exclusive === 'boolean') { checkProposedApiEnabled(extension, 'documentFiltersExclusive'); } + if (typeof filter.notebookType === 'string') { + checkProposedApiEnabled(extension, 'notebookDocumentSelector'); + } } return selector; }; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 352e2b8c95a..13f03c1ecb2 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -336,6 +336,7 @@ export interface IDocumentFilterDto { scheme?: string; pattern?: string | IRelativePattern; exclusive?: boolean; + notebookType?: string; } export interface ISignatureHelpProviderMetadataDto { diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index f7f40cc4356..9c2420847da 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -148,7 +148,8 @@ export namespace DocumentSelector { language: selector.language, scheme: _transformScheme(selector.scheme, uriTransformer), pattern: GlobPattern.from(selector.pattern) ?? undefined, - exclusive: selector.exclusive + exclusive: selector.exclusive, + notebookType: selector.notebookType }; } diff --git a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts index f0abd29f5bc..7c02533c953 100644 --- a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts +++ b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts @@ -34,6 +34,7 @@ export const allApiProposals = Object.freeze({ notebookControllerKind: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookControllerKind.d.ts', notebookDebugOptions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDebugOptions.d.ts', notebookDeprecated: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDeprecated.d.ts', + notebookDocumentSelector: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookDocumentSelector.d.ts', notebookEditor: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditor.d.ts', notebookEditorDecorationType: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorDecorationType.d.ts', notebookEditorEdit: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts', diff --git a/src/vscode-dts/vscode.proposed.notebookDocumentSelector.d.ts b/src/vscode-dts/vscode.proposed.notebookDocumentSelector.d.ts new file mode 100644 index 00000000000..13f9c7919e6 --- /dev/null +++ b/src/vscode-dts/vscode.proposed.notebookDocumentSelector.d.ts @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +declare module 'vscode' { + + // https://github.com/microsoft/vscode/issues/141143 + + export interface DocumentFilter { + + /** + * The {@link NotebookDocument.notebookType type} of a notebook, like `jupyter` + */ + readonly notebookType?: string; + } +}