microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.25k stars 276 forks source link

Variable View stucks on 'Loading variables' when using 'autotime' #10933

Open FakeTrader opened 1 year ago

FakeTrader commented 1 year ago

Applies To

What happened?

autotime is used for displaying execution time. Package link: jupyter-autotime or ipython-autotime

%load_ext autotime
...

Variable View will stuck on `Loading variables'

VS Code Version

1.69.2

Jupyter Extension Version

2022.6.1201981810

Jupyter logs

info 16:4:47.315: Executing silently Code (completed) = def _VSCODE_getVariable(what_to_get, is_debugging, *args):\n# Query Jupyter server for the info with 1 output(s)
error 16:4:47.316: Jupyter Extension (Error in requestVariables, method:requestVariables): SyntaxError: Unexpected token t in JSON at position 232
    at JSON.parse (<anonymous>)
    at g.deserializeJupyterResult (/Users/whan/.vscode/extensions/ms-toolsai.jupyter-2022.6.1201981810/out/extension.node.js:24:299353)
    at getVariableNamesAndTypesFromKernel (/Users/whan/.vscode/extensions/ms-toolsai.jupyter-2022.6.1201981810/out/extension.node.js:24:297859)
    at S.getVariablesBasedOnKernel (/Users/whan/.vscode/extensions/ms-toolsai.jupyter-2022.6.1201981810/out/extension.node.js:24:288842)

Coding Language and Runtime Version

Python v3.9.13

Language Extension Version (if applicable)

v2022.10.1

Anaconda Version (if applicable)

4.13.0

Running Jupyter locally or remotely?

Local

rchiodo commented 1 year ago

Thanks for the issue. autotime breaks the variable window because we parse the output from executing a cell and we don't expect the extra time: n ms.