Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

Smart Close Tag Logo

Smart Close Tag

The ultimate, lightning-fast auto close tag extension for Visual Studio Code.
Works across ALL file types with zero configuration: HTML, XML, XAML, JSX, TSX, Vue, Svelte, PHP, Blade, Astro, Markdown, and beyond!

Marketplace Version Installs Rating License: MIT GitHub Stars

English β€’ TiαΊΏng Việt


🌟 Why Smart Close Tag?

Traditional auto-close extensions only work on standard HTML/XML and require clumsy <tag> syntax. Smart Close Tag elevates your coding productivity with universal language support, intuitive slash shorthand, attribute intelligence, void tag awareness, and real-time tag wrapping.

Whether you write React (JSX/TSX), Vue, Svelte, XAML/AXAML, PHP/Blade, Astro, XML, or custom template engines, Smart Close Tag works instantly out of the box with zero setup required.


πŸš€ Key Features

| Trigger / Shortcut | Action | Result (| indicates cursor) | | :--- | :--- | :--- | | div/ + Tab / Enter | Single Tag Shorthand | <div>\|</div> | | button class="btn btn-primary" id="submit"/ + Tab | Shorthand with Attributes | <button class="btn btn-primary" id="submit">\|</button> | | img/ + Tab / Enter | Void / Self-Closing Tag | <img />\| | | Component// + Tab / Enter | Force Self-Closing | <Component />\| | | <section> (typing >) | Real-time Auto-Close | <section>\|</section> | | </ (typing </) | Auto-Complete Matching Tag | Auto-completes the nearest open tag </tag> | | Alt + W (or Option + W) | Wrap Selection with Tag | Wraps selected text/code inside custom tag |


πŸ’‘ Feature Showcase

1. Universal Language Support (No File Type Limits)

Smart Close Tag is not restricted to HTML or XML. It activates smoothly across:

  • Web Frontend: HTML5, React JSX, React TSX, Vue SFC (.vue), Svelte, Astro, Angular templates
  • Mobile & Desktop: XAML (.xaml), Avalonia XAML (.axaml), MAUI, WPF
  • Backend & Templates: PHP, Blade (.blade.php), Twig, Liquid, ERB, Smarty, ASP.NET, Handlebars
  • Data & Markup: XML, SVG, MathML, RSS, Markdown (.md), and even unsaved (untitled) files!

2. Fast Tag Expansion (TagName/)

Simply type the tag name followed by a forward slash /, then press Tab or Enter.

div/               β†’ <div>|</div>
Grid.Row/          β†’ <Grid.Row>|</Grid.Row>
local:UserCard/    β†’ <local:UserCard>|</local:UserCard>
custom-element/    β†’ <custom-element>|</custom-element>

3. Full Attribute Intelligence

Want attributes inside your tag before closing? Just type them naturally before /!

div class="container mx-auto" id="app"/
β†’ <div class="container mx-auto" id="app">|</div>

input type="email" required placeholder="name@email.com"/
β†’ <input type="email" required placeholder="name@email.com" />

4. Smart Self-Closing Tags (TagName// & Void Elements)

  • Automatic Void Detection: Standard HTML void elements (img, input, br, hr, meta, link, etc.) automatically generate self-closing tags <img /> instead of redundant paired tags.
  • Double-Slash Shorthand: For any custom component or React element, simply append //:
Avatar src={user.photo}//  β†’ <Avatar src={user.photo} />

5. Instant Auto-Close on > and </

  • Typing > after <MyComponent> automatically inserts </MyComponent> and centers your cursor.
  • Typing </ scans backwards and completes the nearest unmatched open tag.

6. Wrap Selection with Tag (Alt + W)

  1. Select any code block or text snippet.
  2. Press Alt + W (Windows/Linux) or Option + W (macOS).
  3. Type your desired tag (e.g., div class="card" or ScrollView).
  4. Press Enter β€” your selection is neatly wrapped with proper indentation!

7. Sleek Status Bar & Quick Menu

Click the $(tag) Smart Tag: On item in the VS Code status bar to quickly toggle the extension, open configuration settings, or trigger tag wrapping.


βš™οΈ Extension Settings

Customize Smart Close Tag in File > Preferences > Settings (or press Ctrl+, and search for smartCloseTag):

Setting Type Default Description
smartCloseTag.enable boolean true Enable or disable Smart Close Tag features globally.
smartCloseTag.enableForAllFiles boolean true Enable Smart Close Tag across all file types (*).
smartCloseTag.includedLanguages array ["*"] List of language IDs where Smart Close Tag is active (supports * wildcard).
smartCloseTag.excludedLanguages array [] List of language IDs to explicitly exclude (e.g. ["plaintext"]).
smartCloseTag.enableAttributesSupport boolean true Allow typing attributes before / (e.g. div class="box"/).
smartCloseTag.enableAutoCloseOnGreaterThan boolean true Automatically insert matching closing tag when typing >.
smartCloseTag.enableAutoCloseOnSlash boolean true Automatically complete matching closing tag when typing </.
smartCloseTag.selfClosingFormat string "slash" Self-closing format: "slash" (<img />) or "void" (<img>).
smartCloseTag.selfClosingTags array [] Additional custom tag names to treat as self-closing void elements.
smartCloseTag.showStatusBarItem boolean true Show the Smart Close Tag status bar indicator.

⌨️ Keyboard Shortcuts

Shortcut Command When
Alt + W (Win/Linux) / Option + W (Mac) smartCloseTag.wrapWithTag In editor with text selected
Tab or Enter Accept Tag Expansion When autocomplete dropdown displays tag snippet

πŸ“Š Comparison: Smart Close Tag vs Alternatives

Feature Built-in VS Code Auto Close Tag Smart Close Tag Pro
Works in ANY file type (*) ❌ ❌ (HTML/XML only) βœ… Full Universal
TagName/ Shorthand ❌ ❌ βœ… Yes
Tag with Attributes (tag class="x"/) ❌ ❌ βœ… Yes
Double Slash Self-Closing (Tag//) ❌ ❌ βœ… Yes
Void Element Recognition (img, input) Partial ❌ βœ… Fully Configurable
Auto Close on > HTML only βœ… βœ… Universal
Auto Complete on </ HTML only βœ… βœ… Universal
Wrap Selection with Tag (Alt+W) ❌ ❌ βœ… Built-in
Interactive Status Bar & Quick Menu ❌ ❌ βœ… Included

πŸ“¦ Installation

Option 1: Via VS Code Marketplace (Recommended)

Install from Marketplace

  1. Open Visual Studio Code.
  2. Press Ctrl + Shift + X (or Cmd + Shift + X on macOS) to open the Extensions view.
  3. Search for Smart Close Tag (or NguyenTungSk2004.smart-close-tag).
  4. Click Install.

Option 2: Via VS Code Quick Open

Press Ctrl + P (or Cmd + P on macOS) and run:

ext install NguyenTungSk2004.smart-close-tag

Option 3: Via Command Line (CLI)

code --install-extension NguyenTungSk2004.smart-close-tag

⭐ Support & Reviews

If Smart Close Tag saves you time and boosts your productivity, please consider giving it a 5-star review on VS Code Marketplace and starring the GitHub repository! Your support helps the extension reach more developers worldwide.


🀝 Contributing

Contributions, bug reports, and feature requests are very welcome! Please check out our Contributing Guide to get started.


πŸ“„ License

This extension is licensed under the MIT License.

Made with ❀️ by NguyenTungSk2004.

About

No description, website, or topics provided.

Resources

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages