2

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?

3
  • what is the behaviour with <br> replaced with <br/> ? Commented Jul 4, 2013 at 13:24
  • sorry for the late reply. The behavior with <br/> is same as <br>. same problem. Commented Jul 5, 2013 at 7:03
  • maybe try separating <br> tag from the folllowing string? like: "<br>" + "Upload error... Commented Jul 11, 2013 at 11:59

1 Answer 1

1

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.

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

3 Comments

Thank you reply. But I couldn't find JsTranslator.java. How to apply the patch? I'm really lost.
Do you have Kepler version?
Download this version: eclipse.org/downloads/download.php?file=/technology/epp/…. The file is in eclipse>>plugins>>org.eclipse.wst.jsdt.web.core_1.0.600.v201301301822. Open this file with winrar and navigate to org>>eclipse>>wst>>jsdt>>web>>core>>javascript. The file is there. Just open it apply the solution: bugs.eclipse.org/bugs/attachment.cgi?id=218897&action=diff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.