require_once not suggesting anything

I have index.php and a classes folder with other php files with it. When adding require_once to the index.php file I was expecting some kind of suggesting to appear so that I could populate it quickly.  Instead I have to type out the full pathname.

Example:

require_once 'classes/errorHandler.php';
require_once 'classes/Validator.php';

Tried adding "." to the php include path but that didn't help.  What needs to be done here.


NOTE to those trying to be helpful.  I am not asking about autoloading these files.  This is about understanding something about phpstorm.

11 comments
Comment actions Permalink

Hi there,

I was expecting some kind of suggesting to appear so that I could populate it quickly.  Instead I have to type out the full pathname.

It's not clear what you actually see there -- screenshots (or even better -- screencast) please (P.S. sample project is also welcome).

As far as I can tell it works OK here (unless you want different behaviour):
screen01.png

0
Comment actions Permalink

I wish I could get you a screencast of the thing I want but isn't happening.  I guess I need to learn to use gimp!
:D

But what you have in your image is NOT happening in mine and I expected it to do what you have.  Is there a setting I need to change?  Does this do it by default?

0
Comment actions Permalink

1) I don't really use require/include statements -- autoloading does almost all the job

2) As far as I'm aware it just works like that (I've the same results even if I disable all custom plugins)

My question here: are we talking about automatic popup .. or is it even manual one does not work (Ctrl+Space using Default keymap)?

I guess I need to learn to use gimp!
0
Comment actions Permalink

Thanks as I noted in the OP: NOTE to those trying to be helpful.  I am not asking about autoloading  these files.  This is about understanding something about phpstorm functionality.

Please understand I am trying to communicate and get the point made that this is NOT ABOUT required_once but the action of phpstorm at the point of using required_once.
Saying something about autoloading doesn't start to address what I am asking about.  Please tell me what can I say to make that any clearer?


I haven't added any addons/plugins.  This is a fresh install on a system with a fresh windows 7 install.  (motherboard/cpu shorted. bummer).

The files in this project are (yes, they currently exist as files in those paths):
index.php
classes/ErrorHandler.php
classes/Validator.php

While edition index.php, when I add require_once "classes/           <<<<note, I didn't finish the complete line ok. please understand this is part of discribing the problem.  I expected a popup or little window near the area suggesting one of the two files in the classes folder.

Control+Space didn't do anything.

So how does phpstorm know that these files exist for purposes of the popup?  Do I have to configure anything like a PATH for this?

0
Comment actions Permalink

Thanks as I noted in the OP: NOTE to those trying to be helpful.  I am not asking about autoloading  these files.  This is about understanding something about phpstorm functionality.

Please understand I am trying to communicate and get the point made that this is NOT ABOUT required_once but the action of phpstorm at the point of using required_once.

Saying something about autoloading doesn't start to address what I am asking about.  Please tell me what can I say to make that any clearer?

Try not to read between the lines.

I've only stated that my experience with require/include statement is rather limited because of the use of autoloader -- I have NEVER stated that you should use it / switch to it.

While edition index.php, when I add require_once "classes/           <<<<note, I didn't finish the complete line ok.

1) You better have statement completed (e.g. "require_once "classes/[CURSOR]";") -- code analyzer works MUCH better then.

2) Regardless of this nuance -- it works exactly the same -- Ctrl+Space (or whatever you may have there for "Code | Completion | Basic Completion") offers file names (brand new installation of PhpStorm v8.0.3 in VM (Win7 x64) + brand new empty project)
screen01.png

So how does phpstorm know that these files exist for purposes of the popup?  Do I have to configure anything like a PATH for this?

Are they part of the project (like it shown on the screenshot above)?

  • If yes (same file structure) then IDE will pick up them with no extra moves -- all what I did is created those empty file and started typing in index.php
  • If not -- provide some info (e.g. screenshots)
0
Comment actions Permalink

I am so frustrated talking to you.  Do you want me to tell you what I am doing or  what I am hoping for. I can't seem to get either point made. The part where I wrote require_once "classes/ " was meant to illustrate when I thought the popup should happen.  AS IT CURRENTLY IS I HAVE TO TYPE THE WHOLE THING OUT.

HERE IS WHAT I HAVE TO TYPE:


require_once "classes/ErrorHandler.php";
require_once "classes/Validator.php";

