Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » PDT Code Assist
PDT Code Assist [message #99021] Thu, 25 June 2009 14:13 Go to next message
Frank is currently offline FrankFriend
Messages: 2
Registered: July 2009
Junior Member
I'm a complete newbie to PHP and PDT, so please forgive my ignorance in
advance.

I installed Galileo and PDT yesterday, and started working through a
couple of the beginner tutorials in PDT Help. A couple of minor things
occurred.

1) I noticed that when I created a new PHP Page (file>new>PHP file)the
code page that was created lacked the closing ?> markup. Is that normal?

2) Code assist only works when I press CTL-space. I followed the help
instructions, and verified that window>preferences>PHP>editor>Code Assist
had the Enable auto activation box was checked. Actually, I still had
Ganymede files installed, so I fired it up, and it has the same behavior,
although it did add the closing ?> that I mentioned in #!.

These are minor issues, but obviously I'd like to have all the
functionality operable. Thanks, in advance, for your help, and also if
you know of any good beginner resources, I'd be happy to hear about them.

ftc
Re: PDT Code Assist [message #99052 is a reply to message #99021] Thu, 25 June 2009 14:32 Go to previous messageGo to next message
exceptione is currently offline exceptioneFriend
Messages: 96
Registered: July 2009
Member
> 1) I noticed that when I created a new PHP Page (file>new>PHP file)the
> code page that was created lacked the closing ?> markup. Is that normal?

Yep, not closing a file with ?> is actually recommended.

> 2) Code assist only works when I press CTL-space. I followed the help
> instructions, and verified that window>preferences>PHP>editor>Code
> Assist had the Enable auto activation box was checked. Actually, I
> still had Ganymede files installed, so I fired it up, and it has the
> same behavior, although it did add the closing ?> that I mentioned in #!.
>
You are right that autocompletion is a bit Spartan.
In comparison to Visual Studio you need to hit the keyboard very often
to trigger autocompletion. Eclipse/pdt does litte to follow you with
advise.

You can see in window>preferences>PHP>editor>Code Assist that there are
autocompletion trigger characters. Only when you enter these characters,
autocompletion pops up. Code assist will also be there if you type "new "


Code assist is thus very limited. To improve this situation I would
suggest heading over to this bug report and add your vote:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=204768
Re: PDT Code Assist [message #99066 is a reply to message #99021] Thu, 25 June 2009 14:51 Go to previous messageGo to next message
Basil Gohar is currently offline Basil GoharFriend
Messages: 24
Registered: July 2009
Junior Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/25/2009 10:13 PM, Frank wrote:
> I'm a complete newbie to PHP and PDT, so please forgive my ignorance in
> advance.
>
> I installed Galileo and PDT yesterday, and started working through a
> couple of the beginner tutorials in PDT Help. A couple of minor things
> occurred.
>
> 1) I noticed that when I created a new PHP Page (file>new>PHP file)the
> code page that was created lacked the closing ?> markup. Is that normal?
>
> 2) Code assist only works when I press CTL-space. I followed the help
> instructions, and verified that window>preferences>PHP>editor>Code
> Assist had the Enable auto activation box was checked. Actually, I
> still had Ganymede files installed, so I fired it up, and it has the
> same behavior, although it did add the closing ?> that I mentioned in #!.
>
> These are minor issues, but obviously I'd like to have all the
> functionality operable. Thanks, in advance, for your help, and also if
> you know of any good beginner resources, I'd be happy to hear about them.
>
> ftc
>

Frank,

1) PHP does not require a closing "?>" on scripts. Execution will end
without a problem upon the end of a file. In fact, the Zend Framework
coding guidelines recommend leaving-off the closing "?>" if you do not
intend anything after the PHP portion of a script, as that will also
ensure there aren't any erroneous whitespace characters, which can wreak
havoc with scripts that output arbitrary data, such as a download
script. Unintended trailing whitespace is a culprit in many a broken
script.

PDT, therefore, does this intentionally.

Hopefully someone with more than just trivial knowledge can answer #2
for you. ;)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkpDju4ACgkQaVgOCFr0s2I8lgCdE58+v/dEAEPTu11B34Ky 5D4z
j54An0lNfAf/jXWd8jVMihrouDjy6a8S
=uVey
-----END PGP SIGNATURE-----
Re: PDT Code Assist [message #99081 is a reply to message #99052] Thu, 25 June 2009 14:56 Go to previous messageGo to next message
Basil Gohar is currently offline Basil GoharFriend
Messages: 24
Registered: July 2009
Junior Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/25/2009 10:32 PM, Exception e wrote:
> Code assist is thus very limited. To improve this situation I would
> suggest heading over to this bug report and add your vote:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=204768

Code assist is painfully slow on my Fedora system. Having it enabled
automatically, even for non-variables, seems like an impending nightmare
unless that speed is fixed.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkpDkC0ACgkQaVgOCFr0s2Kr2wCfbP5iADD9pKXg5MZ33bI9 Miwb
YU4AnRyKA0Z9hwdcHPoaFT7riSqzB1ma
=CJk8
-----END PGP SIGNATURE-----
Re: PDT Code Assist [message #99127 is a reply to message #99066] Thu, 25 June 2009 20:20 Go to previous messageGo to next message
Frank is currently offline FrankFriend
Messages: 2
Registered: July 2009
Junior Member
Thanks for all for your insight.

ftc
Re: PDT Code Assist [message #99192 is a reply to message #99052] Sat, 27 June 2009 11:49 Go to previous messageGo to next message
Marko Karjalainen is currently offline Marko KarjalainenFriend
Messages: 30
Registered: July 2009
Member
On 25.6.2009 17:32, Exception e wrote:

Thanks for this, eclipse 2.1 hangs every time when typing $ char.
So i removed it from autocompletion trigger characters and now i can "use" PDT again.

>
>> 1) I noticed that when I created a new PHP Page (file>new>PHP file)the
>> code page that was created lacked the closing ?> markup. Is that normal?
>
> Yep, not closing a file with ?> is actually recommended.
>
>> 2) Code assist only works when I press CTL-space. I followed the help
>> instructions, and verified that window>preferences>PHP>editor>Code
>> Assist had the Enable auto activation box was checked. Actually, I
>> still had Ganymede files installed, so I fired it up, and it has the
>> same behavior, although it did add the closing ?> that I mentioned in #!.
>>
> You are right that autocompletion is a bit Spartan.
> In comparison to Visual Studio you need to hit the keyboard very often
> to trigger autocompletion. Eclipse/pdt does litte to follow you with
> advise.
>
> You can see in window>preferences>PHP>editor>Code Assist that there are
> autocompletion trigger characters. Only when you enter these characters,
> autocompletion pops up. Code assist will also be there if you type "new "
>
>
> Code assist is thus very limited. To improve this situation I would
> suggest heading over to this bug report and add your vote:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=204768
Re: PDT Code Assist [message #99281 is a reply to message #99052] Mon, 29 June 2009 20:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mnm.criion.net

| Yep, not closing a file with ?> is actually recommended.

Where do you see this recommended?
--
-michael
Re: PDT Code Assist [message #99293 is a reply to message #99066] Mon, 29 June 2009 20:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mnm.criion.net

This is a thing only to be considered when using the Zend Framework! The
arguments for not closing a php tag is just an expression of bad coding
style, no matter who ever, Zend or PHP says otherwise. Clean Code or
Pragmatic Programmer or some such book is a good start for experienced
programmers to sharpen up your talents.
--
-michael
Re: PDT Code Assist [message #99308 is a reply to message #99293] Mon, 29 June 2009 21:08 Go to previous messageGo to next message
exceptione is currently offline exceptioneFriend
Messages: 96
Registered: July 2009
Member
Michael Madsen schreef:
> This is a thing only to be considered when using the Zend Framework! The
> arguments for not closing a php tag is just an expression of bad coding
> style, no matter who ever, Zend or PHP says otherwise. Clean Code or
> Pragmatic Programmer or some such book is a good start for experienced
> programmers to sharpen up your talents.
What does make you think that this is only to be considered for zf?

Not closing php scope helps prevent accidents like additional whitespace
which will cause session initialization to fail ("headers already sent").
So this applies to quite a lot of situations.

It's nice you've seen or read the books you mentioned, but it has
nothing to do with this practice.
Re: PDT Code Assist [message #99337 is a reply to message #99281] Tue, 30 June 2009 10:05 Go to previous messageGo to next message
sNop is currently offline sNopFriend
Messages: 281
Registered: July 2009
Senior Member
Michael Madsen napsal(a):
> | Yep, not closing a file with ?> is actually recommended.
>
> Where do you see this recommended?

e.g. here:
http://framework.zend.com/manual/en/coding-standard.php-file -formatting.html#coding-standard.php-file-formatting.general
Re: PDT Code Assist [message #99396 is a reply to message #99337] Tue, 30 June 2009 14:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ernst.cron-it.de

sNop wrote: on 30.06.2009 12:05:

>> | Yep, not closing a file with ?> is actually recommended.
>>
>> Where do you see this recommended?
>
> e.g. here:
> http://framework.zend.com/manual/en/coding-standard.php-file -formatting.html#coding-standard.php-file-formatting.general

To me that is a nonesense recommendation.

You could as well define in your coding guidelines that "no empty lines
are permitted after the closing ?>". How should that "inject trailing
white space into the response"???

Cheers,
Ernesto
Re: PDT Code Assist [message #99425 is a reply to message #99396] Tue, 30 June 2009 15:17 Go to previous messageGo to next message
Basil Gohar is currently offline Basil GoharFriend
Messages: 24
Registered: July 2009
Junior Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/30/2009 10:19 PM, Ernesto Baschny [cron IT] wrote:
> sNop wrote: on 30.06.2009 12:05:
>
>>> | Yep, not closing a file with ?> is actually recommended.
>>>
>>> Where do you see this recommended?
>> e.g. here:
>> http://framework.zend.com/manual/en/coding-standard.php-file -formatting.html#coding-standard.php-file-formatting.general
>
> To me that is a nonesense recommendation.
>
> You could as well define in your coding guidelines that "no empty lines
> are permitted after the closing ?>". How should that "inject trailing
> white space into the response"???
>
> Cheers,
> Ernesto

One advantage would be that, as a recommendation, it would work in all
editors. Some (poorly-designed) editors don't give the coder complete
control over their editing, and thus, sometimes add whitespace
characters when they try to "help" him. By leaving-out the closing tag
at the end of the file, even this is worked around.

I cannot speak for the framers of the Zend Framework coding
recommendations, but I like this particular recommendation, and follow
it myself, and I am sure there are other reasons to do so as well.

The fact that it's perfectly valid PHP markup should really make it a
non-issue. It's just the default PHP template in PDT, which was written
with the Zend Framework in mind.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkpKLIQACgkQaVgOCFr0s2JtqgCgmhZsOcQqbiWwBF/VwezG L0gg
VRgAoKKwc//Rfg5L5Cr4DPIUGaqKJe0/
=OXWR
-----END PGP SIGNATURE-----
Re: PDT Code Assist [message #99451 is a reply to message #99425] Wed, 01 July 2009 09:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mnm.criion.net

That is not an advantage but a quickfix for a problem elsewhere. Look at
IE, a poorly designed browser for which we have to make hacks and what
not. The problem is IE, not that hacks aer hard to implement and
timeconsuming. As I stated in another reply here, this recommendation is
only for when the zend framework is used and NOT for normal php
development. Making quickfixes to cover up bad coding style and/or
discipline does not justify them.

> The fact that it's perfectly valid PHP markup should really make it a
> non-issue.

Good programming experience tells us not to relay too heavily on
language defaults as they can change over time or introduce issues. Just
because we can, doesn't mean we should.
--
-michael
Re: PDT Code Assist [message #99463 is a reply to message #99308] Wed, 01 July 2009 09:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mnm.criion.net

> What does make you think that this is only to be considered for zf?

If you read me post closely you will find the answer. But to help you
this is it:

The arguments for not closing a php tag is just an expression of bad
coding style, no matter who ever, Zend or PHP says otherwise.

If you have problems with whitespaces either enable pdt's removal of
trailing whitespace or remove manually. I would suspect the cause of
this problem is to much copy&paste. I don't have this problem and when
it happens from time to time, I am noticed by php when the page is run.
If this is a problem it sounds like you are doing development on live
sites which in any case is a big mistake and still does not make your
arguments valid.
--
-michael
Re: PDT Code Assist [message #99477 is a reply to message #99451] Wed, 01 July 2009 11:02 Go to previous messageGo to next message
Basil Gohar is currently offline Basil GoharFriend
Messages: 24
Registered: July 2009
Junior Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/01/2009 05:24 PM, Michael Madsen wrote:
> That is not an advantage but a quickfix for a problem elsewhere. Look at
> IE, a poorly designed browser for which we have to make hacks and what
> not. The problem is IE, not that hacks aer hard to implement and
> timeconsuming. As I stated in another reply here, this recommendation is
> only for when the zend framework is used and NOT for normal php
> development. Making quickfixes to cover up bad coding style and/or
> discipline does not justify them.
>
>> The fact that it's perfectly valid PHP markup should really make it a
>> non-issue.
>
> Good programming experience tells us not to relay too heavily on
> language defaults as they can change over time or introduce issues. Just
> because we can, doesn't mean we should.

It's also documented within the PHP manual here:

http://www.php.net/manual/en/language.basic-syntax.instructi on-separation.php

I don't want to drive the point, but you are equating it with bad
programming style, whereas I disagree and see it as fine. I think part
of the advantage for me is that I do *not* mix PHP & non-PHP (e.g.,
HTML) code output. I do everything from within PHP, so my PHP files are
all PHP code, and do not enter and escape from HTML. I do this for
consistency purposes, and therefore, I have no need to use the closing
PHP tags. So, it fits in well with my style.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkpLQlMACgkQaVgOCFr0s2LSMACgsBhZRvuo50s2B2Bqr8px mLaX
34IAnitDHUmFh4JQlmn6KdP7TY4u2INB
=AJja
-----END PGP SIGNATURE-----
Re: PDT Code Assist [message #99491 is a reply to message #99192] Thu, 02 July 2009 14:07 Go to previous messageGo to next message
Bruce Heller is currently offline Bruce HellerFriend
Messages: 7
Registered: July 2009
Junior Member
Hello.

I have the exact same problem. I'm a bit new to bugzilla & stuff so I
don't know how to post this and where...

It used to work well in 2.1 RC but on the final release, typing a $ will
make Eclipse hangs and use a lot of memory...

I removed autocompletion for a while but it is NOT a solution.

Best.


Marko Karjalainen wrote:

> On 25.6.2009 17:32, Exception e wrote:

> Thanks for this, eclipse 2.1 hangs every time when typing $ char.
> So i removed it from autocompletion trigger characters and now i can "use"
PDT again.
Re: PDT Code Assist [message #99505 is a reply to message #99491] Sat, 04 July 2009 02:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

Report bugs at:

http://bugs.eclipse.org/bugs

Dave

Bruce Heller wrote:
> Hello.
>
> I have the exact same problem. I'm a bit new to bugzilla & stuff so I
> don't know how to post this and where...
>
> It used to work well in 2.1 RC but on the final release, typing a $ will
> make Eclipse hangs and use a lot of memory...
>
> I removed autocompletion for a while but it is NOT a solution.
>
> Best.
>
>
> Marko Karjalainen wrote:
>
>> On 25.6.2009 17:32, Exception e wrote:
>
>> Thanks for this, eclipse 2.1 hangs every time when typing $ char.
>> So i removed it from autocompletion trigger characters and now i can
>> "use"
> PDT again.
>
Re: PDT Code Assist [message #99702 is a reply to message #99021] Mon, 06 July 2009 19:27 Go to previous message
Andras Janurik is currently offline Andras JanurikFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

I experience something strange with code assist in 2.1.
It is working fine at root level in a php file,
but if start a function, inside the function it does not work
for global variables ($GLOBALS, $_REQUEST, etc.).
It works only for variables defined inside the function.

Is this intentional, or is there a preferences setting for it?

Thanks,

Andras J.
Previous Topic:Line indentation, different from project to project
Next Topic:Build path contains duplicate entry
Goto Forum:
  


Current Time: Fri Apr 26 22:37:09 GMT 2024

Powered by FUDForum. Page generated in 0.05040 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top