Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Alpine JS Comment Syntax HighlightNew to Visual Studio Code? Get it now.
Alpine JS Comment Syntax Highlight

Alpine JS Comment Syntax Highlight

danieledep

|
5 installs
| (0) | Free
Add Javascript syntax highlighting for Alpine.js x- attributes by adding a comment
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

alpinejs-syntax-hl-comment

Add Javascript syntax highlighting for Alpine JS x- attributes by adding a comment

  x-data="{
    // javascript
    open: false
  }"

It also adds normal greyed-out comments inside the x- attributes that don't trigger the Javascript syntax highlighting.

  x-data="{
    // just a grey comment
    open: false
  }"

Supported comments

// js
// javascript
// MARK: js
// MARK: javascript
// #region js
// #region javascript
/* js */
/* javascript */
/* MARK: js */
/* MARK: javascript */
/* #region js */
/* #region javascript */

⚠️ Section headers don't show in the minimap
Vscode support for section headers triggered in embedded languages is spotty / not well documented.

Supported Files

  • Html
  • Jinja
  • Liquid
  • Nunjucks
  • Php
  • Twig

Credit

This is a fork of Sperovita/alpinejs-syntax-highlight

Based off of textmate syntaxes from Vetur

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft