membuat comment otomatis di VS Code

 

1. Cara cepat di VS Code (Snippet)

Kalau kamu sering nulis komentar seperti ini:

{{ -- isi content -- }}

kamu bisa bikin snippet otomatis supaya cukup ketik kata kunci (misal: bcom) lalu tekan Tab.

Langkah:

  1. Tekan Ctrl + Shift + P

  2. Ketik “snippets” → pilih “Configure User Snippets”

  3. Pilih php.json (karena file Blade termasuk PHP)

  4. Tambahkan kode berikut di dalam {}

"Blade Comment Auto": { "prefix": "bcom", "body": [ "{{ -- $1 -- }}" ], "description": "Buat komentar otomatis di Blade" }

$1 adalah posisi kursor pertama (bisa langsung isi teks di situ).

Hasilnya:

Ketik di VS Code:

bcom + TAB

➡️ otomatis jadi:

{{ -- -- }}

dan kursor langsung di tengah komentar.


⚙️ 2. Shortcut Keyboard Otomatis (pakai AutoHotkey – Windows)

Kalau kamu ingin di mana pun (bukan cuma VS Code), bisa pakai AutoHotkey.

Langkah:

  1. Install AutoHotkey

  2. Buat file misalnya blade-comment.ahk

  3. Isikan:

    ::bcom::{{ --isi content-- }}
  4. Jalankan file itu.

Sekarang kalau kamu ketik bcom di mana saja (VS Code, Notepad, dsb) → otomatis berubah jadi {{ --isi content-- }}.


💡 3. Pakai Extension

Ada juga extension VS Code yang bisa bantu bikin komentar otomatis:

  • 🔹 Blade Comment

  • 🔹 Custom Snippets Manager

  • 🔹 Macros (bisa bikin tombol otomatis menulis template tertentu)

Kamu bisa cari di VS Code Marketplace.

0 Response to "membuat comment otomatis di VS Code"

Post a Comment