From 5fea034fee96b02ca0ddde3b173cd63a2b9ca6f2 Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Thu, 8 Feb 2024 16:09:09 -0800 Subject: [PATCH] add language id, restrict to python (#15168) --- .../getVariableInfo/vscodeGetVariableInfo.py | 2 ++ src/notebooks/controllers/vscodeNotebookController.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pythonFiles/vscode_datascience_helpers/getVariableInfo/vscodeGetVariableInfo.py b/pythonFiles/vscode_datascience_helpers/getVariableInfo/vscodeGetVariableInfo.py index aa43a6d345f..5dbbccc61c0 100644 --- a/pythonFiles/vscode_datascience_helpers/getVariableInfo/vscodeGetVariableInfo.py +++ b/pythonFiles/vscode_datascience_helpers/getVariableInfo/vscodeGetVariableInfo.py @@ -69,6 +69,7 @@ def _VSCODE_getVariableDescriptions(varNames): **getVariableDescription(globals()[varName]), "root": varName, "propertyChain": [], + "language": "python", } for varName in varNames if varName in globals() @@ -103,6 +104,7 @@ def _VSCODE_getAllChildrenDescriptions(rootVarName, propertyChain, startIndex): "name": str(i), "root": rootVarName, "propertyChain": propertyChain + [i], + "language": "python", } for i in range ] diff --git a/src/notebooks/controllers/vscodeNotebookController.ts b/src/notebooks/controllers/vscodeNotebookController.ts index dfaa97b9ecb..3c113f0e9c7 100644 --- a/src/notebooks/controllers/vscodeNotebookController.ts +++ b/src/notebooks/controllers/vscodeNotebookController.ts @@ -213,7 +213,9 @@ export class VSCodeNotebookController implements Disposable, IVSCodeNotebookCont this.controller.interruptHandler = this.handleInterrupt.bind(this); this.controller.supportsExecutionOrder = true; this.controller.supportedLanguages = this.languageService.getSupportedLanguages(kernelConnection); - this.controller.variableProvider = new JupyterVariablesProvider(jupyterVariables, this.kernelProvider); + if (this.controller.supportedLanguages.includes('python')) { + this.controller.variableProvider = new JupyterVariablesProvider(jupyterVariables, this.kernelProvider); + } // Hook up to see when this NotebookController is selected by the UI this.controller.onDidChangeSelectedNotebooks(this.onDidChangeSelectedNotebooks, this, this.disposables); workspace.onDidCloseNotebookDocument(