Ctags breaks PHP Intellisensing

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Ctags breaks PHP Intellisensing

Post by jussij »

Unfortunately it appears the Exuberant CTAGS support PHP is not as good as it could be :(

Consider the following snippet of PHP code:

Code: Select all

class MyClass 
{
  // the constructor 
  function MyClass() 
  {
  }

  // the method
  function MyMethod($gear) 
  {
  }
};
If this code is saved to a test.php file and parsed by ctags, the following tags are produced:

Code: Select all

MyClass  test.php /^class MyClass$/;           " kind:class    line:2  language:PHP
MyClass  test.php /^function MyClass()$/;      " kind:function line:5  language:PHP
MyMethod test.php /^function MyMethod($gear)$/;" kind:function line:10 language:PHP
If the same code is then saved to a test.cpp file, ctags will now produce the following tags:

Code: Select all

MyClass  test.cpp /^class MyClass$/;           " kind:class    line:1 language:C++ file:
MyClass  test.cpp /^function MyClass()$/;      " kind:function line:4 language:C++ class:MyClass file: access:private signature:()
MyMethod test.cpp /^function MyMethod($gear)$/;" kind:function line:9 language:C++ class:MyClass file: access:private signature:($gear)
It appears the c/c++ tagger is doing a better job of tagging the PHP code than the PHP tagger itself :)

For example, the c/c++ tagger correctly identifies the MyMethod method belonging to the MyClass class, while the PHP tagger incorrectly sees the method as a function, no way related to the class.

Since Zeus uses the ctags output to populate the class browser and uses the class browser to manage the code completion and intellisensing, in the case described the PHP class browser information is wrong and as such the intellisensing will not work as well as it should :(

Jussi
Post Reply