Raw code cells should not execute
jamesdbrock opened this issue · 12 comments
Raw code cells should not execute. I can see that raw cells don't execute when using the IPython kernel, but raw cells do execute when using the IHaskell kernel. Why does the kernel matter? Raw cells should not be sent to the kernel at all for execution.
There has been a whole series of Issues and PRs opened for this problem and they all get closed so it’s hard to track this issue. It looks like the most recent PR is #9634 .
Environment data
Version: 1.67.2
Commit: c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
Date: 2022-05-17T18:23:40.286Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Linux x64 5.17.12-300.fc36.x86_64
- Jupyter Extension version (available under the Extensions sidebar): v2022.4.1021342353
- Python Extension version (available under the Extensions sidebar): v2022.6.3
- OS (Windows | Mac | Linux distro) and version: Fedora 36
- Jupyter server running: Local
Expected behaviour
Raw IHaskell code cells don’t execute
Actual behaviour
Raw IHaskell code cells execute
Thanks for the issue. We likely have a bug in when we check for execution of raw cells.
Maybe this is because the IHaskell kernel must explicitly support 'raw' cells
Okay so how do I get the IHaskell kernel to “say” that it supports 'raw' languages?
It looks like we have to return the right answer to this function:
vscode-jupyter/src/notebooks/languages/cellLanguageService.ts
Lines 55 to 69 in 3c58033
It looks like getSupportedLanguages ultimately goes to
vscode-jupyter/src/kernels/helpers.ts
Lines 444 to 458 in 3c58033
which gets the language attribute in the kernelSpec from kernel.json.
language attribute in the kernelSpec is a string, but getSupportedLanguages returns a string[].
So how can we return multiple languages like ["haskell", "raw"] from our kernel.json?
Hi @DonJayamanne thanks for replying.
I'm referring there to the comment by @rchiodo in #1611 (comment) in which he wrote
It's a function of the supportedLanguages that a kernel says it supports.
We give back 'raw' here:
Here's our list:
So the Julia extension has to support 'raw' in their list of languages for the Julia kernel.
So I take this to mean that the IHaskell kernel must somehow “say” that it supports 'raw' code cells, and then vscode-jupyter will allow 'raw' cells in the IHaskell notebooks.
(weird, Github seems to have timestamped your comment in the future @DonJayamanne , so it appears after my reply.)
“commented in 3 minutes” lol
thanks for getting back I'm a little confused.
please bear with me, but reading at the following two statements,
Expected behaviour
Raw IHaskell code cells don’t execute
&
Okay so how do I get the IHaskell kernel to “say” that it supports 'raw' languages?
seem contradictory.
do you want cells with language raw to be executed by the kernel? i thought you didn't.
I'm in a different times zone
again thanks for the update
still not sure, let's ignore what was said in the past, and the technical details and focus on what you need.
do you want the raw cells to get executed or not executed?
let's ignore what was said in the past, and the technical details and focus on what you need.
This is how raw cells are supposed to work. https://jupyter-notebook.readthedocs.io/en/stable/notebook.html#raw-cells
I want the raw cells the work like that. With the IHaskell kernel.
The current situation is that with the IHaskell kernel in VSCode Jupyter,
- notebooks with raw cells opened in VSCode will try to execute the raw cells as Haskell cells.
- notebooks created in VSCode will be unable to create new raw cells.
If you want to see an example of raw code cells not working, try this Visual Studio Code devcontainer.
And I am willing to make changes to the IHaskell kernel to get raw cells working. I would like some advice on what changes, if any, need to be made to the IHaskell kernel.
I understand the problem now, will submit a PR to fix this.
