#2384 Included File list, Function list, and autocomplete from PHP include required, etc. files

Next_Release
open
nobody
5
2014-04-22
2014-02-04
themaster507
No

Requesting

First, I have used other IDEs before that has support to easily open PHP files that have been included by means of include, require, or require_once functions. I believe that this could easily be done in Notepad++ and then a new window could list included files where you could quickly click to open them.

Secondly, it should be possible to create a setting that would also parse these included files and add function in them to the functions list.

Thirdly, it should be possible to add to the auto-complete list of functions an words to also parse these included files.

Here is a Case Use

I am working on a web application project and have created two custom PHP files.

  1. functions.php - is a compilation of PHP functions that I regularly use throughout my site.
  2. MySQLclass.php - is a custom class that I use to communicate with the database layer.

When I create a new page i simply include these files in the first few lines of code and then I use the functions and class throughout the page.

As it is now these functions and classes would not be listed in the function list, to open the file I have to use a plugin like explorer, and auto-complete of these functions does not work.

It would be nice if when I opened my main file it parses theses functions and classes and added them to the function list, gave me an easy way to quickly open these included files, and then also parsed these included files for use in auto-complete.

Alternatively

If the function list could be expanded to allow a static file to be loaded in it that then could be easily accessable while working on other files without having to switch back and forth.

Thank you for the consideration.

Discussion

  • StanE
    StanE
    2014-04-22

    I wrote a plugin (ACCPC) which does most of what you want, I think. Except for included(), include_once() and require() statements. While it is thereotically possible to collect the included files, often it is not possible. Since PHP is a language which is parsed at runtime, in many situations you can't figure out what value a variable or parameter contains without "executing" the full PHP code.

    Example:
    include($relativePath . "subfolder\file.php");
    include(getPath() . "subfolder\file2.php");

    You don't know the full path since you don't know the value of $relativePath. It might be defined somewhere else (even in another file). And you can't execute the entire PHP code, since you could execute some very sensitive / manipulating code. For example, the getPath() function might get the value from a database or another local file... while logging all calls back into the database or something like that.

    In my plugin, I removed the parsing of include - statements again and instead I simply parse all files recursively inside a "root folder". Maybe you want to try it out?