Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Auto Close Empty TagNew to Visual Studio Code? Get it now.
Auto Close Empty Tag

Auto Close Empty Tag

Emmanuel Paul Elom

|
2,780 installs
| (0) | Free
Properly close HTML empty tags and comments for use in JSX
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Auto Close Empty Tag

CI

Automatically close HTML/XML empty tags and properly close comments to support JSX syntax

Features

  • Automatically format comments to support JSX syntax
  • Set the tag list that would be auto closed
  • Automatically close self-closing tag
  • Support Auto Close Empty Tag
  • Use Keyboard Shortcut or Command Palette to run the auto close

Usages

To run the auto close, use shortcut Alt+c (Command+Alt+c for Mac), or press F1 and then select/type Close Tag

Usage

Configuration

Add entry into auto-close-empty-tag.activationOnLanguage to set the languages that the extension will be activated. Use ["*"] to activate for all languages. Below are the default settings:

{
    "auto-close-empty-tag.activationOnLanguage": [
        "xml",
        "php",
        "blade",
        "ejs",
        "glimmer-js",
        "glimmer-ts",
        "jinja",
        "javascript",
        "javascriptreact",
        "typescript",
        "typescriptreact",
        "plaintext",
        "markdown",
        "vue",
        "liquid",
        "erb",
        "lang-cfml",
        "cfml",
        "HTML (Eex)"
    ]
}

Note: The setting should be set with language id defined in VS Code. Taking javascript definition as an example, we need to use javascript for .js and .es6, use javascriptreact for .jsx. So, if you want to enable this extension on .js file, you need to add javascript in settings.json.

Alternatively you could also exlude the languages where you don't want the extension to be activated. Below is an example:

{
    "auto-close-empty-tag.disableOnLanguage": [
        "php",
        "python"
    ]
}

Set the tag list that would be auto closed. Below are the default settings for empty elements in HTML per W3C spec, and you could overwrite it:

{
    "auto-close-empty-tag.includedTags": [
        "area",
        "base",
        "br",
        "col",
        "command",
        "embed",
        "hr",
        "img",
        "input",
        "keygen",
        "link",
        "meta",
        "param",
        "source",
        "track",
        "wbr"
    ]
}

Change Log

See Change Log here

Issues

Submit the issues if you find any bug or have any suggestion.

Contribution

Fork the repo and submit pull requests.

Blog

Visit the blog or the post for more detailed info

Special Thanks

This is a fork of vscode-auto-close-tag project

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