Online Code kuSnippet Converter Turusi, Tsigira JavaScript / TypeScript / React / JSX / TSX
VS Code snippets inzira ine simba yekusimudzira yako coding chigadzirwa nekuita otomatiki kuiswa kweanowanzo shandiswa kodhi mabhuroko. Anogona kuve akareruka mameseji ekuwedzera kana mamwe akaomarara matemplate ane zvibatiso uye zvinosiyana. Heino nzira yekuvasimudzira:
Kugadzira Snippets:
Svika Snippet Settings: Enda kuFaira> Zvaunofarira> Mushandisi Snippets (Code> Zvaunofarira> Mushandisi Snippets paMacOS). Neimwe nzira, shandisa iyo palette yekuraira (Ctrl+ Shift+P kana Cmd+Shift+P) uye nyora "Zvadiwa: Rongedza Mushandisi Snippets".
Sarudza Mutauro: Unozokurudzirwa kusarudza mutauro wechidimbu chako (semuenzaniso, javascript.json, python.json, nezvimwewo). Izvi zvinoita kuti snippet iwanikwe pamutauro iwoyo chete. Iwe unogona zvakare kugadzira "Global Snippets" faira kana iwe uchida kuti snippet iwanikwe mumitauro yese.
Tsanangura Snippet: Zvidimbu zvinotsanangurwa muJSON fomati. Imwe neimwe snippet ine zita, prefix (iyo nzira yekudimbudzira yauchanyora kukonzeresa snippet), muviri (kodhi ichapinzwa), uye tsananguro yesarudzo.
Muenzaniso (JavaScript):
{
"For Loop": {
"prefix": "forl",
"body": [
"for (let i = 0; i < $1; i++) {",
" $0",
"}"
],
"description": "For loop with index"
}
}
Mumuenzaniso uyu:
"For Loop": Zita reiyo snippet (yereferensi yako).
"forl": Chivakashure. Kunyora "forl" uye kudzvanya Tab kuchaisa snippet.
"muviri": Kodhi yekuisa. $1, $2, zvichingodaro ma tabstops (zvibatiso). $0 ndiyo yekupedzisira chitubu chinzvimbo.
"tsananguro": Tsananguro yesarudzo inoratidzwa mumazano eIntelliSense.
Kushandisa Snippets:
Nyora Prefix: Mufaira remhando yemutauro chaiwo, tanga kutaipa chivakashure chawakatsanangura (semuenzaniso, forl).
Sarudza iyo Snippet: VS Code's IntelliSense icharatidza snippet. Isarudze nemakiyi emiseve kana nekudzvanya.
Shandisa Tabstops: Dzvanya Tab kuti ufambe pakati pematabhu ($1, $2, nezvimwewo) uye zadza kukosha.
Variables:
Zvidimbu zvinogonawo kushandisa zvinhu zvakaita se $TM_FILENAME, $CURRENT_YEAR, nezvimwewo. Kuti uwane runyoro ruzere, ona zvinyorwa zveVS Code.
Muenzaniso une Variables (Python):
{
"New Python File": {
"prefix": "newpy",
"body": [
"#!/usr/bin/env python3",
"# -*- coding: utf-8 -*-",
"",
"# ${TM_FILENAME}",
"# Created by: ${USER} on ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}"
]
}
}
Nekugona snippets, unogona kuderedza zvakanyanya kudzokorora kutaipa uye kuve nechokwadi chekuenderana mukodhi yako. Edza nekugadzira yako snippets yeanowanzo shandiswa kodhi mapatani uye tarisa yako yekukodha inoshanda ichikwira.