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.
To format your whole script: Open the required file. Go to Source | Format Document or press Ctrl+Shift+F.
Eclipse has a default Java code formatting profile, known as Eclipse [built-in], which it uses to format code every time you press the combination keys Ctrl + Shift + F (on Windows) and ⌘ + ⇧ + F (on Mac).
CTRL + SHIFT + F works fine. Just click on the source codes you want to format and then press CTRL + SHIFT + F .
All you need is to export settings from Eclipse (go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button.), and then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.
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.
Windows > Preferences > Javascript > Code Style > Formatter > Edit
Change the profile name so it is not the built in Profile
Click the Line Wrapping Tab
Set the Max Line Width
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With