Any way to extend the code-completion data?

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
zuggsoft
Posts: 11
Joined: Sat Nov 08, 2008 7:26 am

Any way to extend the code-completion data?

Post by zuggsoft »

I use the CodeIgniter framework for my PHP apps. CodeIgniter provides a large number of classes for use in a PHP application. Is there any way to extend the code-completion system so that these classes are available.

As an example, in CodeIgniter you can call stuff like this:

$this->load->view('file')

where "load" is one of the CodeIgniter library classes (defined in a Loader.php file with a class name of CI_loader). If the Code Completion can be customized in any way, then I might be able to come up with a list of all of these classes to be added by other CodeIgniter users. I'm sure other PHP frameworks have similar needs.

Let me know if this is already possible.
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Re: Any way to extend the code-completion data?

Post by Karlis »

I am actually not sure about this. Built-in php objects are defined in phpobj.ini but here you have a more complex structure. You can try to mess with this ini file anyways.

If it was something like this:

Code: Select all

require('myobject.inc');
$this = new MyObject();
$this->load();
It would work automatically.

Our developer Gatis is currently researching the whole framework thing and he had an idea about extensible auto-complete. But that is currently only an idea.
Karlis Blumentals
Blumentals Software
www.blumentals.net
zuggsoft
Posts: 11
Joined: Sat Nov 08, 2008 7:26 am

Re: Any way to extend the code-completion data?

Post by zuggsoft »

I'll give that a try and let you know if it works.

The key with Frameworks is that most files are not explicitly included/required. So just scanning for include/require isn't good enough. What some other PHP editors do is to scan *all* files within the application directory tree. Unfortunately, that can be slow, so what many of them do is to let you enable/disable which directory trees should be scanned, or to specify an exact list of files to scan (in other words, you let the user define the included file list rather than looking for the include statement automatically).
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Re: Any way to extend the code-completion data?

Post by Karlis »

We will discuss this, probably there is a better solution that does not involve frequent scanning.
Karlis Blumentals
Blumentals Software
www.blumentals.net
mikecocklin
Posts: 9
Joined: Tue May 30, 2006 2:36 pm

Re: Any way to extend the code-completion data?

Post by mikecocklin »

Hi Guys,

I have also now starting using codeigniter in earnest. (Great framework) and so am interested to know if there has been any further work in this area.

I would dearly love to be able to use webuilder with codeigniter for both autocomplete and also debugging.

How has the research into this been going since 2008?

Kind Regards

A Webuilder fan (Okay - Mike)
Gatis
Blumentals Software Developer
Posts: 545
Joined: Sun Mar 05, 2006 12:30 am
Location: Latvia

Re: Any way to extend the code-completion data?

Post by Gatis »

Hi Mike,

We are working on a new version now, which will also include new functionality that will allow to add frameworks more easily. First will come jQuery, with one or two other JavaScript frameworks. If we manage, we will add also some PHP frameworks already with next major release. But I can not tell if there will be also support for the framework you mentioned. We will first add the most popular.

Kind regards,
Gatis
Kind regards,
Gatis Avots
mikecocklin
Posts: 9
Joined: Tue May 30, 2006 2:36 pm

Re: Any way to extend the code-completion data?

Post by mikecocklin »

Gatis,

Many thanks for the update. I may not be the most vocal in the forums but I can assure you I am a huge fan of Webuilder. I use it every single day and just love it. To be able to intergrate frameworks would be just such a huge benefit for me.

The only other thing would be syntax highlighting like in PhpED or phpDesigner where if you have different code types such as php css and html in the one file, the code type that you select highlights throughout the page and other code types dim so it is easy to see all of the code of a particular type in a page easily. I did mention it to Karlis before.

Anyway, any idea how far away you are from the next release. I am always checking to see if anything new is available.

A fan
AKA.
Mike
User avatar
MikeyB
Top Contributor
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK
Contact:

Re: Any way to extend the code-completion data?

Post by MikeyB »

Gatis wrote:First will come jQuery, with one or two other JavaScript frameworks.
That's brilliant, over the past 6 months or so I've started using jQuery in my projects, and the more I use it the more I find it so so usefull, and doing more & more stuff with jQuery.

I find it almost a shock to load up an old project to find it's not using jQuery!
Gatis
Blumentals Software Developer
Posts: 545
Joined: Sun Mar 05, 2006 12:30 am
Location: Latvia

Re: Any way to extend the code-completion data?

Post by Gatis »

The only other thing would be syntax highlighting like in PhpED or phpDesigner where if you have different code types such as php css and html in the one file, the code type that you select highlights throughout the page and other code types dim so it is easy to see all of the code of a particular type in a page easily. I did mention it to Karlis before.
Yes, we have received simmilar requests before. While it might be possible to implement this, currently we tend to think it is not needed. Maybe if we get more requests, this might change.
Anyway, any idea how far away you are from the next release. I am always checking to see if anything new is available.
We hope to release new version till the end of this year. But plans can change if we do not move forward so fast as we hope to.
Kind regards,
Gatis Avots
mikecocklin
Posts: 9
Joined: Tue May 30, 2006 2:36 pm

