Qaybaha koodhka VS waa hab awood leh oo kor loogu qaado wax soo saarka koodka adiga oo si otomaatig ah u gelinaya baloogyada koodka ee inta badan la isticmaalo. Waxay noqon karaan balaadhinta qoraalka fudud ama qaabab badan oo kakan oo leh meeleeyayaal iyo doorsoomayaal. Waa kuwan sida looga faa'iidaysto:
Abuuritaanka qaybo yaryar:
Gal Settings Gooska: Tag Faylka> Dookhyada> Qaybaha Isticmaalaha (Koodhka> Dookhyada> Qaybaha isticmaale ee macOS). Haddii kale, isticmaal palette amarka (Ctrl+Shift+P ama Cmd+Shift+P) oo ku qor "Preferences: Configure User Snippets".
Dooro Luuqad: Waxaa lagugu soo dayn doonaa inaad u doorato luqadda qaybkaaga yar (tusaale, javascript.json, python.json, iwm.). Tani waxay hubinaysaa in qayb yar oo keliya loo heli karo luqaddaas gaarka ah. Waxa kale oo aad samayn kartaa faylka "Global Snippets" haddii aad rabto in qayb yar laga heli karo dhammaan luqadaha.
Qeex jajabka: Qaybaha waxaa lagu qeexay qaabka JSON. Qayb kastaa waxay leedahay magac, horgale (qaab gaaban oo aad ku qori doonto si aad u kiciso jajabka), jidh (koodka la gelinayo), iyo sharraxaad ikhtiyaari ah.
Tusaale (JavaScript):
{
"For Loop": {
"prefix": "forl",
"body": [
"for (let i = 0; i < $1; i++) {",
" $0",
"}"
],
"description": "For loop with index"
}
}
Tusaalahan:
"For Loop": Magaca qayb yar (tixraacaaga).
"forl": Horgalayaasha. Ku qorista "forl" oo riixaya Tab waxay gelin doontaa jajabka.
"body": Koodhka la gelinayo. $1, $2, iwm. waa tabstops (meeleeyayaasha). $0 waa booska cursorka ugu dambeeya.
"Description": Faahfaahin ikhtiyaari ah oo lagu muujiyey talooyinka IntelliSense.
Isticmaalka Qaybaha:
Ku qor horgalaha: Faylka nooca luqadda saxda ah, billow ku qor horgalaha aad qeexday (tusaale, forl).
Dooro jajabka: VS Code's IntelliSense ayaa soo jeedin doona jajabka. Ku dooro furayaasha fallaadha ama adigoo gujinaya.
Isticmaal Tabstops: Taabo tab si aad u dhex marato tabstops ($1, $2, iwm.) oo aad u buuxiso qiimayaasha.
Kala duwanaansho:
Qaybaha yaryar waxa kale oo ay isticmaali karaan doorsoomayaasha sida $TM_FILENAME, $CURRENT_YEAR, iwm. Liis buuxa, eeg dukumeentiga VS Code.
Tusaale leh 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}"
]
}
}
Adiga oo si fiican u yaqaan qaybo yar yar, waxaad si weyn u yareeyn kartaa qorista soo noqnoqda oo aad hubiso joogtaynta koodka. Tijaabi abuurista qaybo kuu gaar ah qaababka koodka ee sida caadiga ah loo isticmaalo oo fiirso waxtarka koodhkaaga oo kor u kacaya.