Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intelephense doesn't seem to work at all in my VSCode installation #1518

Closed
markvirtue opened this issue Nov 20, 2020 · 19 comments
Closed

Intelephense doesn't seem to work at all in my VSCode installation #1518

markvirtue opened this issue Nov 20, 2020 · 19 comments

Comments

@markvirtue
Copy link

Apologies for the newby question. I'm prepared to pay someone to fix this issue for me, if required.
Or if I should post this question elsewhere, please let me know.

I have just installed the latest VS Code (on Windows 10), and then installed JUST the Intelephense plugin. I purchase a license for Intelephense and activated it.

I created a simple test workspace - one folder, one file. I defined a simple function in that file, and then wrote a call to that function (in the same file). When I click on the call to the function, and press F12, I get the message "No definition found for '[function name]'".

I disabled the builtin PHP plugin "PHP Language Features", as instructed, but it made no difference - except that certain tips no longer appear.

I have set "php.suggest.basic" to false.
I have correctly set the "php.validate.executablePath" setting to "C:/xampp/php/php.exe"

It feels like the entire plugin is not working. This plugin has a great reputation, so I feel like there's something simple I'm missing. Can anyone suggest anything?

Thanks in advance,

Mark.

@bodydisplaynone
Copy link

+1, have kind of the same issue. I'm not sure when the plugin updated but whenever I open a php file it instantly turns red: undefined * (everything). I get undefined type, method, etc. errors. I can't ctrl+click anymore, f12 does not work either. I tried with multiple projects and none of them are working porperly. Here is an example of a braintree_php example integration that was downloaded from github, this is the unedited, original repo. The issue is present since a few days now, any idea what causing it?

Screenshot_2

@jimmypuckett
Copy link

jimmypuckett commented Nov 22, 2020

I am using a premium license, and I see this too. I am also on a new 13" MBP with the M1 chip, so I assume that this issue may be my environment. Being that I am on silicon, then I am having to run the exploration version of Code, so that may be related too?

I forgot to mention that I have php.validate.executablePath set to /opt/homebrew/bin/php, which is where I have homebrew installing arm executables.

$ /opt/homebrew/bin/php -v
PHP 7.4.12 (cli) (built: Nov 21 2020 22:14:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.12, Copyright (c), by Zend Technologies

@bmewburn
Copy link
Owner

Are there any errors in the vscode output tab?

@markvirtue
Copy link
Author

No, nothing. No errors.

P.S. Love Coffs Harbour. I'm just up the road in Mullumbimby...

@jimmypuckett
Copy link

jimmypuckett commented Nov 23, 2020

I have done some more testing with different versions of Code (stable, insiders, & exploration) on an M1 (Big Sur) & an Intel (Catalina) MBP:

  • MBP with Intel
    • Stable - Works
    • Insiders - Works
    • Exploration - Cannot run (requires M1)
  • MBP with M1
    • Stable - Works in Rosetta 2
    • Insiders - Works in Rosetta 2
    • Exploration - Will not index & there are no errors that I can find

I copied the settings.json to all 6 installs & made sure that I have the exact same plugins. I did comment out the php.validate.executablePath property in settings on the Intel MBP as the path to PHP is not in /opt. Both systems are running PHP 7.4.12 from homebrew.

I am not sure if any of the others are using the Exploration version, but I think that my issue is tied to the beta version of Code.

If I can test anything for you, please let me know. Thanks for the great plugin!

@bmewburn
Copy link
Owner

Thanks for the testing @jimmypuckett .

@markvirtue do you use short open tags? If so there's a setting for that intelephense.environment.shortOpenTag.
Other things to check:

  • Add file associations if your files have a different extension eg "intelephense.files.associations": ["*.inc"].
  • Try with other vscode extensions disabled.
  • Check you haven't excluded files intelephense.files.exclude.
  • Open the file folder instead of just the file.

Mullumbimby is a nice part of the world.

@markvirtue
Copy link
Author

Thanks Ben! The shortOpenTag setting seemed to fix it. I changed that, and lots of things started to work.

Maybe consider making that option default to TRUE...?

But it's not working 100% yet...

I have two Windows machines - one with all the code on it (the server), and a workstation on the same LAN, which accesses the source files across the network. If I open VSCode on the SERVER, and create a workspace that includes all the various folders involved the my application (C:/dir1, C:/dir2, etc), everything works 100% (and it's hugely useful - I love it!). But on my WORKSTATION (where I prefer to code), if I create a similar workspace with the same folders - referenced as //server/dir1, //server/dir2, etc - then some bits don't work. e.g. Pressing F12 on a function doesn't work (gives "No definition found"), and I get lots of squiggly-red-underlines under the names of "undefined" functions, even if the function is defined in a file that's part of the workspace and even OPEN in another tab.

Can you think why that might be? Surely it must be something simple...

I really appreciate this personal help, by the way. And as I said at the beginning of this thread, I'm happy to pay for your time to help me with these problems. My company can afford it! You're welcome to send me an invoice if you want.

Mark.

@bodydisplaynone
Copy link

I'm not sure what happened but after some research, I decided to roll back to a previous version, then update the plugin. Now everything works fine (1.5.4->1.5.3->1.5.4).

@markvirtue
Copy link
Author

My last remaining issue (network paths vs local paths) seems to have been resolved by adding paths to the "include path" setting.

@edwin-egalite
Copy link

I'm not sure what happened but after some research, I decided to roll back to a previous version, then update the plugin. Now everything works fine (1.5.4->1.5.3->1.5.4).

Downgrade and upgrade indeed resolved my problem too. Thanks.

@jimmypuckett
Copy link

FYI... I have downgraded all the way to 1.4.1 on my M1 mac with the exploration version & none of them worked. I have then upgraded back to 1.5.4 & still no go.

@lennardv2
Copy link

I am in the same boat as @jimmypuckett running apple silicon m1, php built with home-brew. None of the code references seem to work. The issue seems unrelated to @markvirtue or @bodydisplaynone

@relm
Copy link

relm commented Dec 15, 2020

Not working on my M1 Mac under the Exploration version either. I receive no errors, but none of my classes/functions are getting resolved. The other PHP IntelliSense extension from Felix, seems to work.

@bmewburn
Copy link
Owner

I'm going to close this as I think there's nothing to action regarding the original issue. For M1 Mac problems I've opened #1550 which will hopefully resolve this.

@olegtoptal
Copy link

Same problem. I'm on Ubuntu. The extension doesn't work at all. All the PHP files are grey:

Screenshot from 2021-04-19 12-39-49

@Nemachtilli
Copy link

I had the same error of class error underscores when the namespace had already been imported.
Shortcut ALt +Ctrl+i the namespace is imported successfully, but the error continued.

The only solution was to install PHP Intelephense 1.7.1

@bodydisplaynone
Copy link

What happens if you try to update it? See my comment above, I had the exact same problem and it was resolved by downgrading and then updating again. Currently running 1.8.2 latest and I have no issues.

@dbertovi
Copy link

Well, none of above tips helped me for the same problem. But, silly me :-). Undefined classes, constants, etc... Intelephense works like charm once working folder is opened! This was my case. So when installed, and VSCode restarted, I simply opened my current working folder, and all inclusions (include, require, include_once, require_once, Use, etc.) are then read and voila. Hope this answer helps.

@nickolasjadams
Copy link

When I downgraded it didn't work.

But I tried again and this time I hit the "Reload is required" button.
That did it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests