Auto-indent and Eclipse (or any good PHP editor)

279 views
Skip to first unread message

Doskei

unread,
Mar 18, 2009, 10:59:50 AM3/18/09
to Professional PHP Developers
Any of you gurus know of a way, in EclipsePDT preferably but any good
editor will do, to change the default behavior of auto-indent?

Here's the explanation: when I write code, I do not use the 'industry
standard'...

if (case) {
stuff happens;
}

I hate it. I am sure it's technically proper, but I just can't stand
the way it looks. I find it to be incredibly confusing.

Instead, I write my code:

if (case)
{
stuff happens;
}

Obviously that's an overly simplified explanation. The point being, I
WILL NOT use an editor that forces me to conform to this standard code
format. I've been using Dreamweaver for many years, and up through
CS3, auto-indent simply put new lines at the same indentation as the
previous line. This meant I could manually indent to my opening
brace, and I wouldn't have to worry about it afterward. As of CS4, if
you start a new line after an opening brace, it pushes your
indentation up by one. I hate that. I know it's trivial, but to add
even one step to probably one of the most common processes in coding
is unacceptable.

So I thought, this would be a good time to graduate out of WYSIWYG and
into a more professional, more targeted PHP development environment (I
haven't used the DW design view in years). To that end, I started
trying to learn eclipse.

It's been a week, and unless I can find a way to change this basic
setting, I won't be using it again. I've edited every single php code
template / style to reflect my layout. Apparently, those are just for
curious spectators, as changing them hasn't made any difference. I've
searched for plugins, to no avail. I can't even find a proper forum
for EclipsePDT users, where I could ask this very question. All of
which has driven me up the wall, and brought me within an inch of
wiping out everything I've tried to learn and just reverting to
Dreamweaver CS3.

So, anybody here have any advice for me? I love the structure Eclipse
provides. I think the debugger could be a very useful tool, if I'm
willing to keep using the program long enough to learn how to use it.
But I simply refuse to use a system that prevents me from writing code
in my own style, and right now both Dreamweaver CS4 and EclipsePDT
fall into that category. Help?

Many thanks in advance.

(PostScript: so far the only editor that I'm remotely comfortable with
that doesn't dictate code style to me is notepad++, which loses out to
DW CS3 because it doesn't have built-in sftp, code suggestions,
debugging, or file-handling)

Robert Gonzalez

unread,
Mar 18, 2009, 12:31:34 PM3/18/09
to Professi...@googlegroups.com
I think in Eclipse you need to edit the templates for the given blocks to make all of the autocomplete features do what you want. I am fairly certain you can control just about anything in it though, I am just a piss poor person to try to help you with this because I use the standard method Eclipse ships with.

Sorry I can't be of more help. Have you tried the Eclipse mailing lists at all?
--
Robert A. Gonzalez

Doskei

unread,
Mar 18, 2009, 1:22:59 PM3/18/09
to Professional PHP Developers
Robert ~

Thanks for the tip. I have actually tried that (editing code
templates), and it doesn't seem to matter. Maybe I'm doing something
wrong due to my inexperience. Here's an example (PHP --> Code Style --
> Code Templates --> Code --> class statement):

Original layout:

class ${class_name} {
function ${function_name}() {
${cursor};
}
}


My custom layout:

class ${class_name}
{
function ${function_name}()
{
${cursor};
} // END | function
} // END | class

After editing, if I look at PHP --> Templates --> class, it shows up
correctly. However, when I am in a PHP document, inside the <? and ?
>, and I type:
class
{

It immediately (as soon as I type the opening curly brace) converts
this to
class
{
| -- (cursor)
}

Likewise it will convert
class {

to
class {
| -- (cursor)
}

So the only efficient way to get it back to my code style is to finish
the statement, shift-tab the whole block of code, and then tab the
block of code with braces. As you can imagine, this is excruciatingly
inefficient, especially with nested braces.
This happens whether or not the "Automatically insert" option is
enabled for that code template. I've tried quitting and relaunching
eclipse, even rebooting the machine, just to make sure it's loaded my
prefs. Nothing helps. It continues to assume I want to use industry
standard indenting, and continues to ignore the code templates. I
think if I could even get code templates to apply, I could handle
using Eclipse, as I could do my best to set up a template for any code
template that was trying to autocorrect indentation, but by all
(admittedly inexperienced) appearances, the templates are there just
for show.

Still, thanks for the quick reply. And no, I haven't tried the
eclipse mailing lists. I tried to find a forum for eclipse users, and
found nothing remotely friendly to the uninitiated. I trust google
groups to have intelligent, un-sycophantic, real experts, so I came
here first.

Doskei

unread,
Mar 18, 2009, 1:33:59 PM3/18/09
to Professional PHP Developers
Quick update:
a) Yeah, I used a poorly formed example, as I didn't declare the class
in my example. It doesn't matter:

class NewThing
{

converts immediately to

class NewThing
{

and when I hit enter...
class NewThing
{
| -- (cursor)
}

Sorry, though, it was stupid to not be clearer when my issue is so
specific.

Doskei

unread,
Mar 18, 2009, 2:08:00 PM3/18/09
to Professional PHP Developers
Isn't it funny how you can almost always find a solution to a problem
when you're worried somebody is going to make you look stupid when
they post the obvious answer?
So, I think I figured it out. Kind of. Couple things:

- I was assuming that the code templates worked like the auto-indent:
that is, that they would change your code IMMEDIATELY when it appeared
to fall into a preset category. This doesn't appear to be the case.
Rather, you have to ctrl+space to apply the template.
- This is far from ideal, especially in cases where there are five
different possible automatic options. It's really not much better to
type class, ctrl+space, down five times, enter than to just fix the
code manually.
- However, the compromise is to wipe out all of the eclipse default
templates, create only my own, and to use keywords for each that
aren't likely to be confused with any of the default stuff.

I have a feeling this is still going to mean a WHOLE lot more work
than if there was just a (expletive) option for "new line indents the
same distance as the previous line." The world seems to be moving
away from convenience in code, though, as this is exactly what
Dreamweaver lost between CS3 and CS4.

Anyway, I won't exactly call this 'solved,' because if there's anybody
out there who can show me a way to just universally change the
indent / newline behavior, I'll be ecstatic. However, I've at least
found a theoretically workable (if mediocre) solution.

Robert Gonzalez

unread,
Mar 18, 2009, 2:13:04 PM3/18/09
to Professi...@googlegroups.com
Try going to Preferences -> Java -> Code Style -> Formatter and either create a new profile or edit the current profile. Indentation is the first tab in that dialog box.

Not sure if this is what you want. Just found it on Google. Which actually took way more work than it should have.
--
Robert A. Gonzalez

Fahd Murtaza

unread,
Mar 18, 2009, 2:14:43 PM3/18/09
to Professi...@googlegroups.com
why not use phpdesigner or notepad++.
--
Regards
Fahd Murtaza
http://www.fahdmurtaza.com

Robert Gonzalez

unread,
Mar 18, 2009, 2:41:47 PM3/18/09
to Professi...@googlegroups.com
How would you do this in those? The original poster mentioned Eclipse but sounded open to other editors. Tell us how to give him what he wants in either of those editors. And is PHPDesigner free?
--
Robert A. Gonzalez

Doskei

unread,
Mar 18, 2009, 2:49:54 PM3/18/09
to Professional PHP Developers
Robert ~

Yeah, that was the first thing I found too. Unfortunately, the only
preferences I can find in that window are the choice between using
tabs as tabs or spaces as tabs, and if the latter, how many spaces is
a tab. Again, I feel like this is where what I want to do SHOULD be,
but that I just don't know how to make it show up. As poor as the
documentation is (admittedly an already biased opinion further colored
by frustration), I can't tell the difference.

Fahd ~

Thanks for the advice, I'll check out phpdesigner.

I actually like notepad++, and, as I mentioned in my original post,
it's one of the few code editors I've found so far that actually
formats my code the way I want it. However, in the grand scheme of
things, I choose not to use it for lack of features: no file manager
(i.e. the ability to sync a local and remote location), no sftp
(related), and while it has syntax highliting, I've never figured how
how to get code suggestions to work. With those issues, it's simply
easier for me to consider reverting back to Creative Suite 3 and using
a Dreamweaver with unbroken indentation than to use a simple text
editor and find external solutions for all the other stuff that DW
could do.

You could argue that if I'm willing to use Eclipse, I should just use
notepad++, since eclipse doesn't (seem to) have sftp or remote sync
either. However, Eclipse would make it worth my while with internal
debugging and project management features. Notepad++ doesn't offer
enough perks for me to give up DW's built-in sftp, file manager, and
code suggestions.

Doskei

unread,
Mar 18, 2009, 4:11:40 PM3/18/09
to Professional PHP Developers
I've installed a phpdesigner trial. Here are my findings:

By default, it does the same thing that eclipse does. Like eclipse,
there are ways to work around the issue for specific cases - basically
the equivalent of code templates. Unlike eclipse, there is an option
for "Auto indention." Ironically, though, this fixes precisely
everything that I did not want fixed. That is, if I disable auto
indention, a new line is not indented at all (which is inconvenient)
UNLESS it immediately follows an opening curly brace (or, presumably,
brace, bracket, or paren), in which case it indents to the previous
line's indentation plus one (which is inconvenient).

In other words, phpdesigner is another editor that appears to assume
no one in their right mind would want to format curly braces
differently. I'm not saying that it DOES assume that, just that I
can't, on a cursory exploration, find a way to prove otherwise. Fahd,
I assume that you use phpdesigner yourself: do you know of anywhere
else I could look for such an option?

Otherwise, I think I'm back to where I started here. I appreciate the
advice, but even with code templates, coding in eclipse or phpdesigner
is going to end up being more tedious than using Dreamweaver CS3.

Steven Wright

unread,
Mar 18, 2009, 5:18:46 PM3/18/09
to Professi...@googlegroups.com
In Eclipse:

Window > Preferences > PHPEclipse > PHP > Formatter

There is control there to decide what happens with the opening brace

Steven Wright

unread,
Mar 18, 2009, 5:20:13 PM3/18/09
to Professi...@googlegroups.com
Notepad++ Rocks!! But its not an IDE and sometimes you want an IDE.
 
 


From: Professi...@googlegroups.com [mailto:Professi...@googlegroups.com] On Behalf Of Fahd Murtaza
Sent: Wednesday, March 18, 2009 2:15 PM
To: Professi...@googlegroups.com
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP editor)

Doskei

unread,
Mar 18, 2009, 6:23:32 PM3/18/09
to Professional PHP Developers
I think I might have a different version of eclipse, as I do not have
that menu. The closest I could find was:
Window --> Preferences --> PHP --> Code Style --> Formatter
Which is what Robert suggested a few posts ago, from google. It has
only a single pair of options, controlling whether you prefer spaces
or tabs, and how many spaces are in a tab. There is nothing here
about braces.

https://www.slashtmp.iu.edu/public/download.php?FILE=jmcnaugh/21446q0NAt2

Is it possible that I'm missing options due to the version I'm
running? Here's what my Help --> About says

==============================================================================
Eclipse Platform

Version: 3.4.1
Build id: M20080911-1700

(c) Copyright Eclipse contributors and others 2000, 2008. All rights
reserved.
Visit http://www.eclipse.org/platform

This product includes software developed by the
Apache Software Foundation http://www.apache.org/
==============================================================================

What am I doing wrong here?

Robert Gonzalez

unread,
Mar 18, 2009, 6:31:58 PM3/18/09
to Professi...@googlegroups.com
You're no doing anything wrong. There are so many different configurations you can have of eclipse it isn't even funny. There is PHPEclipse, EclipsePDT, EclipseCDT, The newest Eclipse (which is what you have, 3.4). Each one is slightly different than the next.
--
Robert A. Gonzalez

Doskei

unread,
Mar 19, 2009, 1:19:02 PM3/19/09
to Professional PHP Developers
I emailed the support team for phpdesigner, to see if I was missing
something. Here's their response:

"After reading your email again I realized that this is not supported,
sorry :(
"Will try to work on a solution to support it – but why do you want to
disable it?"

I hate this mentality. I honestly think there is some zealotry going
on here - application developers who think that there's a 'right' way
to code, and who shove it down everyone's throats. I don't mean any
offense to anyone who chooses to use the standard code layout, by any
means. But in fact I'd be surprised if there are many members here
who don't try to customize their coding environment one way or
another. I'm just unlucky in what I want changed.

Anyway, thanks for the help all. It looks like I'm stuck with
reinstalling CS3 and using DreamWeaver until one of these supposedly
professional IDE's support freedom of thought.

Steven Wright

unread,
Mar 19, 2009, 1:27:32 PM3/19/09
to Professi...@googlegroups.com
Dude just use Eclipse. I use the code style:

Control()
{
}

And it works like a charm. Just download the following:
http://www.phpeclipse.com/

I have been using it for the last couple of months



-----Original Message-----
From: Professi...@googlegroups.com
[mailto:Professi...@googlegroups.com] On Behalf Of Doskei
Sent: Thursday, March 19, 2009 1:19 PM
To: Professional PHP Developers
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP
editor)


I emailed the support team for phpdesigner, to see if I was missing
something. Here's their response:

"After reading your email again I realized that this is not supported, sorry
:( "Will try to work on a solution to support it - but why do you want to

Fahd Murtaza

unread,
Mar 19, 2009, 1:30:38 PM3/19/09
to Professi...@googlegroups.com
But I have seen that PHPDesigner guy. He is really good and much responsive to the public demands. If any .NET / Delphi guys are listening to me, why not make a PHP editor thats completely open source. I think so many guys would have HTML IDEs. All it takes is a little giving and everyone among us is capable of giving back to the world which feed us.

Fahd Murtaza

unread,
Mar 19, 2009, 1:35:14 PM3/19/09
to Professi...@googlegroups.com
Thats nice Steven.

Steven Wright

unread,
Mar 19, 2009, 1:45:34 PM3/19/09
to Professi...@googlegroups.com
Cool let me know how it works out for you.
 
S


From: Professi...@googlegroups.com [mailto:Professi...@googlegroups.com] On Behalf Of Fahd Murtaza
Sent: Thursday, March 19, 2009 1:35 PM
To: Professi...@googlegroups.com

Robert Gonzalez

unread,
Mar 19, 2009, 2:54:24 PM3/19/09
to Professi...@googlegroups.com
Many IDEs and editors are open source. I tend to think that many programmers have just followed the crows and ended up using a format they don't like because that is what the editor tells them they have to do.

Jesse makes a good point... why should the software tell us, the user, how we need to do something. The software should receive our instruction, not instruct us an how it likes to be handled.

Looking at Notepad++, it seems to not autoindent for you. It is a great little coding tool, though not nearly as powerful as an IDE. Have you looked at PSPad or UltraEdit as alternatives, Jesse?
--
Robert A. Gonzalez

Doskei

unread,
Mar 20, 2009, 8:51:26 AM3/20/09
to Professional PHP Developers
Fahd ~
You're absolutely right, I continued talking to him back and forth
after that email. It's funny - the professionalism of the product, as
well as his site, made me think it was some software giant that built
it. Turns out, it's one guy, who develops the software and provides
the support himself, in addition to his studies. That's amazingly
impressive, and frankly I feel bad for picking on him.

Steven ~
Well, I AM using eclipse. Or rather, I started this whole process
using eclipse. I'm sure you like the code style that eclipse forces
on you - I don't.

Robert ~
Indeed, notepad++ is so far the only remaining editor that doesn't
autoindent. I haven't tried PSPad or UltraEdit - I'll take a look at
those. However...

All ~
I do think I've found a way to use one of these preconfigured editors
(DW CS4 / Eclipse / phpdesigner) without having to undo their
autoformatting every time. I've written a little autohotkey
replacement script that will detect when I type [curlybrace enter] and
replace it with [curlybrace enter backspace], which should (I haven't
really tested it yet) essentially counter-auto-format. :)

I realize that probably a lot of people think I'm being unnecessarily
nitpicky about a single character. How hard is it to delete an extra
tab, right? But the point is, a) that this will happen A LOT because
started a nested statement is extremely common and b) application
developers shouldn't dictate this kind of thing to coders.

So yeah, I don't want to belabor this point too much further. At this
point it just feels like I'm whining, when realistically finding a
custom scripting solution is my best bet for being able to just move
forward. I appreciate like crazy all the advice offered here, and I'm
very encouraged by the level of expertise and camaraderie in this
group.

Steven Wright

unread,
Mar 20, 2009, 9:25:38 AM3/20/09
to Professi...@googlegroups.com
As I said. Eclipse does not force a code style on you. You tell the
formatter what style you want to use. I am sorry if that was not clear. As a
rule I don't use any tool that forces me to do anything.





-----Original Message-----
From: Professi...@googlegroups.com
[mailto:Professi...@googlegroups.com] On Behalf Of Doskei
Sent: Friday, March 20, 2009 8:51 AM
To: Professional PHP Developers
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP
editor)


Doskei

unread,
Mar 23, 2009, 10:40:34 AM3/23/09
to Professional PHP Developers
Steven ~

I think I'm not understanding. I realize now that when you made your
original post, that you weren't saying that you "use" the default it
gives you, but that you use a control to affect it. However, I don't
know how to do that. Is it in the Template options?
Essentially, yeah, I'm not clear on how to do what you suggested.
Assume I'm an eclipse idiot (true), and help me find it?

Steven Wright

unread,
Mar 23, 2009, 10:45:04 AM3/23/09
to Professi...@googlegroups.com
1) Load the PHPEclipse plugin
2) In Eclipse click Window>Preferences>PHPEclipse>PHP>Formatter

There you will find options for formatting your code. Its not too extensive
but it does allow you to set where the braces go.

S

-----Original Message-----
From: Professi...@googlegroups.com
[mailto:Professi...@googlegroups.com] On Behalf Of Doskei
Sent: Monday, March 23, 2009 10:41 AM
To: Professional PHP Developers
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP
editor)


Doskei

unread,
Mar 23, 2009, 11:03:48 AM3/23/09
to Professional PHP Developers
Steven ~

Ok, so if you'll notice, I replied to that earlier. I don't have the
menu you mention. It could be that I'm running a different version of
Eclipse from what you suggest. See my post Mar 18, 6:23 pm.
I have a similar path: Window --> Preferences --> PHP --> Code Style --
> Formatter. However, this menu does not contain any controls
whatsoever for handling curlybraces. There's a link in that post to a
screenshot image of this menu, in case you don't believe me.
If what I need is a different version of eclipse, I'm fine with that.
The one I'm running is the "All-In-One PDT 2.0 (Windows 32-bit)" from
http://www.eclipse.org/pdt/downloads/. As this is the PDT, I assume
that it includes the PHPEclipse plugin. However, since the first
point where I can't follow your suggestions is at the point where I'm
supposed to go into the PHPEclipse menu, maybe I'm mistaken.
I'll go mess around a bit with Eclipse, and see if I can find a place
to install / reinstall the plugin you mention. Maybe that's all I
need.

Doskei

unread,
Mar 23, 2009, 11:16:42 AM3/23/09
to Professional PHP Developers
Alright, so the reason I didn't have the PHPEclipse menu, as I
suspected, is because apparently the PDT doesn't come with
PHPEclipse. Now I have the plugin proper.

However, I still don't have curlybrace controls on the menu you
mention. For me, that menu has three tabs, with the following
controls

New Lines:
* Insert a new line before an opening brace
* Insert new lines in control statements
* Clear all blank lines
* Insert a new line inside an empty block

Line Splitting
* Maximum line length (80)

Style
* Compact assignment
* Compact string concatenation
* Compact arrays
* Indentation is represented by a tab
* Number of spaces representing a tab (4)

Nothing here seems to relate to what I'm trying to do. Am I missing
something obvious?

Steven Wright

unread,
Mar 23, 2009, 11:20:48 AM3/23/09
to Professi...@googlegroups.com
This is the version that I am running:

Eclipse SDK

Version: 3.4.1
Build id: M20080911-1700

This is the plugin information:

Name: PHPeclipse
Identifier: new.sourceforge.phpeclipse.feature.feature.group
Version: 1.2.1.200810130444PRD
Provider: PHPEclipse Project Team
Description: PHPEclipse - PHP development tools.



-----Original Message-----
From: Professi...@googlegroups.com
[mailto:Professi...@googlegroups.com] On Behalf Of Doskei
Sent: Monday, March 23, 2009 11:04 AM
To: Professional PHP Developers
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP
editor)


Steven Wright

unread,
Mar 23, 2009, 11:20:50 AM3/23/09
to Professi...@googlegroups.com
Insert New Lines In Control Statements.



-----Original Message-----
From: Professi...@googlegroups.com
[mailto:Professi...@googlegroups.com] On Behalf Of Doskei
Sent: Monday, March 23, 2009 11:17 AM
To: Professional PHP Developers
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP
editor)


Doskei

unread,
Mar 23, 2009, 11:33:55 AM3/23/09
to Professional PHP Developers
Steven ~

OK, we're closer to being on the same page here - I have the same
version info for both Eclipse and PHPEclipse.
However, checking that box hasn't changed the functionality that I'm
talking about. Is that all I should have to do, or do I need to add a
custom control as well?
class NewThing
{

Immediately becomes
class NewThing
{
| <-(cursor)
}

Where I want it to be
class NewThing
{
| <-(cursor)
}

Steven Wright

unread,
Mar 23, 2009, 11:43:38 AM3/23/09
to Professi...@googlegroups.com
I am not sure about that. I am sorry I must have mis-understood your need. I
thought you wanted the following:

Class
{
| <- (cursor)
}

Function ()
{
| <- (cursor)
}

Conditional ()
{
| <- (cursor)
}

This should happen automatically and also if you hit Ctr-Shift-F the file
should format.

Sorry for the confusion.



-----Original Message-----
From: Professi...@googlegroups.com
[mailto:Professi...@googlegroups.com] On Behalf Of Doskei
Sent: Monday, March 23, 2009 11:34 AM
To: Professional PHP Developers
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP
editor)


Robert Gonzalez

unread,
Mar 23, 2009, 12:53:21 PM3/23/09
to Professi...@googlegroups.com
PHPEclipse and EclipsePDT are entirely different apps. You do NOT want to install the PHPEclipe plugin if you are running PDT. In fact, I believe PDT has become *the* PHP plugin for Eclipse (I can be wrong about this, but I think PDT is officially supported by the Eclipse foundation and several other PHP development organizations).
--
Robert A. Gonzalez

Doskei

unread,
Mar 23, 2009, 12:55:24 PM3/23/09
to Professional PHP Developers
Absolutely no worries, and I certainly appreciate your help.

So, back at square one - so far the autohotkey script is the only way
to get around this issue.
I only hope that there will be enough Dreamweaver folks flooding the
IDE market, all pissed about this very change in CS4, looking for an
IDE that doesn't have the same flaw. I know it's a pipe dream at this
point, but I'd sure be happy if this got changed in future versions of
PHPDesigner and/or Eclipse.

Again, thanks to everyone for their help. I'll stop bumping this and
let more productive discussions take over :)

Robert Gonzalez

unread,
Mar 23, 2009, 1:00:21 PM3/23/09
to Professi...@googlegroups.com
I still think you can do this in the templates. In fact, I think the templates drive the indentation.

Preferences->PHP->Editor->Templates

Try changing a few of them to see if that controls the indentation. I only say this because in my templates, which work the way I code and happen to be the same as the default installation, they open a brace, add the closing brace, insert the cursor in between the braces and indent the cursor all at the same time:

if (${condition}) {
${cursor};
--
Robert A. Gonzalez

Steven Wright

unread,
Mar 23, 2009, 2:02:03 PM3/23/09
to Professi...@googlegroups.com
Hey Robert thanks. I will have to check into PDT. Thanks for the tip.


From: Professi...@googlegroups.com [mailto:Professi...@googlegroups.com] On Behalf Of Robert Gonzalez
Sent: Monday, March 23, 2009 12:53 PM
To: Professi...@googlegroups.com

Doskei

unread,
Mar 23, 2009, 2:13:24 PM3/23/09
to Professional PHP Developers
Yes, if I write a template that is formatted the way I like it, it
will work - for that template. However there are two issues:
a) I have to try to think of every single case where I might
conceivably want to start a block of code with a curlybrace, and write
a template accordingly
b) In several cases, especially when I'm trying to do something
completely trivial, ctrl+j is actually MORE work than just deleting
the auto-added tab, because eclipse wants to know which of several
templates I want to use. In plenty of cases, the number of keystrokes
required to choose the template I want to use exceeds the total number
of keystrokes in the template. In short, templates are terribly
inefficient for simple statements, and thus useless for my purposes
(making coding more efficient).

At this point, when I type curlybrace enter, I get a new line indented
to the same point as the curlybrace. I get this, because I have a
script that automatically deletes the automatic formatting that
eclipse is applying. This is, as of this point, the gold standard -
it takes no extra keystrokes on my part, I don't have to do any work
in the backend to account for situational uses of the curlybrace, I
just write code, and my goon script reverses the unwanted corrections
that the IDE adds. The only solution that can exceed this
functionality would be for the eclipse developers to make this an
option that can be disabled. I can't imagine that it would be
difficult, but the fact that they didn't see any reason not to dictate
this layout to every coder that uses their software also makes me
unwilling to work within the confines of their option menus to solve
it.

Doskei

unread,
Mar 24, 2009, 6:12:24 PM3/24/09
to Professional PHP Developers
As it turns out, my script isn't good enough. It fixes the auto
formatting that eclipse applies when I start the braced statement.
However, as soon as I type a valid php keyword, it reapplies the
indentation.
I can't even describe how furious this makes me. If this was a post
on the eclipse mailing list, there would be more expletives than
meaningful words. As it stands, I've had to write this post three
times just to keep some semblance of civility.

Every remotely competent coder I know spends hours and hours and hours
thinking of every contingency in their code. Every if statement I've
ever written has prompted the corresponding thought: what if that
doesn't cover all the valid possibilities.
Across the world there are some very smart idiots, writing IDEs with
super duper "helpful" code formatting, and not ONE of them has taken
the time out of their day to ask themselves if there might be some
merit in giving users the option to turn all their pompous dictatorial
code-formatting edicts (you can't call it an option if there's no
choice involved) off.

I am filled with impotent rage. But since I know it's impotent, I'll
stop here and just say, I'm done with Eclipse. I'll go back to coding
in Dreamweaver CS3.
Thanks for all your help, folks. Hopefully my next question here
won't be so hopeless, or so infuriating.

Robert Gonzalez

unread,
Mar 24, 2009, 6:31:40 PM3/24/09
to Professi...@googlegroups.com
If a solution comes up do you want me to post it back here? Would that offer any value to you? I am not trying to win you over, just asking if there would be any value if a solution to this issue was found in any IDE.
--
Robert A. Gonzalez

Doskei

unread,
Mar 24, 2009, 7:59:43 PM3/24/09
to Professional PHP Developers
Robert ~

Oh absolutely. The whole débâcle has convinced me that this is a
complete non-issue for anyone but me, and the likelihood that it gets
changed seems minuscule. That said, I like to think that even furious
I'm still reasonable, so by all means, if this changes let me know.
I'd be ecstatic.

Robert Gonzalez

unread,
Mar 24, 2009, 8:05:32 PM3/24/09
to Professi...@googlegroups.com
Not sure if this is a PDT thing or a ZendStudio for Eclipse thing, but try going to Preferences->PHP->Formatter. I apologize if this is in ZS only. I haven't had the chance to check if this is a PDT (in 3.4) thing. I know it is not in PDT for 3.3.
--
Robert A. Gonzalez

Doskei

unread,
Mar 24, 2009, 8:26:40 PM3/24/09
to Professional PHP Developers
Well, it's not in PDT, but that's not to say it's not worthwhile.

I don't have that menu at all. The closest I have would be
Preferences --> PHP --> Code Style --> Formatter, which as I mentioned
earlier doesn't have anything but a pair of options determining
whether to use tabs or spaces, and how many spaces are in a tab. I
don't have a "Formatter" menu directly inside PHP.

What's the option you have in your version? I'm not averse to
installing ZS even if it's just for this one trivial change, if it'll
override Eclipse's behavior.

Steven Wright

unread,
Mar 24, 2009, 8:32:55 PM3/24/09
to Professi...@googlegroups.com
Man I am sorry you are so frustrated, but I completely understand. On a good
note I installed Aptana and am loving it. Thanks for the tip Robert.



-----Original Message-----
From: Professi...@googlegroups.com
[mailto:Professi...@googlegroups.com] On Behalf Of Doskei
Sent: Tuesday, March 24, 2009 6:12 PM
To: Professional PHP Developers
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP
editor)


Steven Wright

unread,
Mar 24, 2009, 8:34:11 PM3/24/09
to Professi...@googlegroups.com
Whats really lame is that I did Java using Eclipse and there are all sorts
of options for how you want to format the code.



-----Original Message-----
From: Professi...@googlegroups.com
[mailto:Professi...@googlegroups.com] On Behalf Of Doskei
Sent: Tuesday, March 24, 2009 8:27 PM
To: Professional PHP Developers
Subject: [Pro. PHP Dev.] Re: Auto-indent and Eclipse (or any good PHP
editor)


Reply all
Reply to author
Forward
0 new messages