DonJayamanne / typescript-notebook

Run JavaScript and TypeScript in node.js within VS Code notebooks with excellent support for debugging, tensorflowjs visulizations, plotly, danfojs, etc
https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook
MIT License
905 stars 40 forks source link

JSON and vars issues #10

Closed RandomFractals closed 3 years ago

RandomFractals commented 3 years ago

Great extension. However, I ran into a few issues with it.

  1. I can't use JSON.parse to parse json data. I get an error that JSON is not found.
  2. Cell vars are local? I get an error for the csvString var in my test notebook, even tho I can see csv data ouput:

see this ticket in my data table renderer repo for more info: https://github.com/RandomFractals/vscode-data-table/issues/27

ts-json-data-notebook

csv-data-output

RandomFractals commented 3 years ago

btw, I was able to put together a decent example with this extension: https://github.com/RandomFractals/vscode-data-table#typescript-notebook-example

Would be nice if JSON.parse worked to take it further.

DonJayamanne commented 3 years ago

Hmm, i think this is a bug in the jupyter extension, let me check.

DonJayamanne commented 3 years ago

Please could you check what version of tslab is installed. tslab --version. I am unable to repro the issue

RandomFractals commented 3 years ago

I ran it with the latest tslab v1.0.15, which I installed globally with npm install -g tslab

RandomFractals commented 3 years ago

I am unable to repro the issue

I just tried with the latest insiders v. Same results:

image

Version: 1.59.0-insider (user setup) Commit: 9520f0a515e7e24802c92f885a0efb242fca3831 Date: 2021-07-14T07:15:41.024Z Electron: 13.1.6 Chrome: 91.0.4472.124 Node.js: 14.16.0 V8: 9.1.269.36-electron.0

also, would be good to see this extension integrated with Jupyter: Variables view (see above) per #8

RandomFractals commented 3 years ago

the same results in the latest vscode stable Version: 1.58.1 (user setup) Commit: 2aeda6b18e13c4f4f9edf6667158a6b8d408874b Date: 2021-07-13T06:58:28.115Z Electron: 12.0.13 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0

Note that your TS cell does recognize JSON.parse as a valid method:

image

DonJayamanne commented 3 years ago

Ok, I can see similar issues at my end when dealing with arrays. I think this is a problem with tslab (kernel).

DonJayamanne commented 3 years ago

Closing this issue, as this is caused by the tslab kernel. Please report this issue here https://github.com/yunabe/tslab