0

On this link the following keybinding is described:

enter image description here

What I need is the ability to load an XML and have it properly formatted, as you would with Ctrl+K +D in visual studio.

I had prepared this xml content:

<root><level1><sublevel1A></sublevel1A><sublevel1B></sublevel1B></level1><level2><sublevel2A></sublevel2A></level2></root> 

Which would need to be formatted to this:

<root> <level1> <sublevel1A> </sublevel1A> <sublevel1B> </sublevel1B> </level1> <level2> <sublevel2A> </sublevel2A> </level2> </root> 

Nothing happens though if I use the key binding. Nor does it help if I select everything first.

Any ideas?

2 Answers 2

2

There is no built-in support for XML formatting in VSCode. To get XML formatting you need install this extension - https://marketplace.visualstudio.com/items?itemName=fabianlauer.vs-code-xml-format


Also, you have a typo in your example XML, </subleve1B> instead of </sublevel1B>

Sign up to request clarification or add additional context in comments.

1 Comment

It looks like this could work, but I get a timeout, possibly my firewall blocks the request?
1

The XML extension from Red Hat provides, among many other features, formatting support for XML document:Formatting XML

It requires a JDK >= 8 to run.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.