Bug 220083 - [Indentation] - Editor indentation bugs
Summary: [Indentation] - Editor indentation bugs
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Zhongwei Zhao CLA
QA Contact: Ilina Stefanova CLA
URL: http://www.racehub.se/div/php-bugs.html
Whiteboard:
Keywords: bugday
Depends on:
Blocks:
 
Reported: 2008-02-23 17:39 EST by J Ekroth CLA
Modified: 2020-05-14 11:08 EDT (History)
11 users (show)

See Also:


Attachments
Source file to test with (211 bytes, application/octet-stream)
2008-05-31 10:34 EDT, J Ekroth CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description J Ekroth CLA 2008-02-23 17:39:37 EST
Code is not properly indented, see http://www.racehub.se/div/php-bugs.html for examples.

PHP formatting is set up to use four spaces, and the same goes for HTML source code.
Comment 1 Guy Gurfinkel CLA 2008-05-29 10:58:13 EDT
can't reproduce.
Comment 2 Nick Boldt CLA 2008-05-30 11:16:13 EDT
what version of Eclipse, WTP, PDT are/were you using, and what JDK, OS, WS?
Comment 3 J Ekroth CLA 2008-05-30 12:32:57 EDT
What it says in the report. ;) (Windows, PDT v1.0.2)
My Java is v1.5.11 by the way.

I'll give it a shot with PDT 1.0.3 and see if it still exists there. Will report back during the weekend. If it fails, I'll attach a source file you can test it with.
Comment 4 J Ekroth CLA 2008-05-31 10:34:25 EDT
Created attachment 103017 [details]
Source file to test with
Comment 5 J Ekroth CLA 2008-05-31 10:35:52 EDT
Just tried with a clean install of PDT v1.0.3 and a new workspace, and it's still wrong. I have attached a file for you to test with:

1) Position the caret at the end of line 3 and hit return. This puts the cursor in column 5, not 13, as expected.
2) Select line 3, hit Ctrl/C, then put the cursor on line 4, column 1 and press Ctrl/V a couple of times. The pasted line shifts to the right all the time.

This was reported in an early version of PDT and was fixed back then, but it must have broke again. (Bug 149399)
Comment 6 Denis Ponomarev CLA 2008-06-24 17:09:51 EDT
I think my problems caused by this bug too.

Code to type:

<?php

$arr = array(
    'str1',
    'str2',
);

call_the_func(
    'str1',
    'str2'
);

?>

When I press <enter> after "'str1'," caret moves to the begining of the next line without indention.
Comment 7 J Ekroth CLA 2008-08-06 02:18:45 EDT
After another 6 months (:rolleyes:) I just noticed something that may or may not be related to this, but if you use Denis' example and replace the parentheses with curly braces (which is obviously syntactically incorrect, but anyway) the indentation actually works as it should... Is the editor using some other language than PHP for its indentation?
Comment 8 J Ekroth CLA 2008-08-06 02:48:49 EDT
Final addition: If the page http://files.zend.com/help/PDT-Help/Formatting_Code.htm is correct, the code formatting is completely broken, because if I create a PHP file with the code in the example, all the formatting does is to indent some of the lines, and other lines even more, seemingly with no language knowledge at all.

Code to paste into a file when testing:

<?php
class Calculator {
public function add($a, $b) { return $a + $b; }
public function multiply($a, $b) { return $a * $b;
} public function divide($a, $b) {if ($b == null) {
    throw new Exception(""); } return $a / $b;}
public function subtract ($a,$b) { return $a - $b;}}
?>
Comment 9 Gadi Goldbarg CLA 2008-12-03 08:42:11 EST
Still relevant - changing version to 2.0.0
[Sylvia Tancheva]
Comment 10 Vadim Punski CLA 2010-01-04 04:04:02 EST
Reproducible on 2.1-SR1
Moving to 2.2.0
Comment 11 Zhongwei Zhao CLA 2010-08-03 00:06:51 EDT
fixed in head
Comment 12 Gadi Goldbarg CLA 2010-08-20 08:07:07 EDT
[Petyo Tanchev]

Tested on 2.2.0 from 13 Aug. 2010
Still relevant
Comment 13 Zhongwei Zhao CLA 2010-08-22 06:47:21 EDT
fixed in head
Comment 14 Petyo Tanchev CLA 2010-08-31 03:27:35 EDT
Tested on 2.2.1.v20100829
Still reproducible
Comment 15 Zhongwei Zhao CLA 2011-05-09 09:10:54 EDT
I could not reproduce this bug,and if you can,please reopen it,and there are several issues in this bug,it is better to tell which one is reproducible.Thanks
Comment 16 J Ekroth CLA 2011-05-10 15:48:50 EDT
This surely isn't fixed in any of the available versions of PDT I can find on eclipse.org. (I have PDT 2.2.1 here, and it happens in that version) The PDT project seems a bit dead though, so I'm not sure what I should do to verify if it's properly fixed or not?
Comment 17 J Ekroth CLA 2011-05-10 15:52:26 EDT
Forgot to say that all reported issues are still there in PDT 2.2.1.
Comment 18 Toshihiro Izumi CLA 2011-05-11 01:44:46 EDT
You can verify it with Indigo developer build.

Download Platform Runtime Binary and install it.
http://download.eclipse.org/eclipse/downloads/drops/S-3.7M7-201104280848/index.php#PlatformRuntime

Download last successful build of PDT and install it on 3.7M7(Help>Install New Software>Add>Archive>choose downloaded zip).
https://hudson.eclipse.org/hudson/job/cbi-pdt-3.0-indigo/lastSuccessfulBuild/artifact/build/N201105100313/pdt-Update-N201105100313.zip
Comment 19 Zhongwei Zhao CLA 2011-05-11 01:58:04 EDT
I tested the bugs on page http://www.racehub.se/div/php-bugs.html,still exist(not exactly same)

and I think the bug is related to the formatter.
Comment 20 Zhongwei Zhao CLA 2011-07-04 22:48:36 EDT
fixed
Comment 21 Kalin CLA 2011-07-22 04:17:47 EDT
Tested in pdt 3.0 - Verified.