VS Code - enable autoClosingTags option in .vue files

Viewed 6016

The html.autoClosingTags option in VS code lets me type '' - and voila, '' is now inserted with the cursor inside those two tags. But this only works in .html files. I´m working on a vue project, and would like this feature to also be available in my .vue files (and any other files with html content actually).

Is this possible?

VS code options

1 Answers

Use the Auto Close Tag extension:

This extension is enabled for other languages like XML, PHP, Vue, JavaScript, TypeScript, JSX, TSX and so on. It is configurable.

Features

  • Automatically add closing tag when you type in the closing bracket of the opening tag

  • After closing tag is inserted, the cursor is between the opening and closing tag

  • Set the tag list that would not be auto closed

  • Automatically close self-closing tag

  • Support auto close tag as Sublime Text 3

  • Use Keyboard Shortcut or Command Palette to add close tag manually

Related