PHP: Click namespace/objectnname/function/method to go to file/decleration


#1

Hi

Anyone know of a package which enables click on namespaces/object names?
In PHPstorm, if you click on an object name, or in the namespace(or a function/method) it will open the file and jump to the decleration.
I miss similar functionality in ATOM


#2

It would be good to have this implemented in Atom or in a package


#3

I am looking for this too. If you stick to psr-4 which means you should have your namespace be your folder it should be not so hard to do, correct? Any news in this?


#4

Is this functionality already possible?


#5

Someone just mentioned creating a package for this type of functionality here:


#6

I wrote some documentation in case someone wants to build a provider for PHP. As far as I know no one has built any 3rd party plugins (providers?) yet, but if a fully functional example will help I also created coffee-links


#7

This package has a lot of potential but so far it only supports files referenced in require statements.


#8

What more should it support? It comes with a parser for Javascript that allows for navigating your project through requires. All other languages should be implemented through the service interface provided by other packages.

Tonight I’m working on being able to jump up to where a variable is defined. If the variable comes from a require you can jump through the require(....) to the function where it’s defined.


#9

I thought it brought up files when the file name in the require was clicked on. Does it also support clicking on namespaced variables/objects?


#10

How much it supports is totally up to the package providing the service. It’s going to be up to whoever builds a PHP parser to decide if they just want to just link the require / include calls, or generate links on objects/variables.

As for Javascript, I just pushed a branch named variables that has basic support for jumping to where a variable was defined. I need to run this through some more diverse code to make sure it works on more than just itself.

I have no plans to add such functionality to coffee-links but would welcome a PR. CoffeeScript’s AST makes it very difficult to track down all variable declarations.


#11

Yesterday I played with atom and did something https://github.com/harikt/php-hyperclick . I am very thankful to everyone who have contributed to this discussion before.

It works currently on Ubuntu ( Hopefully it should work with *nix systems ) .
If anyone is interested welcome to contribute. Not submitted to atom for the current time. That could be done for later. You can clone the package and create a symbolic link in ~/.atom/packages/php-hyperclick to where you cloned.


#12

I tried this php hyperclick, its working like a charm. But as you stated there is some error while ctrl + click. I am looking for more updates on this. I am newbie to nodejs, anyway I will try to fix bugs and will update