3

I added a shortcut in vscode to insert a small pattern in my code:

{
    "key": "ctrl+alt+z",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": {
        "snippet": "#ZZZ ${1:comment}"
    }
}

This shortcut perfectly works in all "normal" files but I want to use it in a jupyter notebook (*.ipynb). I therefore opened it in VSCode and it is now read in Notebook mode (which is fine as I want to execute it). The shortcut then doesn't work. Any clue?

I checked, it isn't used in Default keybindings.

Version of VSCode 1.40.2

kogexo
  • 53
  • 6
  • Related to the snippets issue: [How do I use snippets for Jupyter Notebook with VSCode?](https://stackoverflow.com/q/59220447/2745495) – Gino Mempin Feb 24 '20 at 05:49

1 Answers1

0

It is not possible to use user snippets in the Jupyter extension (yet), as a workaround you can however use interactive python, it offers almost a similar experience.

When you write # %% in a normal .py file this is like opening a new Jupyter cell. You can convert a Jupyter notebook into a python file and it will use interactive python. There you will be able to use your snippets.