Pradip Kharbuja
Pradip Kharbuja

Reputation: 3542

Eclipse - error while formatting javascript with html tags

I'm using Eclipse Version: 4.2.0 and Build id: I20120608-1400. I have following code in JavaScript.

enter image description here

But when I hit Ctrl + Shift + F, it gives code in following format.

enter image description here

It modifies the code as above. I came to know it is due to <br> tag. But I want <br> tag there. Is it a bug or do I need to manage setting? How can I resolve this problem?

Upvotes: 2

Views: 256

Answers (1)

hevele
hevele

Reputation: 943

Yes it is a bug. You can find lots of bug reports from here and also here. I guess the first link's attachment solves the problem. The message says:

Created attachment 218897 [details] Fix for JsTranslator.java

In the following method: org.eclipse.wst.jsdt.web.core.javascript.JsTranslator.translateJSNode(IStructuredDocumentRegion)

'generatedContent' is not correctly cleared in the loop.

I have attached a patch.

Upvotes: 1

Related Questions