Skip to content

Commit e10370b

Browse files
committed
add defensive handling of vscode api proposal usage
1 parent dab37cb commit e10370b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/notebooks/controllers/vscodeNotebookController.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,19 @@ export class VSCodeNotebookController implements Disposable, IVSCodeNotebookCont
173173
displayDataProvider
174174
);
175175

176-
try {
177-
controller.controller.variableProvider = jupyterVairablesProvider;
178-
} catch (ex) {
179-
logger.warn('Failed to attach variable provider', ex);
176+
// Only attach variable provider if the API is available
177+
// The notebookVariableProvider is a proposed API that:
178+
// - Works in extension development mode (F5 debugging)
179+
// - Does NOT work in published extensions from the Marketplace
180+
// - Requires users to manually enable it with --enable-proposed-api flag
181+
// See: https://code.visualstudio.com/api/advanced-topics/using-proposed-api
182+
// This check allows the extension to gracefully degrade when the API is unavailable
183+
if ('variableProvider' in controller.controller) {
184+
try {
185+
controller.controller.variableProvider = jupyterVairablesProvider;
186+
} catch (ex) {
187+
logger.warn('Failed to attach variable provider', ex);
188+
}
180189
}
181190

182191
return controller;

0 commit comments

Comments
 (0)