Open
Description
Applies To
- Notebooks (.ipynb files)Interactive Window and/or Cell Scripts (.py files with #%% markers)
What happened?
- Create a Markdown cell with an
tag referring to a non-existing path, e.g.
<img src="myimg.png">
. - Execute the cell. A "broken image" icon appears.
- Create the image at the specified path.
- Click the cell to edit. Re-execute it (without making any changes).
Expected result: the image is now shown.
Actual result: still shows a broken image icon. (The image is only shown after making a change to the cell itself.)
VS Code Version
1.67.2
Jupyter Extension Version
v2022.4.1021342353
Jupyter logs
No response
Coding Language and Runtime Version
Markdown
Language Extension Version (if applicable)
No response
Anaconda Version (if applicable)
No response
Running Jupyter locally or remotely?
Local
Activity
greazer commentedon Jun 2, 2022
Markdown is vscode core.
danilhendrasr commentedon Jun 11, 2022
Can I take a shot at this?
IdoHartuv commentedon Jun 13, 2022
I noticed that if we do the opposite action - show the existing image, delete the file and re-execute the cell again when the image file does not exist - the results are the same. The image is still shown like before.
After refreshing the window, or after closing and reopening the .ipynb file tab, the cell is being updated.
Maybe it is related to some cache saved in the cell we can reset each time the cell is being executed.
Eliiia commentedon Jun 14, 2022
i'd love to try this as my first open source contribution, but i have no clue where to even start looking. if someone can point me to a file or even a directory that is used for the rendering of
.ipynb
markdown, itd be very appreciated!mjbvz commentedon Jun 15, 2022
We have logic to not re-render unchanged markdown cells:
vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts
Line 1036 in 0dfe96e
This is correct if the user presses
esc
to cancel the current edit. However if they pressrun
/enter
, perhaps we need to force a re-renderdanilhendrasr commentedon Jun 15, 2022
Sorry @Eliiia, I know you're looking forward to your first open source contribution, but mind if I take this? Since I proposed to work on it first.
Eliiia commentedon Jun 15, 2022
@danilhendrasr absolutely, go ahead :)
danilhendrasr commentedon Jun 21, 2022
Sorry it took quite a while for an update, I'm new to vscode's code base so I need some time to understand parts of it.
However I'm still not sure how to approach this best. At the moment I'm thinking of creating a new command (probably
notebook.cell.finishEdit
) which fires when user pressesctrl+enter
or click the menu, meanwhile leaving thenotebook.cell.quitEdit
command to only fire when user pressesesc
.What do you think? @mjbvz
mjbvz commentedon Jun 21, 2022
@danilhendrasr One idea:
The cell's text model has an internal
_versionId
property (along with some ids and other fields)vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts
Line 148 in 9c81058
Try checking to see if these change when the cell is executed (compared to being canceled). If they do, we can base re-rendering on when the version changes instead of when the text content itself changes
danilhendrasr commentedon Jun 22, 2022
It doesn't.
It seems that
_versionId
only get incremented every time there's a change to the cell content during edit mode (i.e. when user press a button on their keyboard) regardless of whether the end result of the edit is the same as the previous content or not.It doesn't get incremented if the user edits the cell then immediately quit editing regardless of by hitting
Esc
orCtrl+Enter
.yashdev9274 commentedon Aug 7, 2022
is this issue still open?
yashdev9274 commentedon Aug 7, 2022
can anyone tell me how can i help
danilhendrasr commentedon Aug 8, 2022
There's already a PR for this, see #155268, it's already on the August milestone.
yashdev9274 commentedon Aug 8, 2022
thank you @danilhendrasr for mentioning , are you working on any project currently which I can help to contribute
My tech stack is MERN stack and ML , please let me know .
I want to start my open source journey but I have no one to guide me , if you can guide me than I will be able to improve my developing skills with open source and can get a job