npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vsnips

v0.2.4

Published

Ultisnips for vscode

Downloads

2

Readme

Vsnips

Build Status

中文文档

Allow user 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.

ext install corvofeng.Vsnips

Vsnips

UltiSnips

For details of Ultisnips, please refer here.

ultisnips.

It's easy to write an UltiSnips sippets, for example, in Python, I usually use import IPython; IPython.embed() for debugging. And you could write snippts like this:

# Atention, this code must be put in python.snippets for `Python` code.
snippet dbg "Use IPython to debug"
# ---------- XXX: Can't GIT add [START] ---------- #
import IPython
IPython.embed(using=False)
# ---------- XXX: Can't GIT add  [END]  ---------- #
endsnippet

The UltiSnips snippet bej snippet, end with endsnippets

The whole snippst is surrounded with snippet and endsnippets, while the dbg is the triger, and "Use IPython to debug" is description for this snippet. At my vim:

3

VScode snippets

In VScode, there is an origin snippets syntax to manage your own snippets. But I found it may not very easy to use:

  1. If there is a multi-line snippet, json is not very well for storing.
  2. It's hard for many PC sync the snippets. Because of this, there have been too many snippets 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 wanna 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 Vimer, you had to write snippets for these two editors, which bothers me.

How to use Vsnips

This plugin base on the snippet api in VScode, weather 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 VarFiles after set that.

{
    "Vsnips.VarFiles": [
        "/home/corvo/.vimrc",
        "/home/corvo/.vim/common.vim",
    ],
    "Vsnips.SnipsDir": [
        "/home/corvo/.vim/UltiSnips"
    ]
}

When you give the variable like let g:snips_author="corvo", you could use it like snippets below.

snippet full_title "Python title fully"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 tw=99 et:

"""
@Date   : `!v strftime("%B %d, %Y")`
@Author : `!v g:snips_author`

"""

endsnippet

Have done

  • [x] Auto download the Ultisnips
  • [x] Multi languate completions support
  • [x] Allow user add their own Ultisnips.
    • [x] From Ultisnips to VScode snippets.
    • [x] Support strftime
    • [x] Allow user define variables
    • [x] Allow some functions(Rewrite by javascript)
  • [x] Syntax highlight for snippets
  • [x] Allow user define their own functions
  • [x] Support autoDocstring for python

Doing

  • [ ] Support extends and priority in Ultisnips

May not work

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 v-doc, Vsnips could auto-generate the doc for the functions, Which will refer to autoDocstring.