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.

Community
  • 1
  • 1
nicolallias
  • 1,055
  • 2
  • 22
  • 51

1 Answers1

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

Kevin Bowersox
  • 93,289
  • 19
  • 159
  • 189