note: the above is what I call a cut and paste. it is in the real file.

note:  I never see the action like you have in your image when I do the required_once.

this little popup, I do not see it.  I haven't altered the settings that I am aware of and this is setup with the default settings.

.
.
.
.
.
.
.
.
.
.


1)  Should I see action as in your image?
2)  If yes, why don't I see it?
3)  In not, are you hitting any key combination to get this to appear?  I assume it is automatic.
4)  If not, what settings are required for this to appear.
Why isn't this the default behavior if it isn't.

0
Comment actions Permalink

I am so frustrated talking to you.  Do you want me to tell you what I am doing or  what I am hoping for. I can't seem to get either point made. The part where I wrote require_once "classes/ " was meant to illustrate when I thought the popup should happen.  AS IT CURRENTLY IS I HAVE TO TYPE THE WHOLE THING OUT.

HERE IS WHAT I HAVE TO TYPE:


require_once "classes/ErrorHandler.php";
require_once "classes/Validator.php";

note: the above is what I call a cut and paste. it is in the real file.

note:  I never see the action like you have in your image when I do the required_once.

this little popup, I do not see it.  I haven't altered the settings that I am aware of and this is setup with the default settings.

.
.
.
.
.
.
.
.
.
.


1)  Should I see action as in your image?
2)  If yes, why don't I see it?
3)  In not, are you hitting any key combination to get this to appear?  I assume it is automatic.
4)  If not, what settings are required for this to appear.
Why isn't this the default behavior if it isn't.

0
Comment actions Permalink

I am so frustrated talking to you.  Do you want me to tell you what I am doing or  what I am hoping for. I can't seem to get either point made. The part where I wrote require_once "classes/ " was meant to illustrate when I thought the popup should happen.  AS IT CURRENTLY IS I HAVE TO TYPE THE WHOLE THING OUT.

HERE IS WHAT I HAVE TO TYPE:


require_once "classes/ErrorHandler.php";
require_once "classes/Validator.php";

note: the above is what I call a cut and paste. it is in the real file.

note:  I never see the action like you have in your image when I do the required_once.

this little popup, I do not see it.  I haven't altered the settings that I am aware of and this is setup with the default settings.

.
.
.
.
.
.
.
.
.
.


1)  Should I see action as in your image?
2)  If yes, why don't I see it?
3)  In not, are you hitting any key combination to get this to appear?  I assume it is automatic.
4)  If not, what settings are required for this to appear.
Why isn't this the default behavior if it isn't.

0
Comment actions Permalink

I see no images in your post -- at all.

Regardless...
screen01.png

1)  Should I see action as in your image?

Yes.

2)  If yes, why don't I see it?

Isn't that exactly what we are doing here -- trying to figure it out?

3)  In not, are you hitting any key combination to get this to appear?

Sure (for a third time) -- it's Ctrl+Space or "Code | Completion | Basic"

https://www.jetbrains.com/phpstorm/help/basic-code-completion-completing-names-and-keywords.html?search=code%20compl

I assume it is automatic.

Not inside the strings as there is no guarantee on what you are going to type there.

But it is automatic during ordinary PHP code (writing methods/classes/etc).

4)  If not, what settings are required for this to appear.

All settings that affect code completion are located under "File | Settings | Editor | General | Code Completion"

Why isn't this the default behavior if it isn't.

Code completion popup is set to appear automatically by default.

0
Comment actions Permalink

I may also suggest to try "File | Invalidate caches..." and restart IDE.

Although .. if this is really fresh install and not an upgrade from one of the previous versions (e.g. 8.0.2 -> 8.0.3) .. then this should not make the difference... but worth trying it just in case.

0
Comment actions Permalink

Wayne,

I believe that you are just wanting the IDE to suggest the files, that are in that folder, correct?

<ROOT_FOLDER>
     |-<CLASSES_FOLDER>
          |-users.class.php
          |-orders.class.php
     |-index.php

So that when you type, "require_once "clas the IDE suggests, "classes_folder/users.class.php" or "classes_folder/orders.class.php"?  Am I following you correctly?

Maybe this JetBrainsTV video will help?  https://www.youtube.com/watch?v=oYkuAEolzAQ&list=PLQ176FUIyIUbfeFz-2EbDzwExRlD0Bc-w&index=4

Regards,

Sven2157

0

Please sign in to leave a comment.