NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Tags to help autocomplete engine


Joined: 14 Jan 2010
Posts: 2
Reply with quote
Hello,

it would be great to have possibility to help autocomplete engine. If programmer knows something that autocomplete engine doesn't know, programmer could write tags in comments to declare that some variable is of some type.

For example, suppose I have a class Foo and local variable $foo (instance of Foo type, but autocomlete engine can't know this).

Code:

$foo = $bar['foo']; // <-- autocomplete engine doesn't know the type of $foo, but programmer does know it


The solution could be something like this:

Code:

$foo = $bar['foo'];  //@ide: $foo is Foo


For now I always do the workaround like this Sad

Code:

//$foo = new Foo();     // <-- when I'm writing a code, I always have to uncomment this line and comment the next line
$foo = $bar['foo'];
View user's profileFind all posts by mrdecSend private message


Joined: 14 Jan 2010
Posts: 2
Reply with quote
Good forum.
View user's profileFind all posts by mrdecSend private message


Joined: 21 Nov 2009
Posts: 20
Reply with quote
What about
Code:
/** @var Foo */
$foo = $bar['foo'];

?
View user's profileFind all posts by Jan TvrdíkSend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
What Jan said Smile
You should really take a look a phpDoc, PhpED supports most of it.
Make a habit of prefacing all your functions with a PhpDOC block and type your variables as Jan described, it will help you tremendously. Even if you don't use it to generate documentation.
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 02 Feb 2010
Posts: 5
Reply with quote
But some limitation exists:

$a['foo'] = new Foo();

$a['foo']-> *Press space enter and you see nothing*

And that is impossible to describe virtual methods of class with PhpDoc (realized with magic method __call )
View user's profileFind all posts by Mr.SmithSend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
Mr.Smith wrote:
And that is impossible to describe virtual methods of class with PhpDoc (realized with magic method __call )

No it isn't Smile
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 02 Feb 2010
Posts: 5
Reply with quote
For some reason that don't work
View user's profileFind all posts by Mr.SmithSend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
Guess they just added the tag to the list then and did not implement support for it. I just figured since the @property tags are supported that it would be the same for @method.
View user's profileFind all posts by BlizzSend private messageVisit poster's website
Tags to help autocomplete engine
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