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

1
  • 3
    You were right, disabling line wrap did the thing! It happens that I needed more than 250 chars/line... Many thanks! May 12, 2013 at 17:11

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.