NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
[resolved] Code completion - an ongoing problem in PhpED.


Joined: 21 Oct 2004
Posts: 81
Location: UK
Reply with quote
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.
View user's profileFind all posts by QuboidSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
you may want to add prototypes the same way as it's done for PDO, SPL and DOM: http://forum.nusphere.com/code-completion-for-php-spl-dom-pdo-and-dom-t1733.html

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
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.
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
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:

Code:
$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
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
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:

Code:
$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.
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
may I ask you to name the other editor? I'll give it a try and possibly come with solution and/or will promise to improve PhpED Smile

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
No problem, it is the total wast of money editor "Zend Studio"

Switch to PHP5 in the preferences, and start writing code that use PDO or any other SPL class.

And as soon as you hit -> you will see that it works without problems.
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
I just tried and no, it did not work.
Check youself with code below:

Code:
<?php

$v = new DirectoryIterator('');
foreach ($v as $f) {
   $f->
   
}

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
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.
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
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 Smile

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
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
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.

Code:
<?php
    $db = new PDO('mysql:host=localhost;dbname=eurofishkonv','fishuser','eurofish');
?>
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
I just got a message from our QA team. They managed to replicate the prob. with the following two files in the project:
Code:
<?php
class bb {
   function amethod() {
   }
}
class aa {
   /** @returns bb */
   function prepare() {
   }
}
  $d = new aa();
  $v = '';
?>


Code:
<?php
  $v = $d->prepare();
  $v->
?>


It will be fixed soon.
But there is nothing unstable Smile
My appologies Exclamation

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
[resolved] Code completion - an ongoing problem in PhpED.
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  

  
  
 Reply to topic