(news)2022-04-12, we support vscode web extension, and you can install it when you use
Here is the project: https://github.com/corvofeng/Vsnips
ext install corvofeng.Vsnips
Allows you to use Ultisnips in vscode.
It is under development, although I can’t guarantee that all ultisnips functions can be used in vscode, I will try my best. Please feel free to give an issue or pull requests.
Please: refer to the docs: https://vsnips.corvo.fun/
For details of Ultisnips, please refer here.
It’s easy to write an UltiSnips snippets, for example, in
I usually use
import IPython; IPython.embed() for debugging.
And you could write snippts like this:
snippet dbg "Use IPython to debug"
The whole snippst is surrounded with
dbg is the triger, and
"Use IPython to debug" is
description for this snippet. This is what it looks like when you use the snippet:
VScode has it’s own implementation for snippets which lets you create your own. But I found it difficult to use and lacking in feature set, for example:
- If there is a multi-line snippet,
jsonis not very well for storing.
- It’s hard for many PC sync the snippets. Because of this, there is already too many snippet extensions for different languages, like, C/C++ Snippets, Bootstrap 3 Snippets.
I do not mean that it’s bad for different language having their own extension. But you must admit that if you want to add snippets for a language, you need to learn how to write an extension and how to add snippets. and what’s most important is that if you are an vimmer, you had to write snippets for these two editors, which bothers me.
This plugin based on the snippet api in VScode, whether you have used UltiSnips or not, it’s easy to start. I have adapted some UltiSnips snippets to VScode and used it by default.
If you have already use UltiSnips, and even have your own snippets,
you can add own snippets dir in settings, and use the variable in
to set that.
When you give the variable like
let g:snips_author="corvo", you could
use it like snippets below.
snippet full_title "Python title fully"
- Auto download the Ultisnips
- Multi language completions support
- Allow user add their own Ultisnips.
- From Ultisnips to VScode snippets.
- Support strftime
- Allow user define variables
- Syntax highlight for snippets
- Allow user define their own functions
- Support autoDocstring for Python and TypeScript.
- Add support for golang function comments.
- Support extends and priority in Ultisnips
The UltiSnips in vim could adjust the doc according to the
python function argument. But the Vsnips is based on VScode
CompletionItemProvider, it may be hard to support this feature.
So, I change to another solution, after the user triggers the keys like
Vsnips could auto-generate the doc for the functions,
Which will refer to autoDocstring.