问题
I've been using VSCode for a while and at the moment I am trying to set up snippets to work. They seem to work well with simple Python (.py) files but not with Jupyter Notebook (.ipynb) files. Is there any way to make them work together?
The snippet is right here:
"Create a new figure":{
"scope": "python",
"prefix": "nf",
"body": [
"plt.figure(figsize=(9, 9))",
"",
"$1",
"",
"plt.show()"
]
}
回答1:
I'm a developer on this extension. From the comments above it seems like the answer is already here. But just to put the official word in here. Currently our Notebook Editor is implemented as a custom webview with our own editor instances. Which means that while we have done our best to get lots of the look and feel right it's not really a part of much of the main VS Code editing ecosystem. So things like snippits, keybindings, extensions like the VIM extension and Ctrl-F search are all currently not a part of it. Were looking both at implementing some of those things ourselves as well as working with VS Code team to bring our stuff more into the VS Code editor experience. If you want to track the work on this I'd recommend following the github item here: https://github.com/microsoft/vscode-python/issues/7875
来源:https://stackoverflow.com/questions/59220447/how-do-i-use-snippets-for-jupyter-notebook-with-vscode