vscode-intelephense
vscode-intelephense copied to clipboard
Stubs in included paths not being recognized
Describe the bug
I downloaded the WP CLI stubs from
Unfortunately adding the path to the directory in included_paths
didn't work like it did with the WooCommerce plugin (so that I can jump to definitions to see what they do under the hood)
I restarted editor multiple times but no dice.
What worked is adding that same! path to the list of intelephense stubs in settings.json
.
Note: I tried adding to included paths for User since I need these symbols throughout multiple workspaces.
To Reproduce
Try using the WP_CLI
constant in a file while having the stubs github repo in your list of included paths.
Expected behavior Steps should be recorgnized
Screenshots Doesn't work:

Works:

Platform and version MAC OS Big Sur Intelephense 1.7.1 Premium
Hey @bmewburn but I have the same issue, but in my case on Windows / WSL2.
No matter what path I tried in intelephense.environment.includePaths
I couldn't get it to work. I tried referencing folders in both my Windows file system and my WSL2 instance -- neither work.
If instead I do what @UVLabs reported and use intelephense.stubs
it works (using either a Window file system path or with a WSL2 path), despite settings.json reporting it as "Value not accepted." It's cool this works, but the error message is annoying and getting it to work property via includePaths
would be greatly appreciated.
In other words, this worked:
"intelephense.stubs": [
"/home/onetrev/stubs"
"apache",
"bcmath",
"bz2"
....
]
Not sure if it makes a difference, but it might help you bug test, I'm running with a premium license.👍
I've run into this issue as well.
My old includePaths
still works for files that have been previously added:
"intelephense.environment.includePaths": [
"/Users/Jacob/Projects/Assets/Stubs",
],
But any new files added are not registered, unless I add them to the "intelephense.stubs"
array, which throws a warning that the value is not an accepted match, but works regardless.
I'm seeing the same issue, adding them intelephense.stubs
works, they don't need to be in intelephense.environment.includePaths
Just to be clear, as I'm really hoping @bmewburn can fix this long standing issue, while adding it to intelephense.stubs
works, you do get this warning:
"Value is not accepted."
You should be able to add the path to intelephense.environment.includePaths
from how I understand it. Which would be ideal as then you wouldn't receive the above warning message.
Having trouble reproducing this issue. It's working for me.
Hey @bmewburn, I just did some testing. And you are right, includPaths works, well sort of / mostly. There is a potential problem still...
I am able to add a path to intelephense.environment.includePaths
, and Intelephense picks up my acf-pro-stubs.php
file in there. Cool. That totally works as it should. But in my stubs folder, I have other stubs, including the two Wordpress stubs I want, wordpress-globals.php and wordpress-stubs.php. Those stubs though do not get picked up. If I add the this same folder to intelephense.stubs
it does work. That's weird isn't it?
Yes, I do know I can add Wordpress to this setting, intelephense.stubs
, but then when I do it creates a huge list in my settings.json
file, and that bugs me as I like to keep things short and tidy. It's a problem I know. :) Regardless though, shouldn't all stubs in intelephense.environment.includePaths
work? Thanks! And I really hope that helps explain it better.
@onetrev might the files be larger than the max file size setting? intelephense.files.maxSize
@onetrev might the files be larger than the max file size setting?
intelephense.files.maxSize
That looks like the cause. I just updated my intelephense.files.maxSize
from 1MB (1000000 bytes) to 10MB (10000000 bytes) and all paths work again in the folder I added to the intelephense.environment.includePaths
Confirmed @bmewburn. Thank you! Relief. As @jacobcassidy also noted, this fixed the issue. I'd say this issue could now be closed.