Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Generate a snippet extensions for vscode.

License

NotificationsYou must be signed in to change notification settings

cipchk/vscode-snippet-generator

Repository files navigation

CIDependency StatusNPM version

Generate a snippet extensions for vscode.

Usage VSCode extension

  1. InstallDynamic Custom Snippets extension.
  2. Add snippet files into.vscode/snippets/ folder. (Please refer to the template contentSnippet tempalte)
  3. The first time create the.vscode/snippets/ folder, need to restart vscode; otherwise you only need to trigger thevscode-snippet-generator: Cache all dynamic snippets command again.

Happy coding!!!

You can configure"vscode-snippet-generator.prefix": "" insettings.json to change the prefix.

You can configuae"vscode-snippet-generator.languages": ["html", "typescript"] insettings.json to support language list.

Usage Command Line: Quick start

$ git clone --depth 1 https://github.com/cipchk/vscode-snippet-generator-tpl.git$cd vscode-snippet-generator-tpl$# build$ npm run build$# package vscode extension$ npm run release

Cli Options

vscode-snippet-generator --help

Snippet tempalte

Markdown file symbol of a specify snippet, like this:

---prefix:buttondescription:按钮scope:typescript,html---```html<button${1:type="${2|text,tel|}"}>  $0<button>```
  • prefix defines how this snippet is selected from IntelliSense and tab completion. In this casebutton.
  • description is the description used in the IntelliSense drop down.
  • scope Restrict template scope, if not specified, it means no restriction. In this casetypescript andhtml document.
  • markdown body is defines snippet code, muse be hava a code tag.

How to writing snippet code, pls refre tovscode-Creating your own snippets

I18n

Thedescription support i18n, like this:

---prefix:buttondescription:zh-CN:按钮en-US:Button---

Specify language version to generate withi18n parameter.

vscode-snippet-generator --i18n=zh-CN --outFile=snippets-zh-CN.jsonvscode-snippet-generator --i18n=en-US --outFile=snippets-en-US.json

If you want to display multiple languages in a snippet extension, you can usei18nTpl.

# windowvscode-snippet-generator --i18nTpl=\"{zh-CN}({en-US})\"

License

The MIT License (see theLICENSE file for the full text)

About

Generate a snippet extensions for vscode.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp