Shortcut to expand html tag

In an html file, a tag is expanded using the tab key after the tag (emmet feature).

For instance, hitting tab after “h2” will yield this : <h2></h2>.

When I’m not in an html file, like doing jsx inside a javascript file, how can I use a shortcut to yield the complete tag ?

Oh, I can select “JSX” as the file type. But the tab doesn’t work for the first tag : I have to type the full parent tag, for instance <div></div>, then the tab will work for the children.

I’ve tried using a macro, but it doesn’t work : I recorded this : typing “h2”, select “h2”, copy, hitting “<”, so that I get “<h2>”, then typing “</”, pasting “h2”, typing “>”, then moving back inside the tag with ctrl arrow.

When enter “h2” and apply the macro, I only get "> ", not the full “<h2></h2>”.

@trogne, could you please put your original question back then your solution as a reply? The point of the forums is to help you AND help people in the future that have the same problem.

  • Carey

Solution : change file type to JSX (top right file menu).

1 Like

I’ve reverted your initial post and marked your reply as the solution.

@Defman thanks!