Open chmielcode opened 2 years ago
Thanks for filing this issue. I'm unable to repro this at my end. Please could you capture a screen recording of this and upload it. You could try using gifcap.dev or the like to capture a gif.
I press shift+enter after I type "1" in each line in the first cell. With the second "1" I wasn't quick enough, so it actually executed the cell.
In the second cell i press shift+enter after every couple of characters (I hope you can see the short pauses) and then move the cursor a little bit to the left to get the unexpected syntax error.
I have encountered this as well. I also have an issue which might be related where I need to execute higher up cells to proceed.
>>>python -VV
Python 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:38:57) [GCC 10.3.0]
>>> code -v
1.66.2
dfd34e8260c270da74b5c2d86d61aee4b6d56977
x64
>>> code --list-extensions --show-versions | grep -E 'python|jupyter'
ms-python.python@2022.5.11161003
ms-python.vscode-pylance@2022.4.2
ms-toolsai.jupyter@2022.3.1000901801
ms-toolsai.jupyter-keymap@1.0.0
ms-toolsai.jupyter-renderers@1.0.6
I still can reproduce this bug with the latest release (Jupyter v2022.4.1001271738, VSCode 1.67).
About the unexpected syntax error after editing a string literal I've noticed, that just the last character is lost. Let's say I have already executed...
"""some text"""
...then added "x" in the middle and quickly tried to execute the cell again.
"""some x text"""
The result will be:
Input In [28]
"""some x text""
^
SyntaxError: incomplete input
So "" instead of """.
print("xx") -> print("xx"' etc.
No change with current vscode/jupyter/python releases.
@chmielcode Have you tried enabling code lens?
Seemingly with the code lens enable this isn't happening.
@daylinmorgan Unfortunately I see no difference with code lens enabled.
Type "abc", but not press shift+enter too quickly.
#%%
"abc"
'abc'
Add space between b and c and immediately click shift+enter
#%%
"ab c"
Input In [2] "ab c ^ SyntaxError: unterminated string literal (detected at line 2)
@chmielcode - are you still seeing this issue? No one on the team has experienced this but we can still try and look for race conditions that might cause this if it's still occurring
@amunger yes, still the same.
Applies To
What happened?
When I try to "Run current cell" just after I stop typing nothing happens.
To reproduce the problem place a new cell marker (#%%), start interactive window, wait for it to load, add another cell with any content...
...and finally press shift+enter (Jupyter: Run current cell) quickly (<~1s) after typing "1". It is enough to press backspace, type e.g. "2" and hit shift+enter to see it again.
Usually pressing shift+enter again after a small delay will work as intended, but sometimes it doesn't for another second or two or it sends whatever is before the current cursor position causing sytax errors.
To see the "whatever is before the current cursor position" behaviour repeat the steps mentioned above, but keep editing a string literal before pressing shift+enter.
I observe the same thing for small files with one cell only and large ones with thousands of lines of code and hunderds of cells. I tried to disable "Jupyter Keymap" extension and remove all other relevant "shift+enter" keybindings, but nothing worked.
It's been happening for a couple of weeks now and it's really hard for me to tell, which update (Python, Pylance, Jupyter or VSCode) introduced this bug. I encounter it multiple times every day and it forces me to read exception messages to find out whether it's my code's fault or I simply clicked shift+enter to quickly.
VS Code Version
1.66.2
Jupyter Extension Version
v2022.3.1000901801
Jupyter logs
Coding Language and Runtime Version
Python 3.10.4
Language Extension Version (if applicable)
Python v2022.4.1
Anaconda Version (if applicable)
No response
Running Jupyter locally or remotely?
Local