Skip to content

Commit 3559536

Browse files
committed
enable turning off the variable provider
1 parent d072503 commit 3559536

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,12 @@
682682
"experimental"
683683
]
684684
},
685+
"python.REPL.provideVariables": {
686+
"default": true,
687+
"description": "%python.REPL.provideVariables.description%",
688+
"scope": "resource",
689+
"type": "boolean"
690+
},
685691
"python.testing.autoTestDiscoverOnSaveEnabled": {
686692
"default": true,
687693
"description": "%python.testing.autoTestDiscoverOnSaveEnabled.description%",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"python.pixiToolPath.description": "Path to the pixi executable.",
6666
"python.EnableREPLSmartSend.description": "Toggle Smart Send for the Python REPL. Smart Send enables sending the smallest runnable block of code to the REPL on Shift+Enter and moves the cursor accordingly.",
6767
"python.REPL.sendToNativeREPL.description": "Toggle to send code to Python REPL instead of the terminal on execution. Turning this on will change the behavior for both Smart Send and Run Selection/Line in the Context Menu.",
68+
"python.REPL.provideVariables.description": "Toggle to provide variables for the REPL variable view for the native REPL.",
6869
"python.tensorBoard.logDirectory.description": "Set this setting to your preferred TensorBoard log directory to skip log directory prompt when starting TensorBoard.",
6970
"python.tensorBoard.logDirectory.markdownDeprecationMessage": "Tensorboard support has been moved to the extension [Tensorboard extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.tensorboard). Instead use the setting `tensorBoard.logDirectory`.",
7071
"python.tensorBoard.logDirectory.deprecationMessage": "Tensorboard support has been moved to the extension Tensorboard extension. Instead use the setting `tensorBoard.logDirectory`.",

src/client/repl/variables/variablesProvider.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import {
1010
EventEmitter,
1111
Event,
1212
NotebookVariableProvider,
13+
Uri,
1314
} from 'vscode';
1415
import { VariableResultCache } from './variableResultCache';
1516
import { IVariableDescription } from './types';
1617
import { VariableRequester } from './variableRequester';
18+
import { getConfiguration } from '../../common/vscodeApis/workspaceApis';
1719

1820
export class VariablesProvider implements NotebookVariableProvider {
1921
private readonly variableResultCache = new VariableResultCache();
@@ -36,7 +38,9 @@ export class VariablesProvider implements NotebookVariableProvider {
3638
const notebook = this.getNotebookDocument();
3739
if (notebook) {
3840
this.executionCount += 1;
39-
this._onDidChangeVariables.fire(notebook);
41+
if (isEnabled()) {
42+
this._onDidChangeVariables.fire(notebook);
43+
}
4044
}
4145
}
4246

@@ -48,7 +52,7 @@ export class VariablesProvider implements NotebookVariableProvider {
4852
token: CancellationToken,
4953
): AsyncIterable<VariablesResult> {
5054
const notebookDocument = this.getNotebookDocument();
51-
if (token.isCancellationRequested || !notebookDocument || notebookDocument !== notebook) {
55+
if (!isEnabled() || token.isCancellationRequested || !notebookDocument || notebookDocument !== notebook) {
5256
return;
5357
}
5458

@@ -144,3 +148,7 @@ function getVariableResultCacheKey(uri: string, parent: Variable | undefined, st
144148
}
145149
return `${uri}:${parentKey}`;
146150
}
151+
152+
function isEnabled(resource?: Uri) {
153+
return getConfiguration('python', resource).get('REPL.provideVariables');
154+
}

0 commit comments

Comments
 (0)