Welcome Guest, Not a member yet? Register   Sign In
Code completion suggestion
#1

Because CI uses dynamic class members for every loaded thing
PHP Code:
foreach (is_loaded() as $var => $class)
{
    
$this->$var =& load_class($class);


IDEA like PHPStorm have difficulty with code completion, and shows many many warnings, for stuff like "$this->db"

There is an open YouTrack feature request for over 6 years, which testifies how difficault it is to interperate what is and what is not a member of the classes CI_Controller and CI_Model.

The current fix people that use PHPStorm are using, is this. A code completion helper, that adds "properties" to above classes, and makes life coding with CI much more pleasant.

Now, I know it is not technically correct to add those as properties, because they are extremely dynamic, but I think that the CC helpers adds the essentials, that are by default loaded, so I think adding those to the core codebase would be helping, even though not fully correct.


What do you think?
Do you have a better solution for the given problem?
Reply
#2

This is not our problem really ...

While it's nice for your tools to work as best as possible, it is the IDE vendor's job to make that work and not ours. Even if it's as easy and harmless as adding docblock comments, we've got enough on our hands already.
Plus, JetBrains (the company behind phpStorm) sell a product (we don't), so they have a monetary incentive to make it work one way or another.
Reply
#3

(11-22-2016, 06:16 AM)Narf Wrote: This is not our problem really ...

While it's nice for your tools to work as best as possible, it is the IDE vendor's job to make that work and not ours. Even if it's as easy and harmless as adding docblock comments, we've got enough on our hands already.
Plus, JetBrains (the company behind phpStorm) sell a product (we don't), so they have a monetary incentive to make it work one way or another.

Of course, I understand that.
However, the "problem" is not only with JetBrains products. If something like this was built into CI, it would work in all IDEs, while if JetBrains somehow implements it, it will work specifically on their IDE products.

Myself, I have found a solution that works - download the CC helpers every time I use a new version of CI, but not everyone are aware of it, or like to do it this way.

Thanks anyway.
Reply
#4

It is suppose to be in the next version of phpStorm.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(11-22-2016, 07:17 AM)InsiteFX Wrote: It is suppose to be in the next version of phpStorm.

I was not aware. It is still tagged "Backlog"

Thanks!
Reply
#6

PHPSTORM 2016.3 PREVIEW
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

yeah i was excited about that announcement from phpstorm but i've tried it and its not doing anything. maybe it only works on certain platforms.

anyway - OP - here's a link to what i use - read the instructions carefully and use this file as application/config/autocomplete.php and your database methods $this->db-> will autocomplete and show you all the options. it will show you ALL the codeigniter code for autocomplete. this is very similar but every other solution i've seen has a bunch of other b.s. you have to do - with this you just drop the file in the folder and it works. the only thing i have not tried to do is find a method for automatically getting the model names, thats why the example file lists some sample model names to make that clear.
http://forum.codeigniter.com/thread-6364...#pid325791
Reply
#8

(11-22-2016, 11:43 AM)cartalot Wrote: yeah i was excited about that announcement from phpstorm but i've tried it and its not doing anything. maybe it only works on certain platforms.

anyway - OP - here's a link to what i use - read the instructions carefully and use this file as application/config/autocomplete.php and your database methods $this->db-> will autocomplete and show you all the options. it will show you ALL the codeigniter code for autocomplete. this is very similar but every other solution i've seen has a bunch of other b.s. you have to do - with this you just drop the file in the folder and it works. the only thing i have not tried to do is find a method for automatically getting the model names, thats why the example file lists some sample model names to make that clear.
http://forum.codeigniter.com/thread-6364...#pid325791

The current thing I use works just fine, thank you.
My request is not for me, it is for it to work in all editors, not with tricks.
Reply
#9

(11-22-2016, 06:48 AM)AmitMY Wrote:
(11-22-2016, 06:16 AM)Narf Wrote: This is not our problem really ...

While it's nice for your tools to work as best as possible, it is the IDE vendor's job to make that work and not ours. Even if it's as easy and harmless as adding docblock comments, we've got enough on our hands already.
Plus, JetBrains (the company behind phpStorm) sell a product (we don't), so they have a monetary incentive to make it work one way or another.

Of course, I understand that.
However, the "problem" is not only with JetBrains products. If something like this was built into CI, it would work in all IDEs, while if JetBrains somehow implements it, it will work specifically on their IDE products.

Myself, I have found a solution that works - download the CC helpers every time I use a new version of CI, but not everyone are aware of it, or like to do it this way.

Thanks anyway.

I didn't say the issue is limited to JetBrains' phpStorm.
That I ended with a note about them having monetary incentive was an extra thought, not my entire argument - don't focus on that just because it's easy to attack it in isolation.

To reiterate my main point - tools are made to help us deal with stuff, not the other way around. In this case, the tools are the IDEs and the stuff is our framework. I have always stood by this principle and always will.
Reply
#10

Question for Narf: What IDE to you use when developing in CodeIgniter? Does it offer any autocompletion?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB