vscode-php-intellisense icon indicating copy to clipboard operation
vscode-php-intellisense copied to clipboard

Go to definition -> no definition found

Open TypedSource opened this issue 6 years ago • 43 comments

i installed php-intellisense in the morning, disabled php.suggest.basic, set php.executablePath and opened my php project folder (inserted into workspace).

if i want to go to a definition of a class or function or var i allways get a message that no definition is available.

http://prntscr.com/hk8x14

the project was written in intelliJ and all works fine there. a change to vscode without correct working php intellisense is senseless.

TypedSource avatar Dec 07 '17 10:12 TypedSource

Do you see any errors under "Help" > "Developer Tools"

sunverwerth avatar Dec 07 '17 12:12 sunverwerth

No, there is no error in the console and no error in the network tab. looks all fine.

nothing is triggered in the logs on trying to jump to definition

TypedSource avatar Dec 07 '17 14:12 TypedSource

I have the same problem too, those options only work if i want a definition in the current file

rquispeq avatar Dec 24 '17 15:12 rquispeq

no sollution for it? i think vscode is going to be useless for me as php coder under windows now and i switch back to intelliJ or Atom

TypedSource avatar Jan 15 '18 08:01 TypedSource

Go to Definition is the first feature of this extension that I tried. Instead of getting an error, the "progressbar" just keeps moving across the screen as if it's constantly trying.

Does Go to Definition work for anyone? Or is there something specifically wrong with our installations?

pacobyte avatar Jan 22 '18 15:01 pacobyte

I have the same problem.

  1. I can only go to a definition in the same file.
  2. If I open the file containing the definition, I can now go to the definition.
  3. If I close the file containing the definition again, I can still go to the definition.
  4. After restart of VS Code I am back to step 1.

Any way of forcing a scan or indexing of the workspace?

(I'm on MacOS 10.13.3)

[Edit] No errors listed in Developer Tools console.

iEns avatar Feb 02 '18 17:02 iEns

Same. Go to definition only works for definitions that exist in already-opened files. This makes closing and reopening a PHP project extremely painful.

cha0s avatar Feb 25 '18 23:02 cha0s

Hi, I remember that i coudn't fix this problem, but then i found a extension called Codeiginiter Intelliphense or something, and it has those options too. Of course, it only works if you have the framework. It could help somebody :)

rquispeq avatar Feb 28 '18 03:02 rquispeq

Does anyone here have try to reset the php.exe? Sometimes the php.exe isn't working and need to be killed.

benyaminl avatar May 02 '18 08:05 benyaminl

I have same problem, i need this feature like "Go to definition" of Sublime text 3

minkmk94 avatar May 17 '18 07:05 minkmk94

I definitely need to be able to go to definition as a PHP developer. Shame, I really liked vs code, but this is an essential feature.

wagnerjsilva avatar May 18 '18 10:05 wagnerjsilva

As others have mentioned, 'Go to definition' only seems to work if you have already opened the file where the definition is located. Does anyone have a solution for this?

torykepler avatar May 22 '18 15:05 torykepler

I never experienced it. Hmmm...

Sent from My Asus Pegasus X005

Pada tanggal Sel, 22 Mei 2018 22.22, Tory Kepler [email protected] menulis:

As others have mentioned, 'Go to definition' only seems to work if you have already opened the file where the definition is located. Does anyone have a solution for this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/felixfbecker/vscode-php-intellisense/issues/225#issuecomment-391031943, or mute the thread https://github.com/notifications/unsubscribe-auth/ACr9NHJlvQg3c-kAExlRweycDatWKSPlks5t1C0lgaJpZM4Q5SxE .

benyaminl avatar May 22 '18 16:05 benyaminl

Same issue here...

JoffreyPoreeCoding avatar May 25 '18 15:05 JoffreyPoreeCoding

Same issue here. Quite a pain in the ass

tposcic avatar May 29 '18 08:05 tposcic

Can anybody give more information? It works fine for me.

Extension version? Operating system? PHP Version? How many source files?

sunverwerth avatar May 29 '18 12:05 sunverwerth

go to definition not working default

win 7 sp1

Valera1980 avatar Jun 05 '18 13:06 Valera1980

not working for me too, my info:

  • OS: WINDOWS 10 Home
  • VS Code ver 20180731vscodever
  • VS Code ext 20180731activeext
  • VS Code user settings 20180731usersettings
  • function undefined 20180731cannotfind

danielhuang-030 avatar Jul 31 '18 03:07 danielhuang-030

@danielhuang-030 When you tried the autocomplete does the autocomplete work? If not than don't expect that the goto function would work. I suggest to try https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client I don't advertise it, but for now that's a alternative that works very good and not depends on php.exe

benyaminl avatar Aug 01 '18 02:08 benyaminl

@benyaminl Thank you for the suggestion, I just installed, it looks great!

danielhuang-030 avatar Aug 02 '18 02:08 danielhuang-030

Any updates on this issue? I have the same problem! This is probably the most important feature everyone is looking for and there has to be a solution to solve the current problem.

VS Code - version 1.27.1 PHP IntelliSense - version 2.3.5 PHP 7.1.16 Mac OS High Sierra - version 10.13.6

---- UPDATE ---- Actually I think it works it some use-cases and it doesn't it some different use-cases. For example, I have this code from a Laravel project:

    /**
     * Show details for a given listing
     *
     * @param  \App\Area   $area
     * @param  \App\Listing   $listing
     *
     * @return \Illuminate\Http\Response
     */
    public function show(Area $area, Listing $listing)
    {
        if (! $listing->live()) {
            abort(404);
        }

        if (auth()->check()) {
            auth()->user()->viewedListing($listing);
        }

        return view('listings.show', compact('listing'));
    }

I was able to get the Go To Definition to work for the live() method, but not for viewedListing() method.

vasilestefirta avatar Sep 10 '18 05:09 vasilestefirta

@vasilestefirta change to Intelephense, it's more stable and more powerful than Intelisense https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client

For laravel I think you need some more tools for it.

benyaminl avatar Sep 10 '18 13:09 benyaminl

@benyaminl you already mentioned this before in the thread. Please keep this issue on topic.

To everyone else: If there is no update posted on this issue, there is no update. I don't have the capacity to investigate this in my free time. If anyone wants to do a PR with a fix, I am willing to invest time to review it. Given the amount of people here that posted here that they are affected by this, one would think someone here would care enough to look into it. It's just PHP code 🙂

felixfbecker avatar Sep 10 '18 13:09 felixfbecker

@felixfbecker I think it's time for you to set up patreon profile so it would be your side project that generate money :v: so you have more time for develop it because it generate money :v

benyaminl avatar Sep 10 '18 13:09 benyaminl

@benyaminl Intelephense works great for me! Thanks for the suggestion 💯 👍

vasilestefirta avatar Sep 12 '18 04:09 vasilestefirta

On MacOS, when a folder is a symlink to another folder the content is not indexed, thus some definitions are not working. Could this be the problem ?

Koekoe avatar Sep 14 '18 10:09 Koekoe

The problem is that by default this extension doesn't scan all files. You have to do hax like patching the source, or making sure the first directory in your workspace is an aggregate of any other directories in your workspace (defeating the purpose of having them broken down cleanly in the first place).

The solution is to make the scan directories configurable, but I haven't written a patch for it yet.

cha0s avatar Sep 15 '18 15:09 cha0s

@cha0s This was it for me, and I'm curious how many others in this thread are in similar situations. I had two folders: a project folder (mostly text files and assets) and a library folder (PHP). "Go to Definition" only worked when the file containing the definition was already opened.

I then removed the project folder, so I only had the PHP folder, and now can navigate to those definitions even when the file is closed.

And for anyone wondering - I added the project folder back so that it was second on the list, and Intellisense still worked happily after a fresh restart. So it appears from behavior like the defect here is that the plugin only looks at the first directory in the list.

maslade avatar Nov 21 '18 15:11 maslade

Works for me as well if the first folder in the project is the one including all the other code. Thanks for the tip.

moonbas3 avatar Jan 18 '19 16:01 moonbas3

Works for me as well if the first folder in the project is the one including all the other code. Thanks for the tip.

Nope. Just endless scanning in my case... Find all references does not work too.

vushe avatar Feb 08 '19 07:02 vushe