Re: Any way to extend the code-completion data?

Post by mikecocklin »

We hope to release new version till the end of this year. But plans can change if we do not move forward so fast as we hope to.
Then i shall disturb you no longer :) Looking forward to the new release.
daveporter
Posts: 51
Joined: Sun Jun 12, 2005 9:04 am

Re: Any way to extend the code-completion data?

Post by daveporter »

My understanding is that the modern IDE's scan the source file folder(s) of the framework and work out what it needs to parse!

Certainly RubyMine does this for Ruby On Rails
&
Netbeans does it for YII

Worth looking into !

It doesn't seem very efficient for the developers to have to manually provide support for specific frameworks...

HTH, Dave
Gatis
Blumentals Software Developer
Posts: 545
Joined: Sun Mar 05, 2006 12:30 am
Location: Latvia

Re: Any way to extend the code-completion data?

Post by Gatis »

It doesn't seem very efficient for the developers to have to manually provide support for specific frameworks...
We will not be able to provide functionality that reads out all necessary data for each framework possibly on earth.
If the data structure for defining this framework would be somehow standardized, then it would work, but it is not.
Currently the best we can do - is to provide a way to extend the auto-complete, and then provide data files for some of the major frameworks.
Files for other frameworks can then be shared by the user community, once the files are available.

Gatis
Kind regards,
Gatis Avots
biotech
Posts: 27
Joined: Mon Mar 09, 2009 10:08 pm

Re: Any way to extend the code-completion data?

Post by biotech »

Gatis wrote:
It doesn't seem very efficient for the developers to have to manually provide support for specific frameworks...
We will not be able to provide functionality that reads out all necessary data for each framework possibly on earth.
If the data structure for defining this framework would be somehow standardized, then it would work, but it is not.
Currently the best we can do - is to provide a way to extend the auto-complete, and then provide data files for some of the major frameworks.
Files for other frameworks can then be shared by the user community, once the files are available.

Gatis
This sounds great and much better than offering every single framework as a bloat....so please do not ruin this very nice editor.
Any word when we might get to have these in action? At lest we could start to build the language/data files...snippets can go only so far before becoming a full blown library :wink:
Thanks.
biotech
Posts: 27
Joined: Mon Mar 09, 2009 10:08 pm

Re: Any way to extend the code-completion data?

Post by biotech »

With the WeBuilder 2011 has this changed? I can not seem to find any info on this feature.
Thanks.
Gatis
Blumentals Software Developer
Posts: 545
Joined: Sun Mar 05, 2006 12:30 am
Location: Latvia

Re: Any way to extend the code-completion data?

Post by Gatis »

Hi,

I will describe how it works for PHP libraries.

Adding a new library for PHP:
1) Go to following folder: D:\Program Files\WeBuilder 2011\data\libraries
2) open file libraries.ini and add a new library. For example:
a) Under section "[%ext_libraries]" add entry "PHP=My_custom_lib"
b) Add a new section [%My_custom_lib] and add the following entries:
filetype=PHP
entries=My_custom_lib_entries.xml

3) Create a new file under the same directory named "My_custom_lib_entries.xml". Contents of xml file are as follows:

Code: Select all

<?xml version = "1.0"?>
<Library-list>
<Library>
...
</Library>
...
</Library-list>
Each one item in the list of additional items to be used in Auto-complete must be in the following format:

Code: Select all

<Library>
<pitType></pitType>
<ps1></ps1>
<ps2></ps2>
<ps3></ps3>
<ps4></ps4>
<ps5></ps5>
<ps6></ps6>
<ps7></ps7>
<ps8></ps8>
<ps9></ps9>
<ps10></ps10>
<ps11></ps11>
</Library>
Meaning of each Tag is the following:
pitType = Type of the entry. Bellow you can see allowed values:
"2" for class;
"3" for function;
"4" for variable;
"5" for property;
"6" for constant;
ps1 =Item Name, for example, "My_custom_function_A"
ps2 =Item scope. Allowed values:
"1": Private;
"2": Public;
"3": Protected;
ps3 = 1 (is static property or method) 0 (is not static)
ps4 = for functions this field can be used to specify the function arguments. The format of the data should be:
"(character, text [, some_non_mandatory_argument])"
ps5 = Specifies the class name of the item. For example "My_class_name"
ps6 = If this class extends some other class, you can specify it here. For example, "My_parent_class0"
ps7 = Leave empty.
ps8 = Leave empty.
ps9 = specifies return type for functions. For example: "integer".
ps10 = Item Description, for example, "Function to calculate occurrences of a character in given text."
ps11 = For class entries (pitType = 2), you can specify also inherited items from parent classes in the following manner:
"Parent_Class1::My_custom_function_0(),My_custom_function_1();Parent_Class2::&My_custom_variable"

All data in the .xml file needs to be processed before saving it:
( needs to be replaced with (
) needs to be replaced with )
& needs to be replaced with $

It is suggested to see an already existing .xml file from the library folder to see how the file should look in the end.
Maybe I have not explained well some parts of this process. If so, let me know, and I shall try to do it better!
Kind regards,
Gatis Avots
Post Reply