15

This topic is nice, but instead of placing special tag comments everywhere, I look for a solution about jQuery code, more specifically the $ character. Eclipse formatter does not seem to recognize

$.ajax({

and transforms it like this:

$
       .ajax({

Any clues other than changing all $ to jQuery?

edit: I cannot find a minimal example... it seems to happen only on very big functions, with some big comments

Top of one of these big functions

function loadDataArt(id) {
    $.each(id, function(index) {
    $.ajax({

Is transformed into:

function loadDataArt(id) {
    $
        .each(
            id,
            function(index) {
            $
                .ajax({

Tabulations? I'll try to find out more info -_-

edit2: disabling line wrap was the solution.

1 Answer 1

20

This may be caused by the width of the line. Try changing the amount of characters in a line in Eclipse, it still defaults to 80 which is a throw back to punch card days.

  1. Windows > Preferences > Javascript > Code Style > Formatter > Edit

  2. Change the profile name so it is not the built in Profile

  3. Click the Line Wrapping Tab

  4. Set the Max Line Width

enter image description here

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

1 Comment

You were right, disabling line wrap did the thing! It happens that I needed more than 250 chars/line... Many thanks!

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.