Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 196545 - Request: Add Code Style Support
Summary: Request: Add Code Style Support
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 enhancement with 8 votes (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-14 11:42 EDT by Andy Staudacher CLA
Modified: 2020-05-14 11:51 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Staudacher CLA 2007-07-14 11:42:17 EDT
Eclipse 3.3 comes with a "Code Style" feature for Java only. (Preferences -> Java -> Code Style)
It would be awesome if this was also available for PHP.

Related article:
http://www.ibm.com/developerworks/opensource/library/os-eclipse-clean/index.html

Maybe contact the authors of that article / the Java code style feature to see how much refactoring is needed to get this to work with PHP too.
Maybe make it PHP 5 only since PHP 5 is closer to Java.

My main problem with PDT's code formatter is that it doesn't support more flexible rules for indention.
My requirements:
- Displayed tab length = 8 spaces
- Indent by 4 spaces
- Replace all leading whitespace with tabs (= Smart tabs)
(e.g. 8 spaces indention should be replaced by / set to 1 tab, 12 spaces should be replaced by 1 tab + 4 spaces)

PDT makes this pretty much impossible and it's a lot of manual work for me.
Java under Eclipse 3.3 makes this super easy with the Code Style settings.
Comment 1 Christian Weiske CLA 2007-10-22 03:53:24 EDT
You could also include support to call PHP_CodeSniffer if installed (http://pear.php.net/package/PHP_CodeSniffer ).
Some predefined rules for Zend and PEAR would be great.
Comment 2 Sean Quinn CLA 2009-09-10 21:06:39 EDT
Has there been any further considerations by the PDT team to support more code formatting/styling options? This enhancement request has been open for quite some time now. Would love to see this feature included for PHP development, Zend Studio handles code formatting maybe Zend would be willing to contribute their formatting over to the PDT project to support interoperability?
Comment 3 Sean Quinn CLA 2009-10-06 23:08:15 EDT
Its been almost a month since the last comment was made (by myself). Not to be a bother, but for PDT to be a mature toolkit for PHP developers we really should have more advanced options for Code Styling/Code Formatting similar to those the the Java development tools have.

I'd be willing to bang around with the Plug-in development and try my hand at this and provide a proposed patch, but I have almost no time. Maybe if it doesn't look like any movement by the PDT team will occur on this front quickly I'll be able to give it a shot.

It would be nice if we could get a comment from the PDT team or some one associated with it that reflects whether this is actively being considered and when we might see it.
Comment 4 Roy Ganor CLA 2009-10-07 02:35:12 EDT
hi Sean,
in a few days a new project http://www.eclipse.org/proposals/pdt-incubator/ is going to be created where the pdt team will accept these kind of contributions.

to make clear, we see this as important feature, but it was just not contributed on the very first days of the project.
Comment 5 Sean Quinn CLA 2009-10-07 10:20:25 EDT
(In reply to comment #4)
> hi Sean,
> in a few days a new project http://www.eclipse.org/proposals/pdt-incubator/ is
> going to be created where the pdt team will accept these kind of contributions.
> 
> to make clear, we see this as important feature, but it was just not
> contributed on the very first days of the project.

Hi Roy,

Thank you very much for your reply! I look forward to the incubator project being opened. Maybe if no one else moves on it I will be able to contribute to the project! I've been very pleased and happy with PDT to date and would love the chance to give back to the community.

Again, thank you for your response!
Comment 6 Vadim Punski CLA 2009-12-30 02:18:49 EST
moving to 2.2.0M1
Comment 7 Sean Quinn CLA 2010-01-02 21:52:52 EST
(In reply to comment #6)
> moving to 2.2.0M1

I had begun to do some work locally to implement a DLTK-driven code style/formatter for the PDT project. Other projects took precedence so I put it on the back burner, but if it would be of any use I could start a Google Code project or add an attachment to this thread if it would assist you guys at all?
Comment 8 Kir CLA 2010-06-28 08:34:50 EDT
(In reply to comment #6)
> moving to 2.2.0M1

Hm ... At what stage is the introduction formatter?
PDT 2.2 release in fact already taken place -((
Comment 9 gossi CLA 2015-05-22 05:50:24 EDT
I still had this on my voting list. By now this is implemented and this issue can be closed :)
Comment 10 Michal Niewrzal CLA 2015-05-22 05:52:17 EDT
Thanks:) Closed.