Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Eclipse PDT auto-format code when pasting

I'm using Eclipse Indigo 3.7.0 with PDT for PHP develpment. When I copy/paste some code, Eclipse automatically format it.

For example, copying this :

if ($distance > 50 && $distance  <= 100)    {$local_score = 8;}
if ($distance > 100 && $distance <= 200)    {$local_score = 6;}

Is pasted in this :

if ($distance > 50 && $distance  <= 100)    {
    $local_score = 8;
}
if ($distance > 100 && $distance <= 200)    {
    $local_score = 6;
}

Any idea on how to disable this ? Best Regards.

like image 716
Philippe Avatar asked Jul 05 '11 10:07

Philippe


People also ask

How do I turn off auto format in Eclipse?

For this got to Window->Preferences> Java -> Editor->Save Actions-> click on "Configure project specific Settings ". On the bottom of the window select the check box "Show only project with project specific settings " . Then select a module/project -> Ok-> Un check "Enable project specific settings"--> Apply.

How do I format my Eclipse code on Mac?

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).


2 Answers

It's really bad...
Try this.
Open workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.php.ui.prefs by your text editor.
Add "smartPaste=true".

(note that I'm not aware of side effect)

like image 193
atlanto Avatar answered Oct 16 '22 05:10

atlanto


  • Go to Window / Preferences
  • Then select page Java / Editor / Typing
  • Then unselect checkbox "When pasting" / "Adjust indentation".
like image 13
Notinlist Avatar answered Oct 16 '22 05:10

Notinlist