Kode yo kuri interineti ku gikoresho co guhindura ibice, gushigikira JavaScript / Ubwoko bw'inyandiko / Gusubiza / JSX / TSX      

Urasabwa kwinjiza izina ry'agace (name)
Urasabwa kwinjiza imbere y'agace (prefix)
Urasabwa kwinjiza insobanuro y'agace (description)
Urasabwe kwinjiza umwandiko wa kode (code body)
Ubwoko bw'uruvyaro
Igisubizo c'Igice

VSCode Uko ukoresha ibice vya kode


Snippets in Visual Studio Code
VS Code snippets ni uburyo bukomeye bwo kwongerera ubushobozi bwawe bwo gukora code mu kwinjiza mu buryo bwikora ama code akoreshwa cane. Bishobora kuba ukwaguka kw'inyandiko yoroshe canke ibigereranyo bikomeye cane bifise ibibanza n'ibihinduka. Ehe ingene wobikoresha:

Gukora ibice:

Ushobora gushika ku mirongo y’ibice: Genda kuri Dosiye > Ivyo ukunda > Ivyiyumviro vy’ukoresha (Kode > Ivyo ukunda > Ivyiyumviro vy’ukoresha kuri macOS). Canke, koresha paleti y'amabwirizwa (Ctrl+Shift+P canke Cmd+Shift+P) hanyuma wandike "Ivyo ukunda: Gutunganya Ibice vy'Ukoresha".

Hitamwo Ururimi: Uzosabwa guhitamwo ururimi rw'igice cawe (nk'akarorero, javascript.json, python.json, n'ibindi). Ivyo bituma igice c'ururimi kiboneka gusa ku rurimi rwihariye. Ushobora kandi gukora dosiye "Ibice vy'Isi" nimba ushaka ko iyo nkuru ishobora gukoreshwa mu ndimi zose.

Sigura Igice: Igice gisobanurwa mu buryo bwa JSON. Buri gice gifise izina, intango (inzira ngufi uzokwandika kugira ngo ushireho igice), umubiri (kode izokwinjizwa), n’insobanuro idasanzwe.

Akarorero (Inyandiko ya Java):
{
  "For Loop": {
    "prefix": "forl",
    "body": [
      "for (let i = 0; i < $1; i++) {",
      "  $0",
      "}"
    ],
    "description": "For loop with index"
  }
}
Muri aka karorero:

"For Loop": Izina ry'igice (kugira ngo ubone).
"forl": Intangamarara. Kwandika "forl" no gukanda Tab bizokwinjiza igice.
"umubiri": Kode yo kwinjiza. $1, $2, n'ibindi ni ibihagararo (ibimenyetso vy'ibibanza). $0 ni ikibanza ca nyuma c'ibara.
"insobanuro": Insobanuro y'ubusa yerekanwa mu vyiyumviro vya IntelliSense.
Gukoresha ibice:

Andika Intangamarara: Muri dosiye y'ubwoko bw'ururimi bubereye, tangura kwandika intango wasobanuye (nk'akarorero, forl).

Hitamwo Igice: IntelliSense ya VS Code izotanga iciyumviro c'igice. Hitamwo ukoresheje imfunguruzo z’umwampi canke ukanda.

Koresha Tabstops: Kanda Tab kugira ngo ugende hagati y’ibihagararo ($1, $2, n’ibindi) hanyuma wuzuze agaciro.

Ibihinduka:

Ibice bishobora kandi gukoresha ibihinduka nka $TM_FILENAME, $CURRENT_YEAR, n'ibindi. Kugira ngo ubone urutonde rwuzuye, raba inyandiko za VS Code.

Akarorero n'ibihinduka (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}"
    ]
  }
}
Mu kumenya neza ibice, urashobora kugabanya cane kwandika gusubiramwo no kumenya neza ko kode yawe ihuye. Gerageza guhingura ibice vyawe bwite vy’ibigereranyo vya kode bikoreshwa cane maze urabe ubushobozi bwawe bwo gukora kode butera imbere.