vscode-jupyter: pressing arrow key when editing code cell sometimes doesn't work
Applies To
- Notebooks (.ipynb files)
- Interactive Window and/or Cell Scripts (.py files with #%% markers)
What happened?
Not sure how the issue is triggered, it just happened when using notebook:
- arrow key doesn’t work anymore (typing still works)
- up/down when “accross-the-cell” still works (from “frozen cell” to another cell)
- change it to markdown then it works fine; then changing back arrow key again stops working;
- pasting contents to a new cell - it depends on where the new cell is created, and seems is not related to the content itself.
I feel It’s possible that it’s because of other extensions. I will have a try disabling some.
Below is an illustration when I hold arrow down/up:
VS Code Version
1.77.0
Jupyter Extension Version
v2023.3.1000892223
Jupyter logs
(seems nothing related. the last lines are:)
info 16:49:35.053: Cancel all remaining cells true || Error || undefined
info 10:24:44.793: Cancel all remaining cells true || Error || undefined
info 10:29:40.538: Cancel all remaining cells true || Error || undefined
info 10:30:30.891: Cancel all remaining cells true || Error || undefined
info 10:30:39.537: Cancel all remaining cells true || Error || undefined
Coding Language and Runtime Version
No response
Language Extension Version (if applicable)
No response
Anaconda Version (if applicable)
No response
Running Jupyter locally or remotely?
Remote
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 15
- Comments: 55 (7 by maintainers)
Links to this issue
Commits related to this issue
- Fix microsoft/vscode-jupyter#12738, microsoft/vscode-jupyter#13263. Update editor context on markdown preview. — committed to microsoft/vscode by rebornix a year ago
- vscode: Fix microsoft/vscode-jupyter#12738, microsoft/vscode-jupyter#13263. Update editor context on markdown preview. (#179569) Commit: 7f03ec6f7a48791d8027761b22773b454fc52478 — committed to sgtest/megarepo by deleted user a year ago
- Fix microsoft/vscode-jupyter#12738, microsoft/vscode-jupyter#13263. Update editor context on markdown preview. (#179569) — committed to microsoft/vscode by rebornix a year ago
I have been struggling with this problem for weeks, specifically in certain cells. Even after deleting and recreating those cells, the issue persisted in that particular cell, which was quite frustrating.
However, I found a workaround that seems to work. It involves hovering over a method in the affected cell, clicking in the documentation window, and then pressing the arrow keys. By doing so, the arrow keys start functioning properly.
I hope this solution proves helpful in your situation.
This issue still exists in 1.78
I figured out one way to reproduce this issue:
https://github.com/microsoft/vscode-jupyter/assets/876920/0cc7497b-5578-4f1a-b110-a836ad096109
@aiday-mar we need to figure out how to update the context key in this scenario.
Please fix this, its incredibly annoying, I do not think this is a duplicate of https://github.com/microsoft/vscode-jupyter/issues/12738 since that describes moving between cells not moving the cursor within a cell.
You can run the command “Toggle keyboard shortcuts troubleshooting” to get some details on what is happening when you press the arrow key, and it might point you towards an extension or a bad context key
This issue should now be fixed in latest VS Code Insiders and will be available in next week’s Stable release. Thank you everyone for your patience and valuable troubleshooting tips.
Added two more (removal key binding rules) to manually fix this issue for Home and End keys. Likely need to do the same if you use CTRL+UP or CTRL+DOWN for keyboard navigation.
{ “key”: “home”, “command”: “-editor.action.goToTopHover”, “when”: “editorHoverFocused” }, { “key”: “end”, “command”: “-editor.action.goToBottomHover”, “when”: “editorHoverFocused” },
Having same issue still in 1.78.1. Used suggestion by @lambertae to remove keybindings (for editor.action.scrollXHover) and it solved it for me. Here’s how I did it by removing the troublesome keybinding without modifying default keybindings:
command
value.{ “key”: “down”, “command”: “-editor.action.scrollDownHover”, “when”: “editorHoverFocused” }, { “key”: “left”, “command”: “-editor.action.scrollLeftHover”, “when”: “editorHoverFocused” }, { “key”: “right”, “command”: “-editor.action.scrollRightHover”, “when”: “editorHoverFocused” }, { “key”: “up”, “command”: “-editor.action.scrollUpHover”, “when”: “editorHoverFocused” },
Still happening here:
Version: 1.78.0 Commit: 252e5463d60e63238250799aef7375787f68b4ee Date: 2023-05-03T20:15:29.774Z Electron: 22.4.8 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Darwin arm64 22.4.0 Sandboxed: No
So the issue is marked ‘closed’, but the fix isn’t in the current stable release, and the time line for the next stable release version is unknown?
Thank you for your feedbacks. The fix was not shipped in 1.77.3 but is available in Insiders and also the next 1.78 stable.
I have the same problem, I don’t know how to replicate it, but apparently it happens to me sometime after using the “home” / “end” or “shift+home” / “shift+end” keys
VS Code Version
1.77.3
Jupyter Extension Version
v2023.3.1201040234
In the latest
1.78.1
. This makesvs-code
close to be unusable for notebooks. Also, this bug didn’t exist a few months ago.Thank you all for the detailed reproduce steps and analysis. The arrow key is very hijacked by
editor.action.scroll*Hover
command whose context keys might not be updated properly. cc @aiday-marI have a workaround - Hover over a variable or a function and click on the hovered window press escape and arrows are back
Pressing Ctrl+K and Ctrl+I twice, to enter and exit hover mode, seems to work around this issue if you run into it. (or command+K, command+I on mac)
Do that! I hope it helps 😃
This is indeed an extremely annoying problem. It’s hard to believe that such basic functionality failure was allowed to go on for such a long time.
According to April 2023 Endgame #180716, 1.78 is expected to be released somewhere early next week (May 1-3).
For me left arrow resolves to this:
instead of cursorLeft
This worked for me. But as he said is a workaround. It would be nice if this behavior is fixed
Yes try unbinding
scroll hover
as suggested above.1.78.2
v2023.4.1011241018
I face this issue/bug for 1~2 months.
glad to hear this is getting looked into! To add to the temporary fixes people already suggested I also added this to make the escape key work:
changing the default setting is undesirable for such a fundamental feature (arrow keys in an editor).
nevertheless, please post the text of the above image.
Thank you!
The problem is still happening, vscode 1.78.0
Same as @mapio and @Vulwsztyn on 1.78. Left, Right, Up, Down resolves in the degger to: