 |
 | [resolved] Code completion - an ongoing problem in PhpED. |  |
Joined: 21 Oct 2004 |
Posts: 81 |
Location: UK |
|
 |
Posted: Sun Sep 16, 2007 8:25 pm |
|
 |
 |
 |
 |
I've seen this problem brought up before in parts and never satisfactorily addressed. Many newer functions, constants, classes and methods lack code completion. PDO is the most mentioned candidate. I've found the whole Filter library (built into PHP 5.2) isn't there, especially problematic because of Filter's dizzying list of constants. There's also SPL, stream_socket_shutdown() and more, not to mention PEAR and PECL stuff. I know there are some workarounds, particularly for SPL and PDO, but these are a bit confusing and messy (e.g. including per project when they are build in to PHP is counter-intuitive).
Why aren't these in PhpED like strlen() and a million others? Failing that, why isn't there a simple way to download all prototype files and include them for all projects? Is it a case of playing catchup with PHP? This is simple and important, no? I know you have people requesting all kinds of things and that includes me, but this should be a priority, it's one of the main reasons for using an IDE. As much as I hate the excess messages when syncing a project, that's a feature request while up to date code completion is a basic must have feature which I'd say is presently bugged.
|
|
 |
 | |  |
 |
 | |  |
Veteran
Joined: 30 Nov 2006 |
Posts: 186 |
|
|
 |
Posted: Thu Sep 20, 2007 5:07 am |
|
 |
 |
 |
 |
Just have to ad.
Correct this is frustrating, and I hope that it will be improved in a future version of PHPed
The problem is not that it is fixable by including prototypes, because as I have written in the other post, it does not work great with those imported files.
On one line it works, the next it does not, or it gets "confused" and identifies the object as a different object.
PHP4 is announced dead by the end of this year, and PHP5 will be what people are beginning to use.
I am used to develop in an object oriented fashion, so I really need improved code completion when it comes to those standard classes.
I mean, this is actually something that your zhitty competitor is capable of. And it does it well, but then it does not do any other thing well.
|
|
 |
 | |  |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8351 |
|
|
 |
Posted: Thu Sep 20, 2007 5:29 am |
|
 |
 |
 |
 |
Quote: | because as I have written in the other post, it does not work great with those imported files |
It does its best and works rather good with those prototypes imported.
If php was a strict language with all types and variables defined, code completion would work much better.
Say I have the code below, would you youself with all your experience tell me what class type is in the variable $a:
$b = new MyPrettyClass('DirectoryIterator');
foreach($b as $a) {
$a ->
} |
It's clear that if $a was defined, we would know its type easily. This poor approach is referred to as 'php dynamic language'.
|
_________________ The PHP IDE team
|
 |
 | |  |
Veteran
Joined: 30 Nov 2006 |
Posts: 186 |
|
|
 |
Posted: Thu Sep 20, 2007 5:39 am |
|
 |
 |
 |
 |
dmitri wrote: | Quote: | because as I have written in the other post, it does not work great with those imported files |
It does its best and works rather good with those prototypes imported.
If php was a strict language with all types and variables defined, code completion would work much better.
Say I have the code below, would you youself with all your experience tell me what class type is in the variable $a:
$b = new MyPrettyClass('DirectoryIterator');
foreach($b as $a) {
$a ->
} |
It's clear that if $a was defined, we would know its type easily. This poor approach is referred to as 'php dynamic language'. |
Hey I would prefer strict variable declaration too. I have never understood why people prefers the loose type declaration. It makes it more fail safe to have a strict language.
But all I can say is that it works well in another editor. And because PHPed is THE editor for PHP development, I am expecting it to work in that too.
|
|
 |
 | |  |
Veteran
Joined: 30 Nov 2006 |
Posts: 186 |
|
|
 |
Posted: Thu Sep 20, 2007 7:43 am |
|
 |
 |
 |
 |
Well it is not just a matter of that single instance.
Have a look at these simple examples that dont work in PHPed but works in Z.
Have a look at these simple examples, and see that each time it fails in PHPed, but works in Z.
And YES SPL and PDO are included because it can finde the DirectoryIterator and PDO class, but it can't see the methods on the object declared.
It is very unstable in PHPed, sometimes it works, sometimes it dont.
I can understand why complex situations like the foreach will not work, but simple declarations and use should work every time.
|
|
 |
 | |  |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8351 |
|
|
 |
Posted: Thu Sep 20, 2007 7:59 am |
|
 |
 |
 |
 |
The samples you submitted work just fine in PhpED:
If it does not work for you, please check for three possible reasons below:
-code contains unrecoverable syntax errors on the lines above the cursor location where code completion is invoked.
-SPL.php (PDO.php) is not included in the project and path to it is not included into the Code Insight Includes list
-IDE is still parsing your project and has not finished. Check Code Explorer to see if DirectoryIterator class is listed there. If not you have to wait or have to refresh Code Explorer.
If nevertheless you get any problems with code completion and none of the reasons above are in effect, please submit your code sample or send me your project and I'll check and either explain why it won't work, or suggest a workaround or will fix the problem
Until that there are no problems with Code Completion in PhpED.
|
Last edited by dmitri on Mon Sep 24, 2007 10:42 am; edited 1 time in total _________________ The PHP IDE team
|
 |
 | |  |
Veteran
Joined: 30 Nov 2006 |
Posts: 186 |
|
|
 |
Posted: Sat Sep 22, 2007 11:47 am |
|
 |
 |
 |
 |
The reboot did not fix the problem.
I refreshed the project tree, it did not help.
I then wrote the code that was in the include file, which is where $db is defined, and now the $st-> codecompletion worked.
Note that code completion worked for line 23 but not for line 25, when the include file in line 6 was used, but after I wrote the code in line 7 then code completion worked for line 25 as well.
See the images below, after going back to including the line in line 6, then code completion works for line 23
But it does not work in line 25 with the include file
And again the code in the include file is added here fore reference.
<?php
$db = new PDO('mysql:host=localhost;dbname=eurofishkonv','fishuser','eurofish');
?>
|
|
|
 |
 | |  |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT - 5 Hours
Page 1 of 1
|
|
|
|